feat(profile): add counterparty profile and enforce it for order creation
This commit is contained in:
29
prisma/migrations/0002_counterparty_profile/migration.sql
Normal file
29
prisma/migrations/0002_counterparty_profile/migration.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "CounterpartyProfile" (
|
||||
"id" TEXT NOT NULL,
|
||||
"userId" TEXT NOT NULL,
|
||||
"companyName" TEXT NOT NULL,
|
||||
"companyFullName" TEXT NOT NULL,
|
||||
"inn" TEXT NOT NULL,
|
||||
"kpp" TEXT,
|
||||
"ogrn" TEXT,
|
||||
"legalAddress" TEXT NOT NULL,
|
||||
"bankName" TEXT NOT NULL,
|
||||
"bik" TEXT NOT NULL,
|
||||
"correspondentAccount" TEXT NOT NULL,
|
||||
"checkingAccount" TEXT NOT NULL,
|
||||
"signerFullName" TEXT NOT NULL,
|
||||
"signerPosition" TEXT NOT NULL,
|
||||
"signerBasis" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "CounterpartyProfile_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "CounterpartyProfile_userId_key" ON "CounterpartyProfile"("userId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "CounterpartyProfile" ADD CONSTRAINT "CounterpartyProfile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
@@ -61,6 +61,7 @@ model User {
|
||||
role UserRole
|
||||
companyId String?
|
||||
company Company? @relation(fields: [companyId], references: [id])
|
||||
counterpartyProfile CounterpartyProfile?
|
||||
registrationRequests RegistrationRequest[] @relation("RegistrationRequester")
|
||||
reviewedRequests RegistrationRequest[] @relation("RegistrationReviewer")
|
||||
sentInvitations Invitation[] @relation("InvitationManager")
|
||||
@@ -78,6 +79,27 @@ model User {
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model CounterpartyProfile {
|
||||
id String @id @default(cuid())
|
||||
userId String @unique
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
companyName String
|
||||
companyFullName String
|
||||
inn String
|
||||
kpp String?
|
||||
ogrn String?
|
||||
legalAddress String
|
||||
bankName String
|
||||
bik String
|
||||
correspondentAccount String
|
||||
checkingAccount String
|
||||
signerFullName String
|
||||
signerPosition String
|
||||
signerBasis String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model RegistrationRequest {
|
||||
id String @id @default(cuid())
|
||||
companyName String
|
||||
|
||||
Reference in New Issue
Block a user