procbay-schema 1.0.3 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "procbay-schema",
3
- "version": "1.0.3",
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",
File without changes
@@ -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";
@@ -0,0 +1,5 @@
1
+ -- AlterTable
2
+ ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "vendor_references" ADD COLUMN "meta_data" JSONB;
@@ -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[]
@@ -256,7 +254,6 @@ model Category {
256
254
  deleted_by Int?
257
255
  deleted_at DateTime? @db.Timestamptz(6)
258
256
  attributes Attribute[]
259
- vendor_categories VendorCategory[]
260
257
  Item Item[]
261
258
  category_uom UomCategory[]
262
259
  category_budget CategoryBudget[]
@@ -507,125 +504,6 @@ model PurchaseIntakeItem {
507
504
 
508
505
  //---------------------------------- PURCHASEINTAKESITEMS MODEL END ----------------------------------
509
506
 
510
- //---------------------------------- VENDOR MODEL START ------------------------------------------------
511
-
512
- model Vendor {
513
- id Int @id @default(autoincrement())
514
- uuid String? @unique @default(uuid())
515
- vendor_id String? @unique
516
- name String?
517
- legal_name String?
518
- email_id String? @unique
519
- mobile_number String? @unique
520
- password String?
521
- country_code String?
522
- gst_in String?
523
- person_in_charge String?
524
- city String?
525
- industry String?
526
- incorporation_date DateTime? @db.Timestamptz(6)
527
- ownership_type String?
528
- head_office_location String?
529
- operational_region Json?
530
- pan_number String?
531
- pan_image String?
532
- is_pan_verified Boolean? @default(false)
533
- pan_verification_request String?
534
- pan_verification_response String?
535
- gst_number String?
536
- is_gst_verified Boolean? @default(false)
537
- gst_verification_request String?
538
- gst_verification_response String?
539
- is_basic_info_registered Boolean? @default(false)
540
- status StatusEnum @default(InActive)
541
- is_email_verified Boolean @default(false)
542
- is_mobile_verified Boolean @default(false)
543
- profile_picture String?
544
- invitation_status Boolean @default(false)
545
- reset_token String?
546
- reset_token_expiry DateTime? @db.Timestamptz(6)
547
- access_token_expiry String?
548
- token_version Int? @default(0) // This will be used to invalidate old refresh tokens
549
- is_logged_in Boolean @default(false)
550
- onboarded_on DateTime? @db.Timestamptz(6)
551
- created_at DateTime @default(now()) @db.Timestamptz(6)
552
- created_by Int?
553
- updated_at DateTime? @updatedAt @db.Timestamptz(6)
554
- updated_by Int?
555
- is_deleted Boolean @default(false)
556
- deleted_at DateTime? @db.Timestamptz(6)
557
- deleted_by Int?
558
- is_kyc_approved VendorKycVerificationStatusEnum @default(PENDING)
559
- vendor_categories VendorCategory[]
560
- vendor_contact_persons VendorContactPerson[]
561
- event_vendors EventVendors[]
562
- vendor_kyc_info VendorKycInfo[]
563
- support_tickets SupportTicket[]
564
- ticket_replies TicketReply[] @relation("vendor_reply")
565
- vendor_status VendorStatus[]
566
- vendor_event_watchlist VendorEventWatchlist[]
567
- vendor_kyc_verification_status VendorKycInfoVerificationStatus[]
568
- vendor_alerts VendorAlert[]
569
- purchase_order_activity_log PurchaseOrderActivityLog[]
570
- vendor_socket_tokens UserVendorSocketTokens[]
571
- activity_logs ActivityLog[]
572
-
573
- @@map("vendors")
574
- }
575
-
576
- //---------------------------------- VENDOR MODEL END ------------------------------------------------
577
-
578
- //---------------------------------- VENDOR CATEGORY MODEL START ------------------------------------------------
579
- model VendorCategory {
580
- id Int @id @default(autoincrement())
581
- uuid String? @unique @default(uuid())
582
- vendor_id Int
583
- vendor Vendor @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
584
- category_id Int
585
- category Category @relation(fields: [category_id], references: [id], onDelete: Cascade)
586
- created_at DateTime @default(now()) @db.Timestamptz(6)
587
- created_by Int?
588
- updated_at DateTime? @updatedAt @db.Timestamptz(6)
589
- updated_by Int?
590
- deleted_at DateTime? @db.Timestamptz(6)
591
- deleted_by Int?
592
-
593
- @@map("vendor_categories")
594
- }
595
-
596
- //---------------------------------- VENDOR CATEGORY MODEL END ------------------------------------------------
597
-
598
- //---------------------------------- VENDOR CONTACT PERSON MODEL START ------------------------------------------------
599
- enum ContactTypeEnum {
600
- Primary
601
- Secondary
602
- }
603
-
604
- model VendorContactPerson {
605
- id Int @id @default(autoincrement())
606
- uuid String? @unique @default(uuid())
607
- vendor_id Int
608
- vendor Vendor @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
609
- name String?
610
- email_id String?
611
- country_code String?
612
- mobile_number String?
613
- designation String?
614
- contact_type ContactTypeEnum @default(Primary)
615
- is_active Boolean @default(true)
616
- is_deleted Boolean @default(false)
617
- created_at DateTime @default(now()) @db.Timestamptz(6)
618
- created_by Int?
619
- updated_at DateTime? @updatedAt @db.Timestamptz(6)
620
- updated_by Int?
621
- deleted_at DateTime? @db.Timestamptz(6)
622
- deleted_by Int?
623
-
624
- @@map("vendor_contact_persons")
625
- }
626
-
627
- //---------------------------------- VENDOR CONTACT PERSON MODEL END ------------------------------------------------
628
-
629
507
  //---------------------------------- EMAILTEMPLATE MODEL END ------------------------------------------------
630
508
  model EmailTemplate {
631
509
  id Int @id @default(autoincrement())
@@ -1134,7 +1012,6 @@ model Event {
1134
1012
  event_vendors EventVendors[]
1135
1013
  event_configurations EventConfigurations[]
1136
1014
  event_strategies EventStrategies[]
1137
- vendor_event_watchlist VendorEventWatchlist[]
1138
1015
  bids Bid[]
1139
1016
  bid_logs BidLog[]
1140
1017
  quotations Quotation[]
@@ -1207,7 +1084,6 @@ model EventVendors {
1207
1084
  id Int @id @default(autoincrement())
1208
1085
  uuid String? @unique @default(uuid())
1209
1086
  vendor_id Int?
1210
- vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1211
1087
  event_id Int?
1212
1088
  event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1213
1089
  is_active Boolean? @default(true)
@@ -1284,29 +1160,6 @@ model EventStrategies {
1284
1160
 
1285
1161
  //---------------------------------- EVENTS STRATEGIES MODEL END ------------------------------------------------
1286
1162
 
1287
- //---------------------------------- VENDOR EVENTS WATCHLIST MODEL START ------------------------------------------------
1288
-
1289
- model VendorEventWatchlist {
1290
- id Int @id @default(autoincrement())
1291
- uuid String? @unique @default(uuid())
1292
- vendor_id Int?
1293
- vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1294
- event_id Int?
1295
- event Event? @relation(fields: [event_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
1296
- is_active Boolean? @default(true)
1297
- created_at DateTime? @default(now()) @db.Timestamptz(6)
1298
- created_by Int?
1299
- updated_at DateTime? @updatedAt @db.Timestamptz(6)
1300
- updated_by Int?
1301
- is_deleted Boolean? @default(false)
1302
- deleted_at DateTime? @db.Timestamptz(6)
1303
- deleted_by Int?
1304
-
1305
- @@map("vendor_event_watchlist")
1306
- }
1307
-
1308
- //---------------------------------- VENDOR EVENTS MODEL END ------------------------------------------------
1309
-
1310
1163
  //---------------------------------- STRATEGIES MODEL START ------------------------------------------------
1311
1164
 
1312
1165
  model Strategies {
@@ -1359,40 +1212,6 @@ model Cms {
1359
1212
 
1360
1213
  /////////////////////////////////// END CMS SCHEMA //////////////////////////////
1361
1214
 
1362
- //---------------------------------- VENDOR KYC INFO MODEL START ------------------------------------------------
1363
-
1364
- enum VendorKycStatusEnum {
1365
- PENDING
1366
- APPROVED
1367
- REJECTED
1368
- }
1369
-
1370
- model VendorKycInfo {
1371
- id Int @id @default(autoincrement())
1372
- uuid String? @unique @default(uuid())
1373
- vendor_id Int?
1374
- vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
1375
- section_name String?
1376
- section_type String?
1377
- fields Json?
1378
- status VendorKycStatusEnum @default(PENDING)
1379
- reject_reason String?
1380
- is_active Boolean? @default(true)
1381
- is_deleted Boolean? @default(false)
1382
- created_at DateTime? @default(now()) @db.Timestamptz(6)
1383
- created_by Int?
1384
- updated_at DateTime? @updatedAt @db.Timestamptz(6)
1385
- updated_by Int?
1386
- deleted_at DateTime? @db.Timestamptz(6)
1387
- deleted_by Int?
1388
- vendor_kyc_verification_status VendorKycInfoVerificationStatus[]
1389
-
1390
- @@unique([vendor_id, section_type])
1391
- @@map("vendor_kyc_info")
1392
- }
1393
-
1394
- //---------------------------------- VENDOR KYC INFO MODEL END ------------------------------------------------
1395
-
1396
1215
  //---------------------------------- CURRENCY MODEL START ------------------------------------------------
1397
1216
 
1398
1217
  model Currency {
@@ -1444,7 +1263,6 @@ model SupportTicket {
1444
1263
  uuid String? @unique @default(uuid())
1445
1264
  ticket_code String? @unique
1446
1265
  vendor_id Int?
1447
- vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
1448
1266
  subject String?
1449
1267
  category_id Int?
1450
1268
  category SupportCategory? @relation(fields: [category_id], references: [id], onDelete: Cascade)
@@ -1505,7 +1323,6 @@ model TicketReply {
1505
1323
  user_id Int? // User who replied
1506
1324
  user User? @relation("user_reply", fields: [user_id], references: [id], onDelete: Cascade)
1507
1325
  vendor_id Int? // Vendor who replied
1508
- vendor Vendor? @relation("vendor_reply", fields: [vendor_id], references: [id], onDelete: Cascade)
1509
1326
  message String?
1510
1327
  created_at DateTime @default(now()) @db.Timestamptz(6)
1511
1328
 
@@ -1538,50 +1355,6 @@ model SupportCategory {
1538
1355
 
1539
1356
  //---------------------------------- SUPPORT CATEGORY MODEL END ------------------------------------------------
1540
1357
 
1541
- //---------------------------------- VENDOR STATUS MODEL START ------------------------------------------------
1542
- model VendorStatus {
1543
- id Int @id @default(autoincrement())
1544
- vendor_id Int?
1545
- vendor Vendor? @relation(fields: [vendor_id], references: [id])
1546
- previous_status StatusEnum?
1547
- current_status StatusEnum?
1548
- comment String?
1549
- updated_at DateTime? @updatedAt @db.Timestamptz(6)
1550
- updated_by Int?
1551
- updatedBy User? @relation("vendor_profile_status_updated_by", fields: [updated_by], references: [id])
1552
-
1553
- @@map("vendor_status")
1554
- }
1555
-
1556
- //---------------------------------- VENDOR STATUS MODEL END ------------------------------------------------
1557
-
1558
- //---------------------------------- VENDOR KYC INFO VERIFICATION STATUS MODEL START --------------------------------------------
1559
- enum VendorKycVerificationStatusEnum {
1560
- PENDING
1561
- APPROVED
1562
- REJECTED
1563
- IN_PROGRESS
1564
- }
1565
-
1566
- model VendorKycInfoVerificationStatus {
1567
- id Int @id @default(autoincrement())
1568
- uuid String? @unique @default(uuid())
1569
- kyc_id Int?
1570
- kyc_info VendorKycInfo? @relation(fields: [kyc_id], references: [id], onDelete: Cascade)
1571
- status VendorKycVerificationStatusEnum @default(PENDING)
1572
- reject_reason String?
1573
- created_at DateTime? @default(now()) @db.Timestamptz(6)
1574
- updated_at DateTime? @default(now()) @db.Timestamptz(6)
1575
- raised_by Int?
1576
- vendor Vendor? @relation(fields: [raised_by], references: [id], onDelete: Cascade)
1577
- approved_by Int?
1578
- user User? @relation(fields: [approved_by], references: [id], onDelete: Cascade)
1579
-
1580
- @@map("vendor_kyc_info_verification_status")
1581
- }
1582
-
1583
- //------------------------------------- VENDOR KYC INFO VERIFICATION STATUS MODEL END --------------------------------------------
1584
-
1585
1358
  //------------------------------------- ADMIN ALERTS MODEL START ------------------------------------------
1586
1359
 
1587
1360
  enum AlertTypeEnum {
@@ -1617,25 +1390,6 @@ model AdminAlert {
1617
1390
 
1618
1391
  //------------------------------------- ADMIN ALERTS MODEL END --------------------------------------------
1619
1392
 
1620
- //------------------------------------- VENDOR ALERTS MODEL START ------------------------------------------
1621
-
1622
- model VendorAlert {
1623
- id Int @id @default(autoincrement())
1624
- vendor_id Int?
1625
- vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
1626
- alert_type AlertTypeEnum?
1627
- title String?
1628
- message String?
1629
- redirect_url String?
1630
- is_read Boolean @default(false)
1631
- created_at DateTime @default(now()) @db.Timestamptz(6)
1632
- meta_data Json? @db.JsonB
1633
-
1634
- @@map("vendor_alerts")
1635
- }
1636
-
1637
- //------------------------------------- VENDOR ALERTS MODEL END --------------------------------------------
1638
-
1639
1393
  //-------------------------------------CUSTOMER NOTIFICATION MODEL START --------------------------------------------
1640
1394
 
1641
1395
  enum MediumEnum {
@@ -2276,7 +2030,6 @@ model PurchaseOrderActivityLog {
2276
2030
  user_id Int? // Could be buyer or vendor
2277
2031
  user User? @relation(fields: [user_id], references: [id], onDelete: SetNull)
2278
2032
  vendor_id Int?
2279
- vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: SetNull)
2280
2033
  activity_type POActivityType? @default(CREATED)
2281
2034
  remarks String? // Optional free text for custom remarks
2282
2035
  metadata Json? // Any additional details (file info, etc.)
@@ -2297,7 +2050,6 @@ model UserVendorSocketTokens {
2297
2050
  user_id Int?
2298
2051
  user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
2299
2052
  vendor_id Int?
2300
- vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
2301
2053
  socket_id String?
2302
2054
  status Boolean? @default(true)
2303
2055
  created_at DateTime @default(now()) @db.Timestamptz(6)
@@ -2315,7 +2067,6 @@ model ActivityLog {
2315
2067
  user_id Int?
2316
2068
  user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
2317
2069
  vendor_id Int?
2318
- vendor Vendor? @relation(fields: [vendor_id], references: [id], onDelete: Cascade)
2319
2070
  module_name String? // e.g., "PurchaseIntake", "VendorManagement"
2320
2071
  module_id Int? // ID of the module instance (e.g., PurchaseIntake ID)
2321
2072
  activity_type String? // e.g., "created", "updated", "deleted"
@@ -2673,7 +2424,7 @@ model Expense {
2673
2424
 
2674
2425
  //------------------------------------- EXPENSE MODEL END ----------------------------------------------
2675
2426
 
2676
- //------------------------------------- VENDOR REFERENCE MODEL START --------------------------------------------
2427
+ //------------------------------------- VENDOR REFERENCE MODEL START ------------------------------------------
2677
2428
 
2678
2429
  model VendorReference {
2679
2430
  id Int @id @default(autoincrement())
@@ -2682,6 +2433,7 @@ model VendorReference {
2682
2433
  invited_by Int? // who invited the vendor to the tenant
2683
2434
  user User? @relation(fields: [invited_by], references: [id], onDelete: Cascade)
2684
2435
  invited_on DateTime?
2436
+ meta_data Json? // Additional metadata about the vendor
2685
2437
  is_deleted Boolean @default(false)
2686
2438
  created_at DateTime @default(now())
2687
2439
  created_by Int?