feat: citizenship built
This commit is contained in:
+60
-20
@@ -32,6 +32,9 @@ model User {
|
||||
editedPages Page[] @relation("PageEditor")
|
||||
|
||||
citizenshipApplications CitizenshipApplication[]
|
||||
reviewedApplications CitizenshipApplication[] @relation("CitizenshipReviewer")
|
||||
|
||||
citizenships Citizenship[]
|
||||
}
|
||||
|
||||
enum PageStatus {
|
||||
@@ -100,34 +103,71 @@ enum CitizenshipApplicationStatus {
|
||||
|
||||
enum ApplicationType {
|
||||
PREVIOUS_CITIZENSHIP
|
||||
BORN_IN_TERRITORY
|
||||
NATURALIZATION
|
||||
}
|
||||
|
||||
model CitizenshipApplication {
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
surname String
|
||||
givenNames String
|
||||
sex Sex
|
||||
birthDate DateTime
|
||||
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
surname String
|
||||
givenNames String
|
||||
sex Sex
|
||||
birthDate DateTime
|
||||
applicationType ApplicationType
|
||||
|
||||
previousCountry String?
|
||||
previousRegion String?
|
||||
birthRegion String?
|
||||
naturalizationReason String?
|
||||
|
||||
address String
|
||||
height String
|
||||
eyeColor String
|
||||
|
||||
status CitizenshipApplicationStatus @default(PENDING)
|
||||
address String
|
||||
regionId String?
|
||||
city String?
|
||||
street String?
|
||||
customAddress String?
|
||||
height String
|
||||
eyeColor String
|
||||
status CitizenshipApplicationStatus @default(PENDING)
|
||||
rejectionReason String?
|
||||
reviewedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
reviewedAt DateTime?
|
||||
reviewedBy String?
|
||||
reviewer User? @relation("CitizenshipReviewer", fields: [reviewedBy], references: [id])
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
citizenship Citizenship?
|
||||
}
|
||||
|
||||
model Citizenship {
|
||||
id String @id @default(uuid())
|
||||
userId String @unique
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
applicationId String @unique
|
||||
application CitizenshipApplication @relation(fields: [applicationId], references: [id])
|
||||
issuedAt DateTime @default(now())
|
||||
revokedAt DateTime?
|
||||
document IdentityDocument?
|
||||
}
|
||||
|
||||
model IdentityDocument {
|
||||
id String @id @default(uuid())
|
||||
citizenshipId String @unique
|
||||
citizenship Citizenship @relation(fields: [citizenshipId], references: [id], onDelete: Cascade)
|
||||
|
||||
documentNumber String @unique
|
||||
|
||||
regionId String?
|
||||
region Region? @relation(fields: [regionId], references: [id])
|
||||
city String?
|
||||
street String?
|
||||
|
||||
customAddress String?
|
||||
|
||||
issuedAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
}
|
||||
|
||||
model Region {
|
||||
id String @id
|
||||
name String
|
||||
capital String
|
||||
documents IdentityDocument[]
|
||||
}
|
||||
Reference in New Issue
Block a user