Heya! I have a question, I have to make a todo app...
# orm-help
m
Heya! I have a question, I have to make a todo app where users get the same tasks to do each day, what would be the best way to structure this in my prisma schema? Would love some opinions/ideas on this thanks!
n
Hey 👋 This should help you get started. model
User
contains users information. model
Todo
contains the todo information. model
UserTodo
is a connecting table which contains information about a specific user and a specific today for them on a specific date.
Copy code
model User {
  id        Int        @id @default(autoincrement())
  name      String
  email     String     @unique
  createdAt DateTime   @default(now())
  updatedAt DateTime   @updatedAt
  UserTodo  UserTodo[]
}

model Todo {
  id       Int        @id @default(autoincrement())
  title    String
  UserTodo UserTodo[]
}

model UserTodo {
  id        Int      @id @default(autoincrement())
  userId    Int      @unique
  todoId    Int      @unique
  completed Boolean  @default(false)
  user      User     @relation(fields: [userId], references: [id])
  todo      Todo     @relation(fields: [todoId], references: [id])
  date      DateTime
}