Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/survey

This commit is contained in:
Dayoung 2025-05-21 17:54:23 +09:00
commit 1057c29995
9 changed files with 43 additions and 111 deletions

View File

@ -7,18 +7,6 @@ datasource db {
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
username String @unique
phone String?
email String?
password String?
kakao_id String?
avatar String?
created_at DateTime @default(now())
updated_at DateTime @updatedAt
}
model MS_SUITABLE {
id Int @id @default(autoincrement())
product_name String @db.VarChar(200)
@ -122,28 +110,28 @@ model SD_SURVEY_SALES_DETAIL_INFO {
model BC_COMM_H {
HEAD_CD String @id(map: "PK_BC_COMM_H") @db.NVarChar(6)
HEAD_ID String @db.NVarChar(100)
HEAD_NM String @db.NVarChar(100)
HEAD_JP String @db.NVarChar(100)
HEAD_4TH String @db.NVarChar(100)
REF_CHR1 String @db.NVarChar(100)
REF_CHR2 String @db.NVarChar(100)
REF_CHR3 String @db.NVarChar(100)
REF_CHR4 String @db.NVarChar(100)
REF_CHR5 String @db.NVarChar(100)
REF_NUM1 String @db.NVarChar(100)
REF_NUM2 String @db.NVarChar(100)
REF_NUM3 String @db.NVarChar(100)
REF_NUM4 String @db.NVarChar(100)
REF_NUM5 String @db.NVarChar(100)
REMARKS String @db.NVarChar(200)
SAP_YN String @db.NVarChar(1)
STAT_CD String @db.NVarChar(1)
DEL_YN String @db.NVarChar(1)
HEAD_ID String? @db.NVarChar(100)
HEAD_NM String? @db.NVarChar(100)
HEAD_JP String? @db.NVarChar(100)
HEAD_4TH String? @db.NVarChar(100)
REF_CHR1 String? @db.NVarChar(100)
REF_CHR2 String? @db.NVarChar(100)
REF_CHR3 String? @db.NVarChar(100)
REF_CHR4 String? @db.NVarChar(100)
REF_CHR5 String? @db.NVarChar(100)
REF_NUM1 String? @db.NVarChar(100)
REF_NUM2 String? @db.NVarChar(100)
REF_NUM3 String? @db.NVarChar(100)
REF_NUM4 String? @db.NVarChar(100)
REF_NUM5 String? @db.NVarChar(100)
REMARKS String? @db.NVarChar(200)
SAP_YN String? @db.NVarChar(1)
STAT_CD String? @db.NVarChar(1)
DEL_YN String? @db.NVarChar(1)
REG_DT DateTime? @db.DateTime
REG_ID String @db.NVarChar(50)
REG_ID String? @db.NVarChar(50)
UPT_DT DateTime? @db.DateTime
UPT_ID String @db.NVarChar(50)
UPT_ID String? @db.NVarChar(50)
QC_COMM_YN String? @default("N", map: "DF__BC_COMM_H__QC_CO__48CFD27E") @db.NVarChar(1)
BC_COMM_L BC_COMM_L[]
@ -181,11 +169,11 @@ model BC_COMM_L {
}
model MS_SUITABLE_ROOF_MATERIAL_GROUP {
ID Int @id @default(autoincrement())
ROOF_MATERIAL_GROUP String @db.VarChar(200)
ROOF_MT_CD String @db.VarChar(200)
REG_DT DateTime @default(now(), map: "DF__MS_SUITAB__creat__4F7CD00D")
UPT_DT DateTime
ID Int @id @default(autoincrement())
ROOF_MATERIAL_GROUP String @db.VarChar(200)
ROOF_MT_CD String @db.VarChar(200)
REG_DT DateTime @default(now(), map: "DF__MS_SUITAB__creat__4F7CD00D")
UPT_DT DateTime?
}
model MS_SUITABLE_DETAIL {

View File

@ -1,23 +0,0 @@
import { NextResponse } from 'next/server'
import { prisma } from '@/libs/prisma'
export async function POST(request: Request) {
try {
const body = await request.json()
const { username, email, password } = body
const user = await prisma.user.create({
data: {
username,
email,
password,
updated_at: new Date(),
},
})
return NextResponse.json(user)
} catch (error) {
console.error('Error creating user:', error)
return NextResponse.json({ error: 'Error creating user' }, { status: 500 })
}
}

View File

@ -1,7 +0,0 @@
import { NextResponse } from 'next/server'
import { prisma } from '@/libs/prisma'
export const GET = async () => {
const users = await prisma.user.findMany()
return NextResponse.json(users)
}

View File

@ -1,38 +0,0 @@
import { NextResponse } from 'next/server'
import { prisma } from '@/libs/prisma'
import { getIronSession } from 'iron-session'
import { cookies } from 'next/headers'
import { sessionOptions } from '@/libs/session'
import type { SessionData } from '@/types/Auth'
export async function POST(request: Request) {
const { username, password } = await request.json()
console.log('🚀 ~ POST ~ username:', username)
console.log('🚀 ~ POST ~ password:', password)
const user = await prisma.user.findFirst({
where: {
username: username,
password: password,
},
})
console.log('🚀 ~ POST ~ user:', user)
if (!user) {
return NextResponse.json({ error: 'User not found' }, { status: 404 })
}
const cookieStore = await cookies()
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
console.log('start session edit!')
// session.username = user.username!
// session.email = user.email!
session.isLoggedIn = true
console.log('end session edit!')
await session.save()
console.log('🚀 ~ POST ~ session:', session)
// return NextResponse.redirect(new URL(process.env.NEXT_PUBLIC_URL!, request.url))
return NextResponse.json(user)
}

View File

@ -35,7 +35,7 @@ export default function DownloadPdf() {
<>
<button onClick={handleDownPdf}>down</button>
<div ref={targetRef} style={{ boxSizing: 'border-box' }}>
<div style={{ margin: '0 auto', padding: 0, maxWidth: '800px' }}>
<div style={{ margin: '0 auto', padding: 0, maxWidth: '800px', minWidth: '800px' }}>
<div style={{ padding: '20px 20px 50px', borderBottom: '2px solid #2E3A59' }}>
<div style={{ float: 'left', verticalAlign: 'middle', fontSize: '18px', color: '#101010', fontWeight: 600, fontFamily: 'M-Gothic' }}>
HWJ 調1/2

View File

@ -33,6 +33,11 @@ export default function Login() {
pwd: '',
})
const isValidEmail = (email: string) => {
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
return emailRegex.test(email)
}
interface LoginData {
code: number
message: string | null
@ -82,6 +87,14 @@ export default function Login() {
}
}, [loginData])
useEffect(() => {
if (isValidEmail(account.loginId)) {
setIsPartners(true)
} else {
setIsPartners(false)
}
}, [account.loginId])
return (
<>
<div className="login-form-wrap">
@ -94,7 +107,7 @@ export default function Login() {
value={account.loginId}
onChange={(e) => setAccount({ loginId: e.target.value })}
/>
<button className="login-icon">
<button className="login-icon" onClick={() => setAccount({ loginId: '' })}>
<i className="del-icon"></i>
</button>
</div>

View File

@ -6,5 +6,4 @@ export const tracking = async (params: { url: string; data: string }) => {
url,
data,
})
console.log('🚀 ~ result ~ result:', result)
}

View File

@ -10,9 +10,9 @@ export async function middleware(request: NextRequest) {
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
// todo: 로그인 기능 추가 시 주석 해제
// if (!session.isLoggedIn) {
// return NextResponse.redirect(new URL('/login', request.url))
// }
if (!session.isLoggedIn) {
return NextResponse.redirect(new URL('/login', request.url))
}
return NextResponse.next()
}