CHORE(merge): merge from develop
Some checks failed
Build Docker Image / build-and-push (push) Has been cancelled
CI / lint-and-build (push) Has been cancelled

- Initial setup and all features from develop branch
- Includes: auth, deploy, docker, style fixes
- K3S deployment configuration
This commit is contained in:
2026-01-06 17:29:16 +09:00
parent b4ce36ba3b
commit f78454c2a1
159 changed files with 18365 additions and 774 deletions

View File

@@ -0,0 +1,4 @@
import { handlers } from "@/lib/auth";
export const { GET, POST } = handlers;

View File

@@ -0,0 +1,31 @@
import { NextResponse } from "next/server";
import { auth } from "@/lib/auth";
export async function GET() {
try {
const session = await auth();
if (!session?.user) {
return NextResponse.json(
{ success: false, message: "로그인 필요", user: null },
{ status: 401 }
);
}
return NextResponse.json({
success: true,
data: {
id: parseInt(session.user.id),
userId: session.user.userId,
userName: session.user.name,
},
});
} catch (error) {
console.error("Get user error:", error);
return NextResponse.json(
{ success: false, message: "서버 오류가 발생했습니다.", user: null },
{ status: 500 }
);
}
}

View File

@@ -0,0 +1,95 @@
import { NextResponse } from "next/server";
import bcrypt from "bcryptjs";
import { prisma } from "@/lib/prisma";
export async function POST(req: Request) {
try {
const {
userId,
userPassword,
userCheckPassword,
userName,
userPhone,
authCode,
} = await req.json();
// 유효성 검사
if (!userId || !userPassword || !userCheckPassword || !userName || !userPhone || !authCode) {
return NextResponse.json(
{ success: false, message: "필수 정보를 모두 입력해주세요." },
{ status: 400 }
);
}
// 승인번호 검사
if (authCode !== process.env.CODE) {
return NextResponse.json(
{ success: false, message: "승인번호가 올바르지 않습니다." },
{ status: 400 }
);
}
// 비밀번호 확인
if (userPassword !== userCheckPassword) {
return NextResponse.json(
{ success: false, message: "비밀번호가 일치하지 않습니다." },
{ status: 400 }
);
}
// 중복 체크: 아이디
const existingUser = await prisma.user.findUnique({
where: { userId },
});
if (existingUser) {
return NextResponse.json(
{ success: false, message: "이미 사용 중인 아이디입니다." },
{ status: 409 }
);
}
// 중복 체크: 전화번호
const existingPhone = await prisma.user.findUnique({
where: { userPhone },
});
if (existingPhone) {
return NextResponse.json(
{ success: false, message: "이미 등록된 전화번호입니다." },
{ status: 409 }
);
}
// 비밀번호 해싱
const hashedPassword = await bcrypt.hash(userPassword, 10);
// 새로운 유저 생성
const newUser = await prisma.user.create({
data: {
userId,
userPassword: hashedPassword,
userName,
userPhone,
},
});
return NextResponse.json(
{
success: true,
data: {
userId: newUser.userId,
userName: newUser.userName,
},
},
{ status: 201 }
);
} catch (err) {
console.error("Signup error:", err);
return NextResponse.json(
{ success: false, message: "서버 오류가 발생했습니다." },
{ status: 500 }
);
}
}