<aside> 💡

유저 모델 추가를 위한 기존 모델을 수정한 스키마 정의

</aside>

사용자 (User)

속성 타입 제약 조건 관계
id Int @id @default(autoincrement())
profileImage String
nickname String @unique
password String
email String @unique
createdAt DateTime default(now())
updatedAt DateTime updatedAt
Style style[] 1 (user) : N (style)
Curation curation[] 1 (user) : N (curation)
Comment comment[] 1 (user) : N (comment)
verificationToken String? @unique
verificationTokenExpires DateTime?
image Image @relation(fields: [imageid], references: [id], onDelete: Cascade) 1 (user) : 1 (image)
imageId Int
likes StyleLike[]

스타일 (Style)

속성 타입 제약 조건 관계
id int @id @default(autoincrement())
thumbnail String
title String
content String?
categories Json?
viewCount Int @default(0)
curationCount Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Curation Curation[] 1 (style) : N (curating)
Image Image[] 1 (style) : N (image)
user User @relation(fields: [userId], references: [id], onDelete: Cascade) 1 (user) : N (style)
userId Int
tags Tag[] N (style) : N (tag)
likes StyleLike[]

큐레이팅 (Curating)

1명의 user가 한 스타일에 한 큐레이팅만 달 수 있도록 서비스에서 제약 걸기

속성 타입 제약 조건 관계
id Int @id @default(autoincrement())
content String
trendy Int
personality Int
practicality Int
costEffectiveness Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
style Style @relation(fields: [styleId], references: [id], onDelete: Cascade) 1 (style) : N (curating)
styleId Int 1 (style) : N (curating)
comments Comment?
user User @relation(fields: [userId], references: [id], onDelete: Cascade) 1 (user) : N (curating)
userId Int
@@unique([styleId, userId])

답글 (Comment)

속성 타입 제약 조건 관계
id Int @id @default(autoincrement())
content String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
curation Curation @relation(fields: [curationId], references: [id], onDelete: Cascade)
curationId number Foreign Key 1 (comment) : 1 (curating)
user User @relation(fields: [userId], references: [id], onDelete: Cascade) 1 (user) : N (comment)
userId Int

사진 (Image)

속성 타입 제약 조건 관계
id Int @id @default(autoincrement())
url String
createdAt DateTime default(now())
updatedAt DateTime updatedAt
style Style @relation(fields: [styleId], references: [id], onDelete: Cascade) 1 (style) : N (Image)
styleId Int 1 (style) : N (Image)
user User?

사용자 (User)

속성 타입 제약 조건 관계
id Int @id @default(autoincrement())
url String
createdAt DateTime default(now())
updatedAt DateTime updatedAt
Style Style[] 1 (user) : N (style)
Curation Curation[] 1 (user) : N (curation)
Comment Comment[] 1 (user) : N (comment)
image Image? @relation(fields: [imageId], references: [id]) 1 (user) : 1 (Image)
imageId Int? @unique
styleId Int 1 (style) : N (Image)
user User?

태그 (Tag)

| --- | --- | --- | --- |

태그 (TagUsageLog)

| --- | --- | --- | --- |