temp
This commit is contained in:
+255
-65
@@ -27,23 +27,25 @@ enum EyeColor {
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
kotosoftId String @unique
|
||||
email String @unique
|
||||
id String @id @default(uuid())
|
||||
kotosoftId String @unique
|
||||
email String @unique
|
||||
firstName String
|
||||
secondName String
|
||||
sex Sex
|
||||
birthDate DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
isAdmin Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
isAdmin Boolean @default(false)
|
||||
|
||||
pages Page[] @relation("PageAuthor")
|
||||
editedPages Page[] @relation("PageEditor")
|
||||
pages Page[] @relation("PageAuthor")
|
||||
editedPages Page[] @relation("PageEditor")
|
||||
|
||||
citizenshipApplications CitizenshipApplication[]
|
||||
reviewedApplications CitizenshipApplication[] @relation("CitizenshipReviewer")
|
||||
reviewedApplications CitizenshipApplication[] @relation("CitizenshipReviewer")
|
||||
|
||||
citizenships Citizenship[]
|
||||
|
||||
acts Act[]
|
||||
}
|
||||
|
||||
enum PageStatus {
|
||||
@@ -68,20 +70,20 @@ model Page {
|
||||
updatedAt DateTime @updatedAt
|
||||
publishedAt DateTime?
|
||||
|
||||
createdBy String?
|
||||
author User? @relation("PageAuthor", fields: [createdBy], references: [id])
|
||||
createdBy String?
|
||||
author User? @relation("PageAuthor", fields: [createdBy], references: [id])
|
||||
|
||||
updatedBy String?
|
||||
editor User? @relation("PageEditor", fields: [updatedBy], references: [id])
|
||||
updatedBy String?
|
||||
editor User? @relation("PageEditor", fields: [updatedBy], references: [id])
|
||||
|
||||
blocks Block[]
|
||||
navLinks NavLink[]
|
||||
blocks Block[]
|
||||
navLinks NavLink[]
|
||||
}
|
||||
|
||||
model Block {
|
||||
id String @id @default(uuid())
|
||||
pageId String
|
||||
page Page @relation(fields: [pageId], references: [id], onDelete: Cascade)
|
||||
id String @id @default(uuid())
|
||||
pageId String
|
||||
page Page @relation(fields: [pageId], references: [id], onDelete: Cascade)
|
||||
|
||||
parentId String?
|
||||
parent Block? @relation("BlockChildren", fields: [parentId], references: [id])
|
||||
@@ -95,13 +97,13 @@ model Block {
|
||||
}
|
||||
|
||||
model NavLink {
|
||||
id String @id @default(uuid())
|
||||
label String?
|
||||
id String @id @default(uuid())
|
||||
label String?
|
||||
order Int
|
||||
|
||||
pageId String?
|
||||
page Page? @relation(fields: [pageId], references: [id], onDelete: SetNull)
|
||||
href String?
|
||||
pageId String?
|
||||
page Page? @relation(fields: [pageId], references: [id], onDelete: SetNull)
|
||||
href String?
|
||||
}
|
||||
|
||||
enum CitizenshipApplicationStatus {
|
||||
@@ -116,35 +118,35 @@ enum ApplicationType {
|
||||
}
|
||||
|
||||
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
|
||||
applicationType ApplicationType
|
||||
previousCountry String?
|
||||
previousRegion String?
|
||||
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?
|
||||
naturalizationReason String?
|
||||
address String
|
||||
regionId String?
|
||||
region Region? @relation(fields: [regionId], references: [id])
|
||||
city String?
|
||||
street String?
|
||||
customAddress String?
|
||||
height Int
|
||||
eyeColor EyeColor
|
||||
status CitizenshipApplicationStatus @default(PENDING)
|
||||
rejectionReason String?
|
||||
reviewedAt DateTime?
|
||||
reviewedBy String?
|
||||
reviewer User? @relation("CitizenshipReviewer", fields: [reviewedBy], references: [id])
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
profileKey String
|
||||
signatureKey String
|
||||
citizenship Citizenship?
|
||||
address String
|
||||
regionId String?
|
||||
region Region? @relation(fields: [regionId], references: [id])
|
||||
city String?
|
||||
street String?
|
||||
customAddress String?
|
||||
height Int
|
||||
eyeColor EyeColor
|
||||
status CitizenshipApplicationStatus @default(PENDING)
|
||||
rejectionReason String?
|
||||
reviewedAt DateTime?
|
||||
reviewedBy String?
|
||||
reviewer User? @relation("CitizenshipReviewer", fields: [reviewedBy], references: [id])
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
profileKey String
|
||||
signatureKey String
|
||||
citizenship Citizenship?
|
||||
}
|
||||
|
||||
model Citizenship {
|
||||
@@ -154,37 +156,225 @@ model Citizenship {
|
||||
issuedAt DateTime @default(now())
|
||||
revokedAt DateTime?
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
application CitizenshipApplication @relation(fields: [applicationId], references: [id])
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
application CitizenshipApplication @relation(fields: [applicationId], references: [id])
|
||||
identityDocuments IdentityDocument[]
|
||||
positions CitizenshipPosition[]
|
||||
approvals ActApproval[]
|
||||
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
model IdentityDocument {
|
||||
id String @id @default(uuid())
|
||||
citizenshipId String
|
||||
citizenship Citizenship @relation(fields: [citizenshipId], references: [id], onDelete: Cascade)
|
||||
id String @id @default(uuid())
|
||||
citizenshipId String
|
||||
citizenship Citizenship @relation(fields: [citizenshipId], references: [id], onDelete: Cascade)
|
||||
|
||||
documentNumber String @unique
|
||||
documentNumber String @unique
|
||||
address String
|
||||
|
||||
regionId String?
|
||||
region Region? @relation(fields: [regionId], references: [id])
|
||||
city String?
|
||||
street String?
|
||||
customAddress String?
|
||||
regionId String?
|
||||
region Region? @relation(fields: [regionId], references: [id])
|
||||
city String?
|
||||
street String?
|
||||
customAddress String?
|
||||
|
||||
issuedAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
issuedAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
|
||||
@@index([citizenshipId, issuedAt])
|
||||
}
|
||||
|
||||
model Region {
|
||||
id String @id
|
||||
id String @id
|
||||
name String
|
||||
capital String
|
||||
documents IdentityDocument[]
|
||||
applications CitizenshipApplication[]
|
||||
}
|
||||
acts Act[]
|
||||
}
|
||||
|
||||
enum InstitutionKind {
|
||||
LEGISLATIVE_CHAMBER
|
||||
HEAD_OF_STATE
|
||||
HEAD_OF_GOVERNMENT
|
||||
DEPARTMENT
|
||||
AGENCY
|
||||
REGION
|
||||
COURT
|
||||
}
|
||||
|
||||
model Institution {
|
||||
id String @id @default(uuid())
|
||||
kind InstitutionKind
|
||||
name String
|
||||
code String? @unique
|
||||
parentId String?
|
||||
parent Institution? @relation("InstitutionHierarchy", fields: [parentId], references: [id])
|
||||
children Institution[] @relation("InstitutionHierarchy")
|
||||
isActive Boolean @default(true)
|
||||
|
||||
appointedByInstitutionId String?
|
||||
appointedBy Institution? @relation("InstitutionAppointer", fields: [appointedByInstitutionId], references: [id])
|
||||
appointsInto Institution[] @relation("InstitutionAppointer")
|
||||
|
||||
acts Act[]
|
||||
|
||||
positions Position[]
|
||||
}
|
||||
|
||||
enum ActCapability {
|
||||
SIGN_FEDERAL_LAW_SENATE
|
||||
SIGN_FEDERAL_LAW_HOUSE
|
||||
SIGN_AS_HEAD_OF_STATE
|
||||
SIGN_AS_HEAD_OF_GOVERNMENT
|
||||
SIGN_AS_HEAD_OF_DEPARTMENT
|
||||
SIGN_AS_HEAD_OF_AGENCY
|
||||
SIGN_AS_JUDGE
|
||||
SIGN_SENATE_APPOINTMENT
|
||||
SIGN_TREATY
|
||||
SIGN_RATIFICATION
|
||||
SIGN_REGIONAL_ACT
|
||||
}
|
||||
|
||||
model Position {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
institutionId String
|
||||
institution Institution @relation(fields: [institutionId], references: [id], onDelete: Cascade)
|
||||
|
||||
capabilities PositionCapability[]
|
||||
holders CitizenshipPosition[]
|
||||
|
||||
@@unique([institutionId, name])
|
||||
}
|
||||
|
||||
model PositionCapability {
|
||||
id String @id @default(uuid())
|
||||
positionId String
|
||||
position Position @relation(fields: [positionId], references: [id], onDelete: Cascade)
|
||||
capability ActCapability
|
||||
|
||||
@@unique([positionId, capability])
|
||||
}
|
||||
|
||||
model CitizenshipPosition {
|
||||
id String @id @default(uuid())
|
||||
citizenshipId String
|
||||
citizenship Citizenship @relation(fields: [citizenshipId], references: [id], onDelete: Cascade)
|
||||
positionId String
|
||||
position Position @relation(fields: [positionId], references: [id], onDelete: Cascade)
|
||||
assignedAt DateTime @default(now())
|
||||
resignedAt DateTime?
|
||||
|
||||
actId String?
|
||||
act Act? @relation(fields: [actId], references: [id])
|
||||
|
||||
@@index([positionId, resignedAt])
|
||||
@@index([citizenshipId])
|
||||
}
|
||||
|
||||
model ActType {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
name String
|
||||
allowedIssuerKind InstitutionKind
|
||||
allowedIssuerInstitutionCode String?
|
||||
legalRank Int
|
||||
numberingScope String
|
||||
|
||||
acts Act[]
|
||||
}
|
||||
|
||||
enum ActLegalStatus {
|
||||
DRAFT
|
||||
IN_FORCE
|
||||
AMENDED
|
||||
REPEALED
|
||||
EXPIRED
|
||||
NOT_ADOPTED
|
||||
}
|
||||
|
||||
model Act {
|
||||
id String @id @default(uuid())
|
||||
|
||||
actTypeId String
|
||||
actType ActType @relation(fields: [actTypeId], references: [id])
|
||||
|
||||
issuingInstitutionId String
|
||||
issuingInstitution Institution @relation(fields: [issuingInstitutionId], references: [id])
|
||||
|
||||
regionId String?
|
||||
region Region? @relation(fields: [regionId], references: [id])
|
||||
|
||||
authorId String
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
|
||||
numberYear Int?
|
||||
numberInSeries Int?
|
||||
|
||||
legalStatus ActLegalStatus @default(DRAFT)
|
||||
|
||||
title String
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
versions ActVersion[]
|
||||
citizenshipPositions CitizenshipPosition[]
|
||||
}
|
||||
|
||||
model ActVersion {
|
||||
id String @id @default(uuid())
|
||||
actId String
|
||||
act Act @relation(fields: [actId], references: [id], onDelete: Cascade)
|
||||
|
||||
effectiveFrom DateTime?
|
||||
isCurrent Boolean @default(true)
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
createdBy String
|
||||
|
||||
blocks ActBlock[]
|
||||
approvals ActApproval[]
|
||||
|
||||
@@index([actId, effectiveFrom])
|
||||
}
|
||||
|
||||
model ActBlock {
|
||||
id String @id @default(uuid())
|
||||
versionId String
|
||||
version ActVersion @relation(fields: [versionId], references: [id], onDelete: Cascade)
|
||||
|
||||
stableKey String
|
||||
type String
|
||||
position Float
|
||||
content Json
|
||||
|
||||
@@unique([versionId, stableKey])
|
||||
@@index([versionId, position])
|
||||
}
|
||||
|
||||
enum ApprovalDecision {
|
||||
APPROVE
|
||||
VETO
|
||||
}
|
||||
|
||||
model ActApproval {
|
||||
id String @id @default(uuid())
|
||||
actVersionId String
|
||||
actVersion ActVersion @relation(fields: [actVersionId], references: [id], onDelete: Cascade)
|
||||
|
||||
phaseKey String
|
||||
decision ApprovalDecision
|
||||
|
||||
citizenshipId String
|
||||
citizenship Citizenship @relation(fields: [citizenshipId], references: [id])
|
||||
|
||||
name String
|
||||
role String
|
||||
|
||||
decidedAt DateTime @default(now())
|
||||
|
||||
@@unique([actVersionId, phaseKey])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user