procbay-schema 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/prisma/.env +1 -1
- package/prisma/migrations/20250728072402_init_budget_management_tables/migration.sql +0 -0
- package/prisma/migrations/20250729100954_/migration.sql +91 -0
- package/prisma/migrations/20250729101424_init_vendor_reference_table/migration.sql +23 -0
- package/prisma/migrations/20250729122612_removed_vendor_related_fields/migration.sql +102 -0
- package/prisma/migrations/20250729122741_alter_vendor_refrence_table/migration.sql +5 -0
- package/prisma/schema.prisma +27 -250
- package/src/prisma/edge.js +23 -181
- package/src/prisma/index-browser.js +20 -178
- package/src/prisma/index.d.ts +18474 -38652
- package/src/prisma/index.js +23 -181
- package/src/prisma/package.json +1 -1
- package/src/prisma/schema.prisma +138 -361
- package/src/prisma/wasm.js +20 -178
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "procbay-schema",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A set of utilities for managing Prisma database schemas, seeding, and maintenance operations for the Procure-to-Pay system",
|
|
5
5
|
"main": "src/prisma/index.js",
|
|
6
6
|
"type": "module",
|
package/prisma/.env
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
|
5
5
|
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
|
6
6
|
|
|
7
|
-
DEFAULT_DATABASE_URL="postgresql://postgres:root@localhost:5432/
|
|
7
|
+
DEFAULT_DATABASE_URL="postgresql://postgres:root@localhost:5432/procbay_new_db?schema=procbay_schema"
|
|
8
8
|
DETAILED_LOGGING=true
|
|
9
9
|
LOG_LEVEL=info
|
|
File without changes
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `financial_year` on the `budgets` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `supporting_documents` on the `budgets` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the column `budget_id` on the `category_budgets` table. All the data in the column will be lost.
|
|
7
|
+
- A unique constraint covering the columns `[department_budget_id,category_id]` on the table `category_budgets` will be added. If there are existing duplicate values, this will fail.
|
|
8
|
+
|
|
9
|
+
*/
|
|
10
|
+
-- AlterEnum
|
|
11
|
+
ALTER TYPE "AlertTypeEnum" ADD VALUE 'EXPORT';
|
|
12
|
+
|
|
13
|
+
-- DropForeignKey
|
|
14
|
+
ALTER TABLE "category_budgets" DROP CONSTRAINT "category_budgets_budget_id_fkey";
|
|
15
|
+
|
|
16
|
+
-- DropIndex
|
|
17
|
+
DROP INDEX "category_budgets_budget_id_category_id_key";
|
|
18
|
+
|
|
19
|
+
-- AlterTable
|
|
20
|
+
ALTER TABLE "budgets" DROP COLUMN "financial_year",
|
|
21
|
+
DROP COLUMN "supporting_documents",
|
|
22
|
+
ADD COLUMN "fiscal_year" TEXT;
|
|
23
|
+
|
|
24
|
+
-- AlterTable
|
|
25
|
+
ALTER TABLE "category_budgets" DROP COLUMN "budget_id",
|
|
26
|
+
ADD COLUMN "department_budget_id" INTEGER,
|
|
27
|
+
ADD COLUMN "description" TEXT;
|
|
28
|
+
|
|
29
|
+
-- AlterTable
|
|
30
|
+
ALTER TABLE "department_budgets" ADD COLUMN "description" TEXT,
|
|
31
|
+
ADD COLUMN "fiscal_year" TEXT,
|
|
32
|
+
ALTER COLUMN "allocated_budget" DROP NOT NULL;
|
|
33
|
+
|
|
34
|
+
-- AlterTable
|
|
35
|
+
ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
|
|
36
|
+
|
|
37
|
+
-- CreateTable
|
|
38
|
+
CREATE TABLE "supporting_documents" (
|
|
39
|
+
"id" SERIAL NOT NULL,
|
|
40
|
+
"budget_id" INTEGER,
|
|
41
|
+
"department_budget_id" INTEGER,
|
|
42
|
+
"category_budget_id" INTEGER,
|
|
43
|
+
"file_name" TEXT,
|
|
44
|
+
"original_name" TEXT,
|
|
45
|
+
"file_path" TEXT,
|
|
46
|
+
"file_size" INTEGER,
|
|
47
|
+
"mime_type" TEXT,
|
|
48
|
+
"created_by" INTEGER,
|
|
49
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
50
|
+
"updated_by" INTEGER,
|
|
51
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
52
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
53
|
+
"deleted_by" INTEGER,
|
|
54
|
+
"deleted_at" TIMESTAMPTZ(6),
|
|
55
|
+
|
|
56
|
+
CONSTRAINT "supporting_documents_pkey" PRIMARY KEY ("id")
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
-- CreateTable
|
|
60
|
+
CREATE TABLE "expenses" (
|
|
61
|
+
"id" SERIAL NOT NULL,
|
|
62
|
+
"category_budget_id" INTEGER,
|
|
63
|
+
"amount" DECIMAL(15,2) NOT NULL,
|
|
64
|
+
"description" TEXT,
|
|
65
|
+
"expense_date" TIMESTAMP(3),
|
|
66
|
+
"receipt_number" TEXT,
|
|
67
|
+
"vendor_name" TEXT,
|
|
68
|
+
"notes" TEXT,
|
|
69
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
70
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
71
|
+
|
|
72
|
+
CONSTRAINT "expenses_pkey" PRIMARY KEY ("id")
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
-- CreateIndex
|
|
76
|
+
CREATE UNIQUE INDEX "category_budgets_department_budget_id_category_id_key" ON "category_budgets"("department_budget_id", "category_id");
|
|
77
|
+
|
|
78
|
+
-- AddForeignKey
|
|
79
|
+
ALTER TABLE "category_budgets" ADD CONSTRAINT "category_budgets_department_budget_id_fkey" FOREIGN KEY ("department_budget_id") REFERENCES "department_budgets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
80
|
+
|
|
81
|
+
-- AddForeignKey
|
|
82
|
+
ALTER TABLE "supporting_documents" ADD CONSTRAINT "supporting_documents_budget_id_fkey" FOREIGN KEY ("budget_id") REFERENCES "budgets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
83
|
+
|
|
84
|
+
-- AddForeignKey
|
|
85
|
+
ALTER TABLE "supporting_documents" ADD CONSTRAINT "supporting_documents_department_budget_id_fkey" FOREIGN KEY ("department_budget_id") REFERENCES "department_budgets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
86
|
+
|
|
87
|
+
-- AddForeignKey
|
|
88
|
+
ALTER TABLE "supporting_documents" ADD CONSTRAINT "supporting_documents_category_budget_id_fkey" FOREIGN KEY ("category_budget_id") REFERENCES "category_budgets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
89
|
+
|
|
90
|
+
-- AddForeignKey
|
|
91
|
+
ALTER TABLE "expenses" ADD CONSTRAINT "expenses_category_budget_id_fkey" FOREIGN KEY ("category_budget_id") REFERENCES "category_budgets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
|
|
3
|
+
|
|
4
|
+
-- CreateTable
|
|
5
|
+
CREATE TABLE "vendor_references" (
|
|
6
|
+
"id" SERIAL NOT NULL,
|
|
7
|
+
"global_vendor_id" INTEGER,
|
|
8
|
+
"tenant_vendor_code" TEXT,
|
|
9
|
+
"invited_by" INTEGER,
|
|
10
|
+
"invited_on" TIMESTAMP(3),
|
|
11
|
+
"is_deleted" BOOLEAN NOT NULL DEFAULT false,
|
|
12
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
13
|
+
"created_by" INTEGER,
|
|
14
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
15
|
+
"updated_by" INTEGER,
|
|
16
|
+
"deleted_at" TIMESTAMP(3),
|
|
17
|
+
"deleted_by" INTEGER,
|
|
18
|
+
|
|
19
|
+
CONSTRAINT "vendor_references_pkey" PRIMARY KEY ("id")
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
-- AddForeignKey
|
|
23
|
+
ALTER TABLE "vendor_references" ADD CONSTRAINT "vendor_references_invited_by_fkey" FOREIGN KEY ("invited_by") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the `vendor_alerts` table. If the table is not empty, all the data it contains will be lost.
|
|
5
|
+
- You are about to drop the `vendor_categories` table. If the table is not empty, all the data it contains will be lost.
|
|
6
|
+
- You are about to drop the `vendor_contact_persons` table. If the table is not empty, all the data it contains will be lost.
|
|
7
|
+
- You are about to drop the `vendor_event_watchlist` table. If the table is not empty, all the data it contains will be lost.
|
|
8
|
+
- You are about to drop the `vendor_kyc_info` table. If the table is not empty, all the data it contains will be lost.
|
|
9
|
+
- You are about to drop the `vendor_kyc_info_verification_status` table. If the table is not empty, all the data it contains will be lost.
|
|
10
|
+
- You are about to drop the `vendor_status` table. If the table is not empty, all the data it contains will be lost.
|
|
11
|
+
- You are about to drop the `vendors` table. If the table is not empty, all the data it contains will be lost.
|
|
12
|
+
|
|
13
|
+
*/
|
|
14
|
+
-- DropForeignKey
|
|
15
|
+
ALTER TABLE "activity_logs" DROP CONSTRAINT "activity_logs_vendor_id_fkey";
|
|
16
|
+
|
|
17
|
+
-- DropForeignKey
|
|
18
|
+
ALTER TABLE "event_vendors" DROP CONSTRAINT "event_vendors_vendor_id_fkey";
|
|
19
|
+
|
|
20
|
+
-- DropForeignKey
|
|
21
|
+
ALTER TABLE "purchase_order_activity_logs" DROP CONSTRAINT "purchase_order_activity_logs_vendor_id_fkey";
|
|
22
|
+
|
|
23
|
+
-- DropForeignKey
|
|
24
|
+
ALTER TABLE "support_tickets" DROP CONSTRAINT "support_tickets_vendor_id_fkey";
|
|
25
|
+
|
|
26
|
+
-- DropForeignKey
|
|
27
|
+
ALTER TABLE "ticket_replies" DROP CONSTRAINT "ticket_replies_vendor_id_fkey";
|
|
28
|
+
|
|
29
|
+
-- DropForeignKey
|
|
30
|
+
ALTER TABLE "user_vendor_socket_tokens" DROP CONSTRAINT "user_vendor_socket_tokens_vendor_id_fkey";
|
|
31
|
+
|
|
32
|
+
-- DropForeignKey
|
|
33
|
+
ALTER TABLE "vendor_alerts" DROP CONSTRAINT "vendor_alerts_vendor_id_fkey";
|
|
34
|
+
|
|
35
|
+
-- DropForeignKey
|
|
36
|
+
ALTER TABLE "vendor_categories" DROP CONSTRAINT "vendor_categories_category_id_fkey";
|
|
37
|
+
|
|
38
|
+
-- DropForeignKey
|
|
39
|
+
ALTER TABLE "vendor_categories" DROP CONSTRAINT "vendor_categories_vendor_id_fkey";
|
|
40
|
+
|
|
41
|
+
-- DropForeignKey
|
|
42
|
+
ALTER TABLE "vendor_contact_persons" DROP CONSTRAINT "vendor_contact_persons_vendor_id_fkey";
|
|
43
|
+
|
|
44
|
+
-- DropForeignKey
|
|
45
|
+
ALTER TABLE "vendor_event_watchlist" DROP CONSTRAINT "vendor_event_watchlist_event_id_fkey";
|
|
46
|
+
|
|
47
|
+
-- DropForeignKey
|
|
48
|
+
ALTER TABLE "vendor_event_watchlist" DROP CONSTRAINT "vendor_event_watchlist_vendor_id_fkey";
|
|
49
|
+
|
|
50
|
+
-- DropForeignKey
|
|
51
|
+
ALTER TABLE "vendor_kyc_info" DROP CONSTRAINT "vendor_kyc_info_vendor_id_fkey";
|
|
52
|
+
|
|
53
|
+
-- DropForeignKey
|
|
54
|
+
ALTER TABLE "vendor_kyc_info_verification_status" DROP CONSTRAINT "vendor_kyc_info_verification_status_approved_by_fkey";
|
|
55
|
+
|
|
56
|
+
-- DropForeignKey
|
|
57
|
+
ALTER TABLE "vendor_kyc_info_verification_status" DROP CONSTRAINT "vendor_kyc_info_verification_status_kyc_id_fkey";
|
|
58
|
+
|
|
59
|
+
-- DropForeignKey
|
|
60
|
+
ALTER TABLE "vendor_kyc_info_verification_status" DROP CONSTRAINT "vendor_kyc_info_verification_status_raised_by_fkey";
|
|
61
|
+
|
|
62
|
+
-- DropForeignKey
|
|
63
|
+
ALTER TABLE "vendor_status" DROP CONSTRAINT "vendor_status_updated_by_fkey";
|
|
64
|
+
|
|
65
|
+
-- DropForeignKey
|
|
66
|
+
ALTER TABLE "vendor_status" DROP CONSTRAINT "vendor_status_vendor_id_fkey";
|
|
67
|
+
|
|
68
|
+
-- AlterTable
|
|
69
|
+
ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
|
|
70
|
+
|
|
71
|
+
-- DropTable
|
|
72
|
+
DROP TABLE "vendor_alerts";
|
|
73
|
+
|
|
74
|
+
-- DropTable
|
|
75
|
+
DROP TABLE "vendor_categories";
|
|
76
|
+
|
|
77
|
+
-- DropTable
|
|
78
|
+
DROP TABLE "vendor_contact_persons";
|
|
79
|
+
|
|
80
|
+
-- DropTable
|
|
81
|
+
DROP TABLE "vendor_event_watchlist";
|
|
82
|
+
|
|
83
|
+
-- DropTable
|
|
84
|
+
DROP TABLE "vendor_kyc_info";
|
|
85
|
+
|
|
86
|
+
-- DropTable
|
|
87
|
+
DROP TABLE "vendor_kyc_info_verification_status";
|
|
88
|
+
|
|
89
|
+
-- DropTable
|
|
90
|
+
DROP TABLE "vendor_status";
|
|
91
|
+
|
|
92
|
+
-- DropTable
|
|
93
|
+
DROP TABLE "vendors";
|
|
94
|
+
|
|
95
|
+
-- DropEnum
|
|
96
|
+
DROP TYPE "ContactTypeEnum";
|
|
97
|
+
|
|
98
|
+
-- DropEnum
|
|
99
|
+
DROP TYPE "VendorKycStatusEnum";
|
|
100
|
+
|
|
101
|
+
-- DropEnum
|
|
102
|
+
DROP TYPE "VendorKycVerificationStatusEnum";
|
package/prisma/schema.prisma
CHANGED
|
@@ -78,8 +78,6 @@ model User {
|
|
|
78
78
|
ticket_assignment_to TicketAssignment[] @relation("user_assigned_to")
|
|
79
79
|
ticket_assignment_by_user TicketHistory[] @relation("user_assigned_by")
|
|
80
80
|
ticket_assignment_to_user TicketHistory[] @relation("user_assigned_to")
|
|
81
|
-
vendor_profile_status_updated_by VendorStatus[] @relation("vendor_profile_status_updated_by")
|
|
82
|
-
vendor_kyc_verification_status VendorKycInfoVerificationStatus[]
|
|
83
81
|
admin_alerts AdminAlert[]
|
|
84
82
|
purchase_intake PurchaseIntake[]
|
|
85
83
|
approval_level_user ApprovalLevelUser[]
|
|
@@ -99,6 +97,7 @@ model User {
|
|
|
99
97
|
export_logs ExportLog[]
|
|
100
98
|
department_head Department[] @relation("department_head")
|
|
101
99
|
budget_manager Department[] @relation("budget_manager")
|
|
100
|
+
vendor_reference VendorReference[]
|
|
102
101
|
|
|
103
102
|
@@map("users")
|
|
104
103
|
}
|
|
@@ -255,10 +254,9 @@ model Category {
|
|
|
255
254
|
deleted_by Int?
|
|
256
255
|
deleted_at DateTime? @db.Timestamptz(6)
|
|
257
256
|
attributes Attribute[]
|
|
258
|
-
vendor_categories VendorCategory[]
|
|
259
257
|
Item Item[]
|
|
260
258
|
category_uom UomCategory[]
|
|
261
|
-
CategoryBudget
|
|
259
|
+
category_budget CategoryBudget[]
|
|
262
260
|
|
|
263
261
|
@@map("categories")
|
|
264
262
|
}
|
|
@@ -506,125 +504,6 @@ model PurchaseIntakeItem {
|
|
|
506
504
|
|
|
507
505
|
//---------------------------------- PURCHASEINTAKESITEMS MODEL END ----------------------------------
|
|
508
506
|
|
|
509
|
-
//---------------------------------- VENDOR MODEL START ------------------------------------------------
|
|
510
|
-
|
|
511
|
-
model Vendor {
|
|
512
|
-
id Int @id @default(autoincrement())
|
|
513
|
-
uuid String? @unique @default(uuid())
|
|
514
|
-
vendor_id String? @unique
|
|
515
|
-
name String?
|
|
516
|
-
legal_name String?
|
|
517
|
-
email_id String? @unique
|
|
518
|
-
mobile_number String? @unique
|
|
519
|
-
password String?
|
|
520
|
-
country_code String?
|
|
521
|
-
gst_in String?
|
|
522
|
-
person_in_charge String?
|
|
523
|
-
city String?
|
|
524
|
-
industry String?
|
|
525
|
-
incorporation_date DateTime? @db.Timestamptz(6)
|
|
526
|
-
ownership_type String?
|
|
527
|
-
head_office_location String?
|
|
528
|
-
operational_region Json?
|
|
529
|
-
pan_number String?
|
|
530
|
-
pan_image String?
|
|
531
|
-
is_pan_verified Boolean? @default(false)
|
|
532
|
-
pan_verification_request String?
|
|
533
|
-
pan_verification_response String?
|
|
534
|
-
gst_number String?
|
|
535
|
-
is_gst_verified Boolean? @default(false)
|
|
536
|
-
gst_verification_request String?
|
|
537
|
-
gst_verification_response String?
|
|
538
|
-
is_basic_info_registered Boolean? @default(false)
|
|
539
|
-
status StatusEnum @default(InActive)
|
|
540
|
-
is_email_verified Boolean @default(false)
|
|
541
|
-
is_mobile_verified Boolean @default(false)
|
|
542
|
-
profile_picture String?
|
|
543
|
-
invitation_status Boolean @default(false)
|
|
544
|
-
reset_token String?
|
|
545
|
-
reset_token_expiry DateTime? @db.Timestamptz(6)
|
|
546
|
-
access_token_expiry String?
|
|
547
|
-
token_version Int? @default(0) // This will be used to invalidate old refresh tokens
|
|
548
|
-
is_logged_in Boolean @default(false)
|
|
549
|
-
onboarded_on DateTime? @db.Timestamptz(6)
|
|
550
|
-
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
551
|
-
created_by Int?
|
|
552
|
-
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
553
|
-
updated_by Int?
|
|
554
|
-
is_deleted Boolean @default(false)
|
|
555
|
-
deleted_at DateTime? @db.Timestamptz(6)
|
|
556
|
-
deleted_by Int?
|
|
557
|
-
is_kyc_approved VendorKycVerificationStatusEnum @default(PENDING)
|
|
558
|
-
vendor_categories VendorCategory[]
|
|
559
|
-
vendor_contact_persons VendorContactPerson[]
|
|
560
|
-
event_vendors EventVendors[]
|
|
561
|
-
vendor_kyc_info VendorKycInfo[]
|
|
562
|
-
support_tickets SupportTicket[]
|
|
563
|
-
ticket_replies TicketReply[] @relation("vendor_reply")
|
|
564
|
-
vendor_status VendorStatus[]
|
|
565
|
-
vendor_event_watchlist VendorEventWatchlist[]
|
|
566
|
-
vendor_kyc_verification_status VendorKycInfoVerificationStatus[]
|
|
567
|
-
vendor_alerts VendorAlert[]
|
|
568
|
-
purchase_order_activity_log PurchaseOrderActivityLog[]
|
|
569
|
-
vendor_socket_tokens UserVendorSocketTokens[]
|
|
570
|
-
activity_logs ActivityLog[]
|
|
571
|
-
|
|
572
|
-
@@map("vendors")
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
//---------------------------------- VENDOR MODEL END ------------------------------------------------
|
|
576
|
-
|
|
577
|
-
//---------------------------------- VENDOR CATEGORY MODEL START ------------------------------------------------
|
|
578
|
-
model VendorCategory {
|
|
579
|
-
id Int @id @default(autoincrement())
|
|
580
|
-
uuid String? @unique @default(uuid())
|
|
581
|
-
vendor_id Int
|
|
582
|
-
vendor Vendor @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
583
|
-
category_id Int
|
|
584
|
-
category Category @relation(fields: [category_id], references: [id], onDelete: Cascade)
|
|
585
|
-
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
586
|
-
created_by Int?
|
|
587
|
-
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
588
|
-
updated_by Int?
|
|
589
|
-
deleted_at DateTime? @db.Timestamptz(6)
|
|
590
|
-
deleted_by Int?
|
|
591
|
-
|
|
592
|
-
@@map("vendor_categories")
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
//---------------------------------- VENDOR CATEGORY MODEL END ------------------------------------------------
|
|
596
|
-
|
|
597
|
-
//---------------------------------- VENDOR CONTACT PERSON MODEL START ------------------------------------------------
|
|
598
|
-
enum ContactTypeEnum {
|
|
599
|
-
Primary
|
|
600
|
-
Secondary
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
model VendorContactPerson {
|
|
604
|
-
id Int @id @default(autoincrement())
|
|
605
|
-
uuid String? @unique @default(uuid())
|
|
606
|
-
vendor_id Int
|
|
607
|
-
vendor Vendor @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
608
|
-
name String?
|
|
609
|
-
email_id String?
|
|
610
|
-
country_code String?
|
|
611
|
-
mobile_number String?
|
|
612
|
-
designation String?
|
|
613
|
-
contact_type ContactTypeEnum @default(Primary)
|
|
614
|
-
is_active Boolean @default(true)
|
|
615
|
-
is_deleted Boolean @default(false)
|
|
616
|
-
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
617
|
-
created_by Int?
|
|
618
|
-
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
619
|
-
updated_by Int?
|
|
620
|
-
deleted_at DateTime? @db.Timestamptz(6)
|
|
621
|
-
deleted_by Int?
|
|
622
|
-
|
|
623
|
-
@@map("vendor_contact_persons")
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
//---------------------------------- VENDOR CONTACT PERSON MODEL END ------------------------------------------------
|
|
627
|
-
|
|
628
507
|
//---------------------------------- EMAILTEMPLATE MODEL END ------------------------------------------------
|
|
629
508
|
model EmailTemplate {
|
|
630
509
|
id Int @id @default(autoincrement())
|
|
@@ -1133,7 +1012,6 @@ model Event {
|
|
|
1133
1012
|
event_vendors EventVendors[]
|
|
1134
1013
|
event_configurations EventConfigurations[]
|
|
1135
1014
|
event_strategies EventStrategies[]
|
|
1136
|
-
vendor_event_watchlist VendorEventWatchlist[]
|
|
1137
1015
|
bids Bid[]
|
|
1138
1016
|
bid_logs BidLog[]
|
|
1139
1017
|
quotations Quotation[]
|
|
@@ -1206,7 +1084,6 @@ model EventVendors {
|
|
|
1206
1084
|
id Int @id @default(autoincrement())
|
|
1207
1085
|
uuid String? @unique @default(uuid())
|
|
1208
1086
|
vendor_id Int?
|
|
1209
|
-
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1210
1087
|
event_id Int?
|
|
1211
1088
|
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1212
1089
|
is_active Boolean? @default(true)
|
|
@@ -1283,29 +1160,6 @@ model EventStrategies {
|
|
|
1283
1160
|
|
|
1284
1161
|
//---------------------------------- EVENTS STRATEGIES MODEL END ------------------------------------------------
|
|
1285
1162
|
|
|
1286
|
-
//---------------------------------- VENDOR EVENTS WATCHLIST MODEL START ------------------------------------------------
|
|
1287
|
-
|
|
1288
|
-
model VendorEventWatchlist {
|
|
1289
|
-
id Int @id @default(autoincrement())
|
|
1290
|
-
uuid String? @unique @default(uuid())
|
|
1291
|
-
vendor_id Int?
|
|
1292
|
-
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1293
|
-
event_id Int?
|
|
1294
|
-
event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
1295
|
-
is_active Boolean? @default(true)
|
|
1296
|
-
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1297
|
-
created_by Int?
|
|
1298
|
-
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1299
|
-
updated_by Int?
|
|
1300
|
-
is_deleted Boolean? @default(false)
|
|
1301
|
-
deleted_at DateTime? @db.Timestamptz(6)
|
|
1302
|
-
deleted_by Int?
|
|
1303
|
-
|
|
1304
|
-
@@map("vendor_event_watchlist")
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
//---------------------------------- VENDOR EVENTS MODEL END ------------------------------------------------
|
|
1308
|
-
|
|
1309
1163
|
//---------------------------------- STRATEGIES MODEL START ------------------------------------------------
|
|
1310
1164
|
|
|
1311
1165
|
model Strategies {
|
|
@@ -1358,40 +1212,6 @@ model Cms {
|
|
|
1358
1212
|
|
|
1359
1213
|
/////////////////////////////////// END CMS SCHEMA //////////////////////////////
|
|
1360
1214
|
|
|
1361
|
-
//---------------------------------- VENDOR KYC INFO MODEL START ------------------------------------------------
|
|
1362
|
-
|
|
1363
|
-
enum VendorKycStatusEnum {
|
|
1364
|
-
PENDING
|
|
1365
|
-
APPROVED
|
|
1366
|
-
REJECTED
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
model VendorKycInfo {
|
|
1370
|
-
id Int @id @default(autoincrement())
|
|
1371
|
-
uuid String? @unique @default(uuid())
|
|
1372
|
-
vendor_id Int?
|
|
1373
|
-
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
1374
|
-
section_name String?
|
|
1375
|
-
section_type String?
|
|
1376
|
-
fields Json?
|
|
1377
|
-
status VendorKycStatusEnum @default(PENDING)
|
|
1378
|
-
reject_reason String?
|
|
1379
|
-
is_active Boolean? @default(true)
|
|
1380
|
-
is_deleted Boolean? @default(false)
|
|
1381
|
-
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1382
|
-
created_by Int?
|
|
1383
|
-
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1384
|
-
updated_by Int?
|
|
1385
|
-
deleted_at DateTime? @db.Timestamptz(6)
|
|
1386
|
-
deleted_by Int?
|
|
1387
|
-
vendor_kyc_verification_status VendorKycInfoVerificationStatus[]
|
|
1388
|
-
|
|
1389
|
-
@@unique([vendor_id, section_type])
|
|
1390
|
-
@@map("vendor_kyc_info")
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
//---------------------------------- VENDOR KYC INFO MODEL END ------------------------------------------------
|
|
1394
|
-
|
|
1395
1215
|
//---------------------------------- CURRENCY MODEL START ------------------------------------------------
|
|
1396
1216
|
|
|
1397
1217
|
model Currency {
|
|
@@ -1443,7 +1263,6 @@ model SupportTicket {
|
|
|
1443
1263
|
uuid String? @unique @default(uuid())
|
|
1444
1264
|
ticket_code String? @unique
|
|
1445
1265
|
vendor_id Int?
|
|
1446
|
-
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
1447
1266
|
subject String?
|
|
1448
1267
|
category_id Int?
|
|
1449
1268
|
category SupportCategory? @relation(fields: [category_id], references: [id], onDelete: Cascade)
|
|
@@ -1504,7 +1323,6 @@ model TicketReply {
|
|
|
1504
1323
|
user_id Int? // User who replied
|
|
1505
1324
|
user User? @relation("user_reply", fields: [user_id], references: [id], onDelete: Cascade)
|
|
1506
1325
|
vendor_id Int? // Vendor who replied
|
|
1507
|
-
vendor Vendor? @relation("vendor_reply", fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
1508
1326
|
message String?
|
|
1509
1327
|
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1510
1328
|
|
|
@@ -1537,50 +1355,6 @@ model SupportCategory {
|
|
|
1537
1355
|
|
|
1538
1356
|
//---------------------------------- SUPPORT CATEGORY MODEL END ------------------------------------------------
|
|
1539
1357
|
|
|
1540
|
-
//---------------------------------- VENDOR STATUS MODEL START ------------------------------------------------
|
|
1541
|
-
model VendorStatus {
|
|
1542
|
-
id Int @id @default(autoincrement())
|
|
1543
|
-
vendor_id Int?
|
|
1544
|
-
vendor Vendor? @relation(fields: [vendor_id], references: [id])
|
|
1545
|
-
previous_status StatusEnum?
|
|
1546
|
-
current_status StatusEnum?
|
|
1547
|
-
comment String?
|
|
1548
|
-
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
1549
|
-
updated_by Int?
|
|
1550
|
-
updatedBy User? @relation("vendor_profile_status_updated_by", fields: [updated_by], references: [id])
|
|
1551
|
-
|
|
1552
|
-
@@map("vendor_status")
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
//---------------------------------- VENDOR STATUS MODEL END ------------------------------------------------
|
|
1556
|
-
|
|
1557
|
-
//---------------------------------- VENDOR KYC INFO VERIFICATION STATUS MODEL START --------------------------------------------
|
|
1558
|
-
enum VendorKycVerificationStatusEnum {
|
|
1559
|
-
PENDING
|
|
1560
|
-
APPROVED
|
|
1561
|
-
REJECTED
|
|
1562
|
-
IN_PROGRESS
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
model VendorKycInfoVerificationStatus {
|
|
1566
|
-
id Int @id @default(autoincrement())
|
|
1567
|
-
uuid String? @unique @default(uuid())
|
|
1568
|
-
kyc_id Int?
|
|
1569
|
-
kyc_info VendorKycInfo? @relation(fields: [kyc_id], references: [id], onDelete: Cascade)
|
|
1570
|
-
status VendorKycVerificationStatusEnum @default(PENDING)
|
|
1571
|
-
reject_reason String?
|
|
1572
|
-
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1573
|
-
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
1574
|
-
raised_by Int?
|
|
1575
|
-
vendor Vendor? @relation(fields: [raised_by], references: [id], onDelete: Cascade)
|
|
1576
|
-
approved_by Int?
|
|
1577
|
-
user User? @relation(fields: [approved_by], references: [id], onDelete: Cascade)
|
|
1578
|
-
|
|
1579
|
-
@@map("vendor_kyc_info_verification_status")
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
|
-
//------------------------------------- VENDOR KYC INFO VERIFICATION STATUS MODEL END --------------------------------------------
|
|
1583
|
-
|
|
1584
1358
|
//------------------------------------- ADMIN ALERTS MODEL START ------------------------------------------
|
|
1585
1359
|
|
|
1586
1360
|
enum AlertTypeEnum {
|
|
@@ -1596,6 +1370,7 @@ enum AlertTypeEnum {
|
|
|
1596
1370
|
CONTRACT_CLAUSE
|
|
1597
1371
|
CONTRACT_TEMPLATE
|
|
1598
1372
|
UPLOAD
|
|
1373
|
+
EXPORT
|
|
1599
1374
|
}
|
|
1600
1375
|
|
|
1601
1376
|
model AdminAlert {
|
|
@@ -1615,25 +1390,6 @@ model AdminAlert {
|
|
|
1615
1390
|
|
|
1616
1391
|
//------------------------------------- ADMIN ALERTS MODEL END --------------------------------------------
|
|
1617
1392
|
|
|
1618
|
-
//------------------------------------- VENDOR ALERTS MODEL START ------------------------------------------
|
|
1619
|
-
|
|
1620
|
-
model VendorAlert {
|
|
1621
|
-
id Int @id @default(autoincrement())
|
|
1622
|
-
vendor_id Int?
|
|
1623
|
-
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
1624
|
-
alert_type AlertTypeEnum?
|
|
1625
|
-
title String?
|
|
1626
|
-
message String?
|
|
1627
|
-
redirect_url String?
|
|
1628
|
-
is_read Boolean @default(false)
|
|
1629
|
-
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
1630
|
-
meta_data Json? @db.JsonB
|
|
1631
|
-
|
|
1632
|
-
@@map("vendor_alerts")
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
//------------------------------------- VENDOR ALERTS MODEL END --------------------------------------------
|
|
1636
|
-
|
|
1637
1393
|
//-------------------------------------CUSTOMER NOTIFICATION MODEL START --------------------------------------------
|
|
1638
1394
|
|
|
1639
1395
|
enum MediumEnum {
|
|
@@ -2274,7 +2030,6 @@ model PurchaseOrderActivityLog {
|
|
|
2274
2030
|
user_id Int? // Could be buyer or vendor
|
|
2275
2031
|
user User? @relation(fields: [user_id], references: [id], onDelete: SetNull)
|
|
2276
2032
|
vendor_id Int?
|
|
2277
|
-
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: SetNull)
|
|
2278
2033
|
activity_type POActivityType? @default(CREATED)
|
|
2279
2034
|
remarks String? // Optional free text for custom remarks
|
|
2280
2035
|
metadata Json? // Any additional details (file info, etc.)
|
|
@@ -2295,7 +2050,6 @@ model UserVendorSocketTokens {
|
|
|
2295
2050
|
user_id Int?
|
|
2296
2051
|
user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
2297
2052
|
vendor_id Int?
|
|
2298
|
-
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
2299
2053
|
socket_id String?
|
|
2300
2054
|
status Boolean? @default(true)
|
|
2301
2055
|
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
@@ -2313,7 +2067,6 @@ model ActivityLog {
|
|
|
2313
2067
|
user_id Int?
|
|
2314
2068
|
user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
2315
2069
|
vendor_id Int?
|
|
2316
|
-
vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
|
|
2317
2070
|
module_name String? // e.g., "PurchaseIntake", "VendorManagement"
|
|
2318
2071
|
module_id Int? // ID of the module instance (e.g., PurchaseIntake ID)
|
|
2319
2072
|
activity_type String? // e.g., "created", "updated", "deleted"
|
|
@@ -2530,6 +2283,7 @@ model FiscalYear {
|
|
|
2530
2283
|
}
|
|
2531
2284
|
|
|
2532
2285
|
//------------------------------------- FISCAL YEAR MODEL END --------------------------------------------
|
|
2286
|
+
|
|
2533
2287
|
//------------------------------------- BUDGET MODEL START --------------------------------------------
|
|
2534
2288
|
enum BudgetStatus {
|
|
2535
2289
|
WARNING
|
|
@@ -2669,3 +2423,26 @@ model Expense {
|
|
|
2669
2423
|
}
|
|
2670
2424
|
|
|
2671
2425
|
//------------------------------------- EXPENSE MODEL END ----------------------------------------------
|
|
2426
|
+
|
|
2427
|
+
//------------------------------------- VENDOR REFERENCE MODEL START ------------------------------------------
|
|
2428
|
+
|
|
2429
|
+
model VendorReference {
|
|
2430
|
+
id Int @id @default(autoincrement())
|
|
2431
|
+
global_vendor_id Int? // reference id from global vendor
|
|
2432
|
+
tenant_vendor_code String? // reference id from tenant vendor
|
|
2433
|
+
invited_by Int? // who invited the vendor to the tenant
|
|
2434
|
+
user User? @relation(fields: [invited_by], references: [id], onDelete: Cascade)
|
|
2435
|
+
invited_on DateTime?
|
|
2436
|
+
meta_data Json? // Additional metadata about the vendor
|
|
2437
|
+
is_deleted Boolean @default(false)
|
|
2438
|
+
created_at DateTime @default(now())
|
|
2439
|
+
created_by Int?
|
|
2440
|
+
updated_at DateTime @updatedAt
|
|
2441
|
+
updated_by Int?
|
|
2442
|
+
deleted_at DateTime?
|
|
2443
|
+
deleted_by Int?
|
|
2444
|
+
|
|
2445
|
+
@@map("vendor_references")
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
//------------------------------------- VENDOR REFERENCE MODEL END --------------------------------------------
|