1.์ค๋ ๋ ๊ธฐ๋ฅ
๊ทผ๋ ์ต๊ทผ ๋์จ ์ค๋ ๋์ ๋์์ธ์ ์ฐธ๊ณ ํ์ฌ ๋ชจ๋ฐฉ ๊ตฌํ ํด๋ณด์๋ค.
ํ๋ฉด
์กฐํ
์์ฑ
๋ฐ์ดํฐ ๋ฒ ์ด์ค ์คํค๋ง
model Thread {
id String @id @default(cuid())
content String
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
ThreadComment ThreadComment[]
}
model ThreadComment {
id String @id @default(cuid())
content String
User User @relation(fields: [userId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
Thread Thread @relation(fields: [threadId], references: [id], onDelete: Cascade)
threadId String
}
2.ํ์์์ ๊ธฐ๋ฅ
ํ๋ฉด
์ค์๊ฐ์ผ๋ก ๋ฐ์ดํฐ ๋ณ๊ฒฝ์ ๋ณผ ์ ์๋ค.
3.๊ด๋ฆฌ์ํ์ด์ง
ํ์์ ๊ด๋ฆฌํ ์ ์๋ํ์ด์ง๋ฅผ ๋ง๋ค์ด ๋ณด์๋ค.
ํ์ ๊ด๋ฆฌ ํ์ด์ง๋ก ์ํ๋ฅผ ํ์ธํ ์ ์๋ค.
A.์ ์ ๊ด๋ฆฌ - ํ๋ฉด
A.์ ์ ๊ด๋ฆฌ - ๋ฐ์ดํฐ ๋ฒ ์ด์ค ์คํค๋ง
model User {
id String @id @default(cuid())
email String? @unique @default("")
username String? @unique @default("")
group String? @default("")
tag String? @default("")
content String? @default("")
followers Int? @default(0)
emailVerified DateTime?
image String? @default("")
Account Account?
isActivated Boolean @default(false)
password String?
role UserRole @default(USER)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Article Article[]
Comment Comment[]
UserExp UserExp[]
points Int @default(0)
Thread Thread[]
ThreadComment ThreadComment[]
UserLog UserLog[]
}
B.๋ก๊ทธ ์กฐํ - ํ๋ฉด
B.๋ก๊ทธ ์กฐํ - ๋ฐ์ดํฐ ๋ฒ ์ด์ค ์คํค๋ง
model Log {
id String @id @default(cuid())
content String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
UserLog UserLog[]
LogCategory LogCategory[]
}
model LogCategory {
id String @id @default(cuid())
type String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Log Log? @relation(fields: [logId], references: [id])
logId String?
}
model UserLog {
id String @id @default(cuid())
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String
log Log @relation(fields: [logId], references: [id], onDelete: Cascade)
logId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
C.๊ฒฝํ์น ๊ด๋ฆฌ ํ์ด์ง - ํ๋ฉด
์ ์ ๋ถ์ฌํ์ฌ ๋ฑ๊ธ์ ๋ฉ๊ธฐ๋ ์ ๋ณด๋ฅผ ๋ณผ ์ ์๋ค.
C.๊ฒฝํ์น ๊ด๋ฆฌ ํ์ด์ง - ๋ฐ์ดํฐ ๋ฒ ์ด์ค ์คํค๋ง
model Exp {
id String @id @default(cuid())
title String?
content String?
minExp Int
maxExp Int
createdAt DateTime @default(now())
updatedAt DateTime? @updatedAt
UserExp UserExp[]
url String?
}
model UserExp {
id String @id @default(cuid())
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String
Exp Exp @relation(fields: [expId], references: [id], onDelete: Cascade)
expId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
4.ํ ์คํธ ์ฃผ์
์ค์ ์ด๋ฉ์ผ ์ฃผ์๋ก ์ธ์ฆํ์ฌ ๊ธฐ๋ฅ์ ์ฒดํํด๋ณผ ์ ์๋ค.
https://richable.cyber-luna.com
๋ฆฌ์น์์ด๋ธ - ๋ก๊ทธ์ธ
๋ ๋์ ์ฑ์ฅ์ ์ํ ์ปค๋ฎค๋ํฐ
richable.cyber-luna.com
https://github.com/TwoIceFIsh/richable-web-server
GitHub - TwoIceFIsh/richable-web-server: richable-web-server
richable-web-server. Contribute to TwoIceFIsh/richable-web-server development by creating an account on GitHub.
github.com