* chore: removed firebase module as a dependency from team-collection module * chore: modified team-collection resolver file to use input-args types * chore: modified getTeamOfCollection service method and resolver * chore: modified getParentOfCollection service method in team-collection module * chore: modified getChildrenOfCollection service method in team-collection module * chore: added new fields to TeamCollection model in prisma schema file * chore: modified getCollection service method and resolver in team-collection module * chore: modified createCollection service method and resolver in team-collection module * chore: created cast helper function to resolve issue with creation mutation in team-collection * chore: modified teamCollectionRemoved subscription return types * chore: removed return types from subscriptions in team-collection module * chore: removed all instances of getTeamCollections service method in team-collection module * feat: added mutation to handle moving collections and supporting subscriptions * feat: added mutation to re-ordering team-collection order * chore: added teacher comments to both collection modules * test: added test cases for getTeamOfCollection service method * test: added test cases for getParentOfCollection service method * test: added test cases for getChildrenOfCollection service method * test: added test cases for getTeamRootCollections service method * test: added test cases for getCollection service method * test: added test cases for createCollection service method * chore: renamed renameCollection to renameUserCollection in UserCollection module * test: added test cases for renameCollection service method * test: added test cases for deleteCollection service method * test: added test cases for moveCollection service method * test: added test cases for updateCollectionOrder service method * chore: added import and export to JSON mutations to team-collection module * chore: created replaceCollectionsWithJSON mutation in team-collection module * chore: moved the mutation and service method of importCollectionFromFirestore to the end of file * chore: added helper comments to all import,export functions * chore: exportCollectionsToJSON service method orders collections and requests in ascending order * chore: added test cases for importCollectionsFromJSON service method * chore: added ToDo to write test cases for exportCollectionsToJSON * chore: removed prisma migration folder * chore: completed all changes requested in inital PR review * chore: completed all changes requested in second PR review * chore: completed all changes requested in third PR review
197 lines
6.0 KiB
Plaintext
197 lines
6.0 KiB
Plaintext
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
binaryTargets = ["native", "debian-openssl-1.1.x"]
|
|
}
|
|
|
|
model Team {
|
|
id String @id @default(cuid())
|
|
name String
|
|
members TeamMember[]
|
|
TeamInvitation TeamInvitation[]
|
|
TeamCollection TeamCollection[]
|
|
TeamRequest TeamRequest[]
|
|
TeamEnvironment TeamEnvironment[]
|
|
}
|
|
|
|
model TeamMember {
|
|
id String @id @default(uuid()) // Membership ID
|
|
role TeamMemberRole
|
|
userUid String
|
|
teamID String
|
|
team Team @relation(fields: [teamID], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([teamID, userUid])
|
|
}
|
|
|
|
model TeamInvitation {
|
|
id String @id @default(cuid())
|
|
teamID String
|
|
team Team @relation(fields: [teamID], references: [id], onDelete: Cascade)
|
|
creatorUid String
|
|
inviteeEmail String
|
|
inviteeRole TeamMemberRole
|
|
|
|
@@unique([teamID, inviteeEmail])
|
|
@@index([teamID])
|
|
}
|
|
|
|
model TeamCollection {
|
|
id String @id @default(cuid())
|
|
parentID String?
|
|
parent TeamCollection? @relation("TeamCollectionChildParent", fields: [parentID], references: [id])
|
|
children TeamCollection[] @relation("TeamCollectionChildParent")
|
|
requests TeamRequest[]
|
|
teamID String
|
|
team Team @relation(fields: [teamID], references: [id], onDelete: Cascade)
|
|
title String
|
|
orderIndex Int
|
|
createdOn DateTime @default(now()) @db.Timestamp(3)
|
|
updatedOn DateTime @updatedAt @db.Timestamp(3)
|
|
}
|
|
|
|
model TeamRequest {
|
|
id String @id @default(cuid())
|
|
collectionID String
|
|
collection TeamCollection @relation(fields: [collectionID], references: [id], onDelete: Cascade)
|
|
teamID String
|
|
team Team @relation(fields: [teamID], references: [id], onDelete: Cascade)
|
|
title String
|
|
request Json
|
|
orderIndex Int
|
|
createdOn DateTime @default(now()) @db.Timestamp(3)
|
|
updatedOn DateTime @updatedAt @db.Timestamp(3)
|
|
}
|
|
|
|
model Shortcode {
|
|
id String @id
|
|
request Json
|
|
creatorUid String?
|
|
createdOn DateTime @default(now())
|
|
|
|
@@unique(fields: [id, creatorUid], name: "creator_uid_shortcode_unique")
|
|
}
|
|
|
|
model TeamEnvironment {
|
|
id String @id @default(cuid())
|
|
teamID String
|
|
team Team @relation(fields: [teamID], references: [id], onDelete: Cascade)
|
|
name String
|
|
variables Json
|
|
}
|
|
|
|
model User {
|
|
uid String @id @default(cuid())
|
|
displayName String?
|
|
email String? @unique
|
|
photoURL String?
|
|
isAdmin Boolean @default(false)
|
|
refreshToken String?
|
|
providerAccounts Account[]
|
|
VerificationToken VerificationToken[]
|
|
settings UserSettings?
|
|
UserHistory UserHistory[]
|
|
UserEnvironments UserEnvironment[]
|
|
userCollections UserCollection[]
|
|
userRequests UserRequest[]
|
|
currentRESTSession Json?
|
|
currentGQLSession Json?
|
|
createdOn DateTime @default(now()) @db.Timestamp(3)
|
|
}
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
user User @relation(fields: [userId], references: [uid], onDelete: Cascade)
|
|
provider String
|
|
providerAccountId String
|
|
providerRefreshToken String?
|
|
providerAccessToken String?
|
|
providerScope String?
|
|
loggedIn DateTime @default(now()) @db.Timestamp(3)
|
|
|
|
@@unique(fields: [provider, providerAccountId], name: "verifyProviderAccount")
|
|
}
|
|
|
|
model VerificationToken {
|
|
deviceIdentifier String
|
|
token String @unique @default(cuid())
|
|
userUid String
|
|
user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
|
|
expiresOn DateTime @db.Timestamp(3)
|
|
|
|
@@unique(fields: [deviceIdentifier, token], name: "passwordless_deviceIdentifier_tokens")
|
|
}
|
|
|
|
model UserSettings {
|
|
id String @id @default(cuid())
|
|
userUid String @unique
|
|
user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
|
|
properties Json
|
|
updatedOn DateTime @updatedAt @db.Timestamp(3)
|
|
}
|
|
|
|
model UserHistory {
|
|
id String @id @default(cuid())
|
|
userUid String
|
|
user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
|
|
reqType ReqType
|
|
request Json
|
|
responseMetadata Json
|
|
isStarred Boolean
|
|
executedOn DateTime @default(now()) @db.Timestamp(3)
|
|
}
|
|
|
|
enum ReqType {
|
|
REST
|
|
GQL
|
|
}
|
|
|
|
model UserEnvironment {
|
|
id String @id @default(cuid())
|
|
userUid String
|
|
user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
|
|
name String?
|
|
variables Json
|
|
isGlobal Boolean
|
|
}
|
|
|
|
model UserRequest {
|
|
id String @id @default(cuid())
|
|
userCollection UserCollection @relation(fields: [collectionID], references: [id])
|
|
collectionID String
|
|
userUid String
|
|
user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
|
|
title String
|
|
request Json
|
|
type ReqType
|
|
orderIndex Int
|
|
createdOn DateTime @default(now()) @db.Timestamp(3)
|
|
updatedOn DateTime @updatedAt @db.Timestamp(3)
|
|
}
|
|
|
|
model UserCollection {
|
|
id String @id @default(cuid())
|
|
parentID String?
|
|
parent UserCollection? @relation("ParentUserCollection", fields: [parentID], references: [id], onDelete: Cascade)
|
|
children UserCollection[] @relation("ParentUserCollection")
|
|
requests UserRequest[]
|
|
userUid String
|
|
user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
|
|
title String
|
|
orderIndex Int
|
|
type ReqType
|
|
createdOn DateTime @default(now()) @db.Timestamp(3)
|
|
updatedOn DateTime @updatedAt @db.Timestamp(3)
|
|
}
|
|
|
|
enum TeamMemberRole {
|
|
OWNER
|
|
VIEWER
|
|
EDITOR
|
|
}
|