procbay-schema 1.0.165 → 1.0.166

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.165",
3
+ "version": "1.0.166",
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",
@@ -0,0 +1,55 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the `user_approval_management` table. If the table is not empty, all the data it contains will be lost.
5
+
6
+ */
7
+ -- CreateEnum
8
+ CREATE TYPE "ApprovalManagementStatusEnum" AS ENUM ('PENDING', 'APPROVED', 'REJECTED');
9
+
10
+ -- DropForeignKey
11
+ ALTER TABLE "user_approval_management" DROP CONSTRAINT "user_approval_management_user_id_fkey";
12
+
13
+ -- DropTable
14
+ DROP TABLE "user_approval_management";
15
+
16
+ -- DropEnum
17
+ DROP TYPE "UserApprovalManagementStatusEnum";
18
+
19
+ -- CreateTable
20
+ CREATE TABLE "approval_management" (
21
+ "id" SERIAL NOT NULL,
22
+ "uuid" TEXT NOT NULL,
23
+ "journy_type" TEXT,
24
+ "journey_task" TEXT,
25
+ "parent_id" TEXT,
26
+ "user_id" INTEGER,
27
+ "proposed_payload" JSONB,
28
+ "previous_snapshot" JSONB,
29
+ "estimated_budget" DECIMAL(18,2),
30
+ "batch_id" TEXT,
31
+ "request_status" "ApprovalManagementStatusEnum" NOT NULL DEFAULT 'PENDING',
32
+ "reject_reason" TEXT,
33
+ "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
34
+ "created_by" INTEGER,
35
+
36
+ CONSTRAINT "approval_management_pkey" PRIMARY KEY ("id")
37
+ );
38
+
39
+ -- CreateIndex
40
+ CREATE UNIQUE INDEX "approval_management_uuid_key" ON "approval_management"("uuid");
41
+
42
+ -- CreateIndex
43
+ CREATE INDEX "approval_management_parent_id_idx" ON "approval_management"("parent_id");
44
+
45
+ -- CreateIndex
46
+ CREATE INDEX "approval_management_journy_type_journey_task_idx" ON "approval_management"("journy_type", "journey_task");
47
+
48
+ -- CreateIndex
49
+ CREATE INDEX "approval_management_batch_id_idx" ON "approval_management"("batch_id");
50
+
51
+ -- CreateIndex
52
+ CREATE INDEX "approval_management_request_status_idx" ON "approval_management"("request_status");
53
+
54
+ -- AddForeignKey
55
+ ALTER TABLE "approval_management" ADD CONSTRAINT "approval_management_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -123,7 +123,7 @@ model User {
123
123
  message_recipients MessageRecipient[] @relation("MessageRecipientUser")
124
124
  blanket_po BlanketPurchaseOrder[]
125
125
  purchase_intake_initiated_by PurchaseIntake[] @relation("purchase_intake_initiated_by")
126
- user_approval_managements UserApprovalManagement[]
126
+ approval_management ApprovalManagement[]
127
127
 
128
128
  @@map("users")
129
129
  }
@@ -3783,29 +3783,36 @@ model InvoiceItem {
3783
3783
 
3784
3784
  // ------------------------------------ INVOICE ITEM MODEL END ------------------------------------
3785
3785
 
3786
- // ------------------------------------ USER APPROVAL MANAGEMENT MODEL START ---------------------------
3786
+ // ------------------------------------ APPROVAL MANAGEMENT MODEL START --------------------------------
3787
3787
 
3788
- enum UserApprovalManagementStatusEnum {
3788
+ enum ApprovalManagementStatusEnum {
3789
3789
  PENDING
3790
3790
  APPROVED
3791
3791
  REJECTED
3792
3792
  }
3793
- model UserApprovalManagement {
3794
- id Int @id @default(autoincrement())
3795
- uuid String @unique @default(uuid())
3796
- user_id Int?
3797
- user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
3798
- batch_id String?
3799
- task_type String?
3800
- proposed_payload Json?
3801
- previous_snapshot Json?
3802
- request_status UserApprovalManagementStatusEnum @default(PENDING)
3803
- reject_reason String?
3804
- created_at DateTime @default(now()) @db.Timestamptz(6)
3805
- created_by Int?
3806
3793
 
3807
- @@map("user_approval_management")
3808
- }
3794
+ model ApprovalManagement {
3795
+ id Int @id @default(autoincrement())
3796
+ uuid String @unique @default(uuid())
3797
+ journy_type String? // module e.g. user-management, event-management
3798
+ journey_task String? // task e.g. user-updation-approval, event-bid-award-approval
3799
+ parent_id String? // parent entity uuid (user, event, PI, etc.)
3800
+ user_id Int? // optional when subject is a user
3801
+ user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
3802
+ proposed_payload Json?
3803
+ previous_snapshot Json?
3804
+ estimated_budget Decimal? @db.Decimal(18, 2)
3805
+ batch_id String?
3806
+ request_status ApprovalManagementStatusEnum @default(PENDING)
3807
+ reject_reason String?
3808
+ created_at DateTime @default(now()) @db.Timestamptz(6)
3809
+ created_by Int?
3809
3810
 
3810
- // ------------------------------------ USER APPROVAL MANAGEMENT MODEL END ---------------------------
3811
+ @@index([parent_id])
3812
+ @@index([journy_type, journey_task])
3813
+ @@index([batch_id])
3814
+ @@index([request_status])
3815
+ @@map("approval_management")
3816
+ }
3811
3817
 
3818
+ // ------------------------------------ APPROVAL MANAGEMENT MODEL END ----------------------------------
@@ -568,7 +568,7 @@ export type Invoice = Prisma.InvoiceModel
568
568
  */
569
569
  export type InvoiceItem = Prisma.InvoiceItemModel
570
570
  /**
571
- * Model UserApprovalManagement
571
+ * Model ApprovalManagement
572
572
  *
573
573
  */
574
- export type UserApprovalManagement = Prisma.UserApprovalManagementModel
574
+ export type ApprovalManagement = Prisma.ApprovalManagementModel