Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3124: first drafts of schema models #3127

Merged
89 changes: 89 additions & 0 deletions src/backend/src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ model User {
deletedTeamTypes Team_Type[] @relation(name: "teamTypeDeleter")
unreadAnnouncements Announcement[] @relation(name: "receivedAnnouncements")
unreadPopUps PopUp[] @relation(name: "userPopUps")
createdParts Part[] @relation(name: "partCreator")
deletedParts Part[] @relation(name: "partDeleter")
createdPartSubmissions Submission[] @relation(name: "partsSubmissionCreator")
deletedPartSubmissions Submission[] @relation(name: "partsSubmissionDeleter")
createdPartReviews Review[] @relation(name: "partsReviewCreator")
deletedPartReviews Review[] @relation(name: "partsReviewDeleter")
partsToReview Part[] @relation(name: "PartReviewers")
assignedParts Part[] @relation(name: "PartAssignees")
}

model Role {
Expand Down Expand Up @@ -444,6 +452,8 @@ model Project {
favoritedBy User[] @relation(name: "favoritedBy")
featuredByOrganizationId String?
featuredByOrganization Organization? @relation(fields: [featuredByOrganizationId], references: [organizationId])
abbreviation String
parts Part[]
}

model Work_Package {
Expand Down Expand Up @@ -959,6 +969,7 @@ model Organization {
featuredProjects Project[]
popUps PopUp[]
announcements Announcement[]
parts Part[]
walker-sean marked this conversation as resolved.
Show resolved Hide resolved
}

model FrequentlyAskedQuestion {
Expand Down Expand Up @@ -1052,3 +1063,81 @@ model PopUp {
organizationId String
organization Organization @relation(fields: [organizationId], references: [organizationId])
}

model Part {
id String @id @default(uuid())
organizationId String
organization Organization @relation(fields: [organizationId], references: [organizationId])
index Int
commonName String
description String
status String
tags PartTag[]
submissions Submission[]
reviews Review[]
project Project @relation(fields: [projectId], references: [projectId])
projectId String
assignees User[] @relation("PartAssignees")
reviewers User[] @relation("PartReviewers")
history String[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userCreatedId String
userCreated User @relation(name: "partCreator", fields: [userCreatedId], references: [userId])
userDeletedId String
userDeleted User @relation(name: "partDeleter", fields: [userDeletedId], references: [userId])
}

model PartTag {
id String @id @default(uuid())
name String
color String

parts Part[]
}

model Submission {
chpy04 marked this conversation as resolved.
Show resolved Hide resolved
id String @id @default(uuid())
files String[] // how do we represent files in the database?
chpy04 marked this conversation as resolved.
Show resolved Hide resolved
name String
notes String?
part Part @relation(fields: [partId], references: [id])
partId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userCreatedId String
userCreated User @relation(name: "partsSubmissionCreator", fields: [userCreatedId], references: [userId])
userDeletedId String
userDeleted User @relation(name: "partsSubmissionDeleter", fields: [userDeletedId], references: [userId])
Review Review[]
chpy04 marked this conversation as resolved.
Show resolved Hide resolved
}

model Review {
chpy04 marked this conversation as resolved.
Show resolved Hide resolved
id String @id @default(uuid())
chpy04 marked this conversation as resolved.
Show resolved Hide resolved
files String[]
chpy04 marked this conversation as resolved.
Show resolved Hide resolved
notes String?
submission Submission @relation(fields: [submissionId], references: [id])
submissionId String
part Part @relation(fields: [partId], references: [id])
partId String
popUps Part_Review_Popup[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userCreatedId String
userCreated User @relation(name: "partsReviewCreator", fields: [userCreatedId], references: [userId])
deletedAt DateTime?
userDeletedId String
userDeleted User @relation(name: "partsReviewDeleter", fields: [userDeletedId], references: [userId])
}

model Part_Review_Popup {
chpy04 marked this conversation as resolved.
Show resolved Hide resolved
id String @id @default(uuid())
xCoord Float
yCoord Float
title String
description String
reviewId String
review Review @relation(fields: [reviewId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
Loading