EunKangChoi-Dyphi / potential-403-nestjs

Trazzle - 비사이드 포텐셜 403 팀레포
2 stars 1 forks source link

[동성+은강] ERD 설계 #2

Open EunKangChoi-Dyphi opened 3 months ago

EunKangChoi-Dyphi commented 3 months ago

ERD 설계

EunKangChoi-Dyphi commented 3 months ago

이슈브랜치 feature/issue-2 생성완료했습니다!

loveAlakazam commented 3 months ago

@lullaaaby13 동성님 요 이슈는 일단 erd를 설계완료후에 prisma.schema 파일을 수정하기위한 용도로 해놓을게여! 피그마를 보니까 크게 엔티티가 나눠지고 다음과 같은 관계를 갖는다고 생각했습니다.(팔로우/팔로잉 관계 제외) 혹시 여기서 더 수정사항이 있을지 확인부탁드립니다 🙇🏻‍♀️

image

lullaaaby13 commented 3 months ago

넵 저도 딱 저렇게 생각했습니다 감사합니다!

EunKangChoi-Dyphi commented 3 months ago

@lullaaaby13 현재 master 브랜치에 적용되어있는 prisma.schema 파일중에서 Post 모델은 나중에 폐기할 예정입니다. 일단은 그대로 둔채로 작업하시면 될거같습니당

// sample
model Post {
  id        Int @id @default(autoincrement()) // PK
  title     String @db.VarChar(255) // 제목
  content   String? // 내용
  published Boolean @default(false) // 발행여부

  // authorId 는 User.id 를 참조함.
  author    User @relation(fields:[authorId], references: [id])  // 저자 
  authorId  Int // 참조키

  createdAt DateTime @default(now()) // 생성일
  updatedAt DateTime @updatedAt // 수정일

}

model User {
  id Int @id @default(autoincrement()) // PK
  email String @unique // 이메일
  name String?

  // User:Post = 1:N
  posts Post[] 

  // User:Profile = 1:1(0)
  profile Profile?
}

model Profile {
  id Int @id @default(autoincrement())

  // userId는 User.id를 참조함
  user User @relation(fields: [userId], references: [id])
  userId Int @unique
}
loveAlakazam commented 3 months ago

Mermaid ERD 초안

https://www.mermaidchart.com/raw/0ca8b834-9ce2-4e17-9596-60d07a164271?theme=light&version=v0.1&format=svg