From 66a68c2bfa2fb64543da1cc8fb799eca3e2e100d Mon Sep 17 00:00:00 2001 From: koreacomp5 Date: Thu, 9 Oct 2025 17:43:24 +0900 Subject: [PATCH] =?UTF-8?q?8.7=20=EC=A0=9C=ED=9C=B4=EB=AC=B8=EC=9D=98:=20?= =?UTF-8?q?=EC=A0=91=EC=88=98=20=ED=8F=BC/=EA=B4=80=EB=A6=AC=EC=9E=90=20?= =?UTF-8?q?=EC=8A=B9=EC=9D=B8=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C?= =?UTF-8?q?=EC=9A=B0/=EC=95=8C=EB=A6=BC=20o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration.sql | 14 +++++++++++ prisma/schema.prisma | 15 ++++++++++++ public/erd.svg | 2 +- .../partner-inquiries/[id]/approve/route.ts | 10 ++++++++ src/app/api/partner-inquiries/route.ts | 20 ++++++++++++++++ src/app/partners/inquiry/page.tsx | 24 +++++++++++++++++++ todolist.txt | 2 +- 7 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 prisma/migrations/20251009084017_add_partner_inquiry/migration.sql create mode 100644 src/app/api/partner-inquiries/[id]/approve/route.ts create mode 100644 src/app/api/partner-inquiries/route.ts create mode 100644 src/app/partners/inquiry/page.tsx diff --git a/prisma/migrations/20251009084017_add_partner_inquiry/migration.sql b/prisma/migrations/20251009084017_add_partner_inquiry/migration.sql new file mode 100644 index 0000000..aef79fb --- /dev/null +++ b/prisma/migrations/20251009084017_add_partner_inquiry/migration.sql @@ -0,0 +1,14 @@ +-- CreateTable +CREATE TABLE "partner_inquiries" ( + "id" TEXT NOT NULL PRIMARY KEY, + "name" TEXT NOT NULL, + "contact" TEXT NOT NULL, + "category" TEXT, + "message" TEXT NOT NULL, + "status" TEXT NOT NULL DEFAULT 'pending', + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "approvedAt" DATETIME +); + +-- CreateIndex +CREATE INDEX "partner_inquiries_status_createdAt_idx" ON "partner_inquiries"("status", "createdAt"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 498a2d8..94b556d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -631,3 +631,18 @@ model Partner { @@index([category]) @@map("partners") } + +// 제휴 문의 +model PartnerInquiry { + id String @id @default(cuid()) + name String + contact String + category String? + message String + status String @default("pending") // pending/approved/rejected + createdAt DateTime @default(now()) + approvedAt DateTime? + + @@index([status, createdAt]) + @@map("partner_inquiries") +} diff --git a/public/erd.svg b/public/erd.svg index 7998e35..a96c91a 100644 --- a/public/erd.svg +++ b/public/erd.svg @@ -1 +1 @@ -

enum:status

enum:type

enum:readLevel

enum:writeLevel

enum:role

board

user

enum:status

board

author

enum:status

enum:authLevel

enum:resource

enum:action

role

user

role

post

author

post

tag

enum:type

post

enum:type

post

user

post

user

post

enum:targetType

reporter

post

comment

sender

receiver

blocker

blocked

enum:referenceType

user

enum:appliesTo

enum:type

user

enum:targetType

actor

enum:targetType

createdByUser

user

createdByUser

user

user

coupon

user

BoardStatus

active

active

hidden

hidden

archived

archived

BoardType

general

general

special

special

AccessLevel

public

public

member

member

moderator

moderator

admin

admin

PostStatus

published

published

hidden

hidden

deleted

deleted

AttachmentType

image

image

file

file

BoardModRole

MODERATOR

MODERATOR

MANAGER

MANAGER

UserStatus

active

active

suspended

suspended

withdrawn

withdrawn

AuthLevel

USER

USER

MOD

MOD

ADMIN

ADMIN

ReactionType

RECOMMEND

RECOMMEND

REPORT

REPORT

SanctionType

SUSPEND

SUSPEND

BAN

BAN

DOWNGRADE

DOWNGRADE

TargetType

POST

POST

COMMENT

COMMENT

USER

USER

BOARD

BOARD

SYSTEM

SYSTEM

Resource

BOARD

BOARD

POST

POST

COMMENT

COMMENT

USER

USER

ADMIN

ADMIN

Action

READ

READ

CREATE

CREATE

UPDATE

UPDATE

DELETE

DELETE

MODERATE

MODERATE

ADMINISTER

ADMINISTER

boards

String

id

🗝️

String

name

String

slug

String

description

Int

sortOrder

BoardStatus

status

BoardType

type

Boolean

requiresApproval

Boolean

allowAnonymousPost

Boolean

allowSecretComment

Boolean

isAdultOnly

Json

requiredTags

Json

requiredFields

AccessLevel

readLevel

AccessLevel

writeLevel

DateTime

createdAt

DateTime

updatedAt

board_moderators

String

id

🗝️

BoardModRole

role

DateTime

createdAt

posts

String

id

🗝️

String

title

String

content

PostStatus

status

Boolean

isAnonymous

Boolean

isPinned

Int

pinnedOrder

DateTime

createdAt

DateTime

updatedAt

DateTime

lastActivityAt

users

String

userId

🗝️

String

nickname

String

passwordHash

String

name

DateTime

birth

String

phone

Int

rank

UserStatus

status

AuthLevel

authLevel

String

profileImage

DateTime

lastLoginAt

Boolean

isAdultVerified

Int

loginFailCount

DateTime

agreementTermsAt

DateTime

createdAt

DateTime

updatedAt

roles

String

roleId

🗝️

String

name

String

description

DateTime

createdAt

role_permissions

String

id

🗝️

Resource

resource

Action

action

Boolean

allowed

DateTime

createdAt

user_roles

String

id

🗝️

DateTime

createdAt

comments

String

id

🗝️

String

content

Boolean

isAnonymous

Boolean

isSecret

String

secretPasswordHash

DateTime

createdAt

DateTime

updatedAt

tags

String

tagId

🗝️

String

name

String

slug

DateTime

createdAt

post_tags

String

id

🗝️

attachments

String

id

🗝️

String

url

AttachmentType

type

Int

size

Int

width

Int

height

Int

sortOrder

DateTime

createdAt

reactions

String

id

🗝️

String

clientHash

ReactionType

type

DateTime

createdAt

post_view_logs

String

id

🗝️

String

ip

String

userAgent

DateTime

createdAt

post_stats

Int

views

Int

recommendCount

Int

reportCount

Int

commentsCount

reports

String

id

🗝️

TargetType

targetType

String

reason

String

status

DateTime

createdAt

messages

String

id

🗝️

String

body

DateTime

readAt

DateTime

createdAt

blocks

String

id

🗝️

DateTime

createdAt

point_transactions

String

id

🗝️

Int

amount

String

reason

TargetType

referenceType

String

referenceId

DateTime

createdAt

level_thresholds

String

id

🗝️

Int

level

Int

minPoints

banned_keywords

String

id

🗝️

String

pattern

TargetType

appliesTo

Int

severity

Boolean

active

DateTime

createdAt

sanctions

String

id

🗝️

SanctionType

type

String

reason

DateTime

startAt

DateTime

endAt

String

createdBy

audit_logs

String

id

🗝️

String

action

TargetType

targetType

String

targetId

Json

meta

DateTime

createdAt

admin_notifications

String

id

🗝️

String

type

String

message

TargetType

targetType

String

targetId

DateTime

createdAt

DateTime

readAt

login_sessions

String

id

🗝️

String

device

String

ip

String

userAgent

DateTime

createdAt

DateTime

lastSeenAt

ip_blocks

String

id

🗝️

String

ip

String

reason

Boolean

active

DateTime

createdAt

nickname_changes

String

id

🗝️

String

oldNickname

String

newNickname

DateTime

changedAt

password_reset_tokens

String

id

🗝️

String

token

DateTime

expiresAt

DateTime

usedAt

DateTime

createdAt

coupons

String

id

🗝️

String

code

String

title

String

description

Int

stock

Int

maxPerUser

DateTime

expiresAt

Boolean

active

DateTime

createdAt

coupon_redemptions

String

id

🗝️

DateTime

createdAt

partners

String

id

🗝️

String

name

String

category

Float

latitude

Float

longitude

String

address

DateTime

createdAt

DateTime

updatedAt

\ No newline at end of file +

enum:status

enum:type

enum:readLevel

enum:writeLevel

enum:role

board

user

enum:status

board

author

enum:status

enum:authLevel

enum:resource

enum:action

role

user

role

post

author

post

tag

enum:type

post

enum:type

post

user

post

user

post

enum:targetType

reporter

post

comment

sender

receiver

blocker

blocked

enum:referenceType

user

enum:appliesTo

enum:type

user

enum:targetType

actor

enum:targetType

createdByUser

user

createdByUser

user

user

coupon

user

BoardStatus

active

active

hidden

hidden

archived

archived

BoardType

general

general

special

special

AccessLevel

public

public

member

member

moderator

moderator

admin

admin

PostStatus

published

published

hidden

hidden

deleted

deleted

AttachmentType

image

image

file

file

BoardModRole

MODERATOR

MODERATOR

MANAGER

MANAGER

UserStatus

active

active

suspended

suspended

withdrawn

withdrawn

AuthLevel

USER

USER

MOD

MOD

ADMIN

ADMIN

ReactionType

RECOMMEND

RECOMMEND

REPORT

REPORT

SanctionType

SUSPEND

SUSPEND

BAN

BAN

DOWNGRADE

DOWNGRADE

TargetType

POST

POST

COMMENT

COMMENT

USER

USER

BOARD

BOARD

SYSTEM

SYSTEM

Resource

BOARD

BOARD

POST

POST

COMMENT

COMMENT

USER

USER

ADMIN

ADMIN

Action

READ

READ

CREATE

CREATE

UPDATE

UPDATE

DELETE

DELETE

MODERATE

MODERATE

ADMINISTER

ADMINISTER

boards

String

id

🗝️

String

name

String

slug

String

description

Int

sortOrder

BoardStatus

status

BoardType

type

Boolean

requiresApproval

Boolean

allowAnonymousPost

Boolean

allowSecretComment

Boolean

isAdultOnly

Json

requiredTags

Json

requiredFields

AccessLevel

readLevel

AccessLevel

writeLevel

DateTime

createdAt

DateTime

updatedAt

board_moderators

String

id

🗝️

BoardModRole

role

DateTime

createdAt

posts

String

id

🗝️

String

title

String

content

PostStatus

status

Boolean

isAnonymous

Boolean

isPinned

Int

pinnedOrder

DateTime

createdAt

DateTime

updatedAt

DateTime

lastActivityAt

users

String

userId

🗝️

String

nickname

String

passwordHash

String

name

DateTime

birth

String

phone

Int

rank

UserStatus

status

AuthLevel

authLevel

String

profileImage

DateTime

lastLoginAt

Boolean

isAdultVerified

Int

loginFailCount

DateTime

agreementTermsAt

DateTime

createdAt

DateTime

updatedAt

roles

String

roleId

🗝️

String

name

String

description

DateTime

createdAt

role_permissions

String

id

🗝️

Resource

resource

Action

action

Boolean

allowed

DateTime

createdAt

user_roles

String

id

🗝️

DateTime

createdAt

comments

String

id

🗝️

String

content

Boolean

isAnonymous

Boolean

isSecret

String

secretPasswordHash

DateTime

createdAt

DateTime

updatedAt

tags

String

tagId

🗝️

String

name

String

slug

DateTime

createdAt

post_tags

String

id

🗝️

attachments

String

id

🗝️

String

url

AttachmentType

type

Int

size

Int

width

Int

height

Int

sortOrder

DateTime

createdAt

reactions

String

id

🗝️

String

clientHash

ReactionType

type

DateTime

createdAt

post_view_logs

String

id

🗝️

String

ip

String

userAgent

DateTime

createdAt

post_stats

Int

views

Int

recommendCount

Int

reportCount

Int

commentsCount

reports

String

id

🗝️

TargetType

targetType

String

reason

String

status

DateTime

createdAt

messages

String

id

🗝️

String

body

DateTime

readAt

DateTime

createdAt

blocks

String

id

🗝️

DateTime

createdAt

point_transactions

String

id

🗝️

Int

amount

String

reason

TargetType

referenceType

String

referenceId

DateTime

createdAt

level_thresholds

String

id

🗝️

Int

level

Int

minPoints

banned_keywords

String

id

🗝️

String

pattern

TargetType

appliesTo

Int

severity

Boolean

active

DateTime

createdAt

sanctions

String

id

🗝️

SanctionType

type

String

reason

DateTime

startAt

DateTime

endAt

String

createdBy

audit_logs

String

id

🗝️

String

action

TargetType

targetType

String

targetId

Json

meta

DateTime

createdAt

admin_notifications

String

id

🗝️

String

type

String

message

TargetType

targetType

String

targetId

DateTime

createdAt

DateTime

readAt

login_sessions

String

id

🗝️

String

device

String

ip

String

userAgent

DateTime

createdAt

DateTime

lastSeenAt

ip_blocks

String

id

🗝️

String

ip

String

reason

Boolean

active

DateTime

createdAt

nickname_changes

String

id

🗝️

String

oldNickname

String

newNickname

DateTime

changedAt

password_reset_tokens

String

id

🗝️

String

token

DateTime

expiresAt

DateTime

usedAt

DateTime

createdAt

coupons

String

id

🗝️

String

code

String

title

String

description

Int

stock

Int

maxPerUser

DateTime

expiresAt

Boolean

active

DateTime

createdAt

coupon_redemptions

String

id

🗝️

DateTime

createdAt

partners

String

id

🗝️

String

name

String

category

Float

latitude

Float

longitude

String

address

DateTime

createdAt

DateTime

updatedAt

partner_inquiries

String

id

🗝️

String

name

String

contact

String

category

String

message

String

status

DateTime

createdAt

DateTime

approvedAt

\ No newline at end of file diff --git a/src/app/api/partner-inquiries/[id]/approve/route.ts b/src/app/api/partner-inquiries/[id]/approve/route.ts new file mode 100644 index 0000000..862e062 --- /dev/null +++ b/src/app/api/partner-inquiries/[id]/approve/route.ts @@ -0,0 +1,10 @@ +import { NextResponse } from "next/server"; +import prisma from "@/lib/prisma"; + +export async function POST(_: Request, context: { params: Promise<{ id: string }> }) { + const { id } = await context.params; + const updated = await prisma.partnerInquiry.update({ where: { id }, data: { status: "approved", approvedAt: new Date() } }); + return NextResponse.json({ inquiry: updated }); +} + + diff --git a/src/app/api/partner-inquiries/route.ts b/src/app/api/partner-inquiries/route.ts new file mode 100644 index 0000000..7b1b85b --- /dev/null +++ b/src/app/api/partner-inquiries/route.ts @@ -0,0 +1,20 @@ +import { NextResponse } from "next/server"; +import prisma from "@/lib/prisma"; +import { z } from "zod"; + +const schema = z.object({ name: z.string().min(1), contact: z.string().min(1), category: z.string().optional(), message: z.string().min(1) }); + +export async function POST(req: Request) { + const body = await req.json().catch(() => ({})); + const parsed = schema.safeParse(body); + if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 }); + const created = await prisma.partnerInquiry.create({ data: parsed.data }); + return NextResponse.json({ inquiry: created }, { status: 201 }); +} + +export async function GET() { + const items = await prisma.partnerInquiry.findMany({ orderBy: { createdAt: "desc" } }); + return NextResponse.json({ inquiries: items }); +} + + diff --git a/src/app/partners/inquiry/page.tsx b/src/app/partners/inquiry/page.tsx new file mode 100644 index 0000000..6d11dc7 --- /dev/null +++ b/src/app/partners/inquiry/page.tsx @@ -0,0 +1,24 @@ +"use client"; +import { useState } from "react"; + +export default function PartnerInquiryPage() { + const [form, setForm] = useState({ name: "", contact: "", category: "", message: "" }); + const [done, setDone] = useState(false); + async function submit() { + const r = await fetch("/api/partner-inquiries", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(form) }); + setDone(r.ok); + } + if (done) return
접수되었습니다. 검토 후 연락드리겠습니다.
; + return ( +
+

제휴 문의

+ setForm({ ...form, name: e.target.value })} /> + setForm({ ...form, contact: e.target.value })} /> + setForm({ ...form, category: e.target.value })} /> +