Compare commits
No commits in common. "b9cc66090eabf34e10e4fb70fcc40a2b25058473" and "36ea0dbf19fcd126428ed71bf2b4e171c4bb3d6e" have entirely different histories.
b9cc66090e
...
36ea0dbf19
16
src/app/api/suitable/details/route.ts
Normal file
16
src/app/api/suitable/details/route.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { NextResponse } from 'next/server'
|
||||||
|
|
||||||
|
export async function GET(request: Request) {
|
||||||
|
const { searchParams } = new URL(request.url)
|
||||||
|
const roofMaterial = searchParams.get('roof-material')
|
||||||
|
console.log('🚀 ~ GET ~ roof-material:', roofMaterial)
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
const suitables = await prisma.MS_SUITABLE.findMany({
|
||||||
|
where: {
|
||||||
|
roof_material: roofMaterial,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
return NextResponse.json(suitables)
|
||||||
|
}
|
||||||
8
src/app/api/suitable/list/route.ts
Normal file
8
src/app/api/suitable/list/route.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { NextResponse } from 'next/server'
|
||||||
|
import { prisma } from '@/libs/prisma'
|
||||||
|
|
||||||
|
export async function GET() {
|
||||||
|
// @ts-ignore
|
||||||
|
const suitables = await prisma.MS_SUITABLE.findMany()
|
||||||
|
return NextResponse.json(suitables)
|
||||||
|
}
|
||||||
35
src/app/api/survey-sales/route.ts
Normal file
35
src/app/api/survey-sales/route.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { NextResponse } from 'next/server'
|
||||||
|
import { prisma } from '@/libs/prisma'
|
||||||
|
|
||||||
|
export async function POST(request: Request) {
|
||||||
|
const body = await request.json()
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
const res = await prisma.SD_SERVEY_SALES_BASIC_INFO.create({
|
||||||
|
data: body,
|
||||||
|
})
|
||||||
|
|
||||||
|
return NextResponse.json({ message: 'Survey sales created successfully' })
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function GET(request: Request) {
|
||||||
|
// @ts-ignore
|
||||||
|
const res = await prisma.SD_SERVEY_SALES_BASIC_INFO.findMany({
|
||||||
|
include: {
|
||||||
|
detail_info: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return NextResponse.json(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function PUT(request: Request) {
|
||||||
|
const body = await request.json()
|
||||||
|
console.log('🚀 ~ PUT ~ body:', body)
|
||||||
|
const detailInfo = { ...body.detail_info, basic_info_id: body.id }
|
||||||
|
console.log('🚀 ~ PUT ~ detailInfo:', detailInfo)
|
||||||
|
// @ts-ignore
|
||||||
|
const res = await prisma.SD_SERVEY_SALES_DETAIL_INFO.create({
|
||||||
|
data: detailInfo,
|
||||||
|
})
|
||||||
|
return NextResponse.json({ message: 'Survey sales updated successfully' })
|
||||||
|
}
|
||||||
10
src/app/survey-sales/page.tsx
Normal file
10
src/app/survey-sales/page.tsx
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import SurveySales from '@/components/SurveySales'
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h1 className="text-2xl font-bold my-4 flex justify-center">조사 매물 정보</h1>
|
||||||
|
<SurveySales />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user