procbay-schema 1.0.51 → 1.0.52

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.51",
3
+ "version": "1.0.52",
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,37 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "SendBackIntakeStatusEnum" AS ENUM ('PENDING', 'ACCEPTED', 'COUNTERED', 'REJECTED');
3
+
4
+ -- CreateEnum
5
+ CREATE TYPE "SendBackApproverStatusEnum" AS ENUM ('PENDING', 'ACCEPTED', 'COUNTERED', 'REJECTED');
6
+
7
+ -- AlterTable
8
+ ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
9
+
10
+ -- AlterTable
11
+ ALTER TABLE "purchase_intakes" ADD COLUMN "send_back_count" INTEGER;
12
+
13
+ -- AlterTable
14
+ ALTER TABLE "purchase_intakes_items" ADD COLUMN "send_back_approver_status" "SendBackApproverStatusEnum" NOT NULL DEFAULT 'PENDING',
15
+ ADD COLUMN "send_back_intake_status" "SendBackIntakeStatusEnum" NOT NULL DEFAULT 'PENDING';
16
+
17
+ -- CreateTable
18
+ CREATE TABLE "send_backs" (
19
+ "id" SERIAL NOT NULL,
20
+ "uuid" TEXT,
21
+ "purchase_intake_id" INTEGER,
22
+ "item_json" JSONB,
23
+ "send_back_reason" TEXT,
24
+ "send_back_approver_id" INTEGER,
25
+ "created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
26
+
27
+ CONSTRAINT "send_backs_pkey" PRIMARY KEY ("id")
28
+ );
29
+
30
+ -- CreateIndex
31
+ CREATE UNIQUE INDEX "send_backs_uuid_key" ON "send_backs"("uuid");
32
+
33
+ -- AddForeignKey
34
+ ALTER TABLE "send_backs" ADD CONSTRAINT "send_backs_purchase_intake_id_fkey" FOREIGN KEY ("purchase_intake_id") REFERENCES "purchase_intakes"("id") ON DELETE CASCADE ON UPDATE CASCADE;
35
+
36
+ -- AddForeignKey
37
+ ALTER TABLE "send_backs" ADD CONSTRAINT "send_backs_send_back_approver_id_fkey" FOREIGN KEY ("send_back_approver_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -99,6 +99,7 @@ model User {
99
99
  budget_manager Department[] @relation("budget_manager")
100
100
  vendor_reference VendorReference[]
101
101
  catalogue_cart CatalogueCart[]
102
+ send_backs SendBack[]
102
103
 
103
104
  @@map("users")
104
105
  }
@@ -470,6 +471,7 @@ model PurchaseIntake {
470
471
  attachments Json?
471
472
  if_yes_attach_quotations Json?
472
473
  others Json?
474
+ send_back_count Int?
473
475
  is_active Boolean @default(true)
474
476
  created_at DateTime @default(now()) @db.Timestamptz(6)
475
477
  created_by Int?
@@ -484,6 +486,7 @@ model PurchaseIntake {
484
486
  events Event[]
485
487
  event_items EventItems[]
486
488
  purchase_order_items PurchaseOrderItem[]
489
+ send_backs SendBack[]
487
490
 
488
491
  @@map("purchase_intakes")
489
492
  }
@@ -503,30 +506,64 @@ enum PurchaseIntakeItemEnum {
503
506
  Rejected
504
507
  }
505
508
 
509
+ enum SendBackIntakeStatusEnum {
510
+ PENDING
511
+ ACCEPTED
512
+ COUNTERED
513
+ REJECTED
514
+ }
515
+
516
+ enum SendBackApproverStatusEnum {
517
+ PENDING
518
+ ACCEPTED
519
+ COUNTERED
520
+ REJECTED
521
+ }
522
+
506
523
  model PurchaseIntakeItem {
507
- id Int @id @default(autoincrement())
508
- uuid String? @unique @default(uuid())
509
- purchase_intakes_id Int?
510
- purchase_intake PurchaseIntake? @relation(fields: [purchase_intakes_id], references: [id], onDelete: Cascade)
511
- item_id Int?
512
- items Item? @relation(fields: [item_id], references: [id], onDelete: Cascade)
513
- vendor_id Int?
514
- quantity Int?
515
- initial_quantity Int?
516
- open_quantity Int?
517
- closed_quantity Int? @default(0)
518
- unit_of_measurement String?
519
- price Decimal? @default(0.00) @db.Decimal(10, 2)
520
- location_id Int?
521
- location Location? @relation(fields: [location_id], references: [id], onDelete: Cascade)
522
- status PurchaseIntakeItemEnum @default(Open)
523
- created_at DateTime @default(now()) @db.Timestamptz(6)
524
+ id Int @id @default(autoincrement())
525
+ uuid String? @unique @default(uuid())
526
+ purchase_intakes_id Int?
527
+ purchase_intake PurchaseIntake? @relation(fields: [purchase_intakes_id], references: [id], onDelete: Cascade)
528
+ item_id Int?
529
+ items Item? @relation(fields: [item_id], references: [id], onDelete: Cascade)
530
+ vendor_id Int?
531
+ quantity Int?
532
+ initial_quantity Int?
533
+ open_quantity Int?
534
+ closed_quantity Int? @default(0)
535
+ unit_of_measurement String?
536
+ price Decimal? @default(0.00) @db.Decimal(10, 2)
537
+ location_id Int?
538
+ location Location? @relation(fields: [location_id], references: [id], onDelete: Cascade)
539
+ status PurchaseIntakeItemEnum @default(Open)
540
+ send_back_intake_status SendBackIntakeStatusEnum @default(PENDING)
541
+ send_back_approver_status SendBackApproverStatusEnum @default(PENDING)
542
+ created_at DateTime @default(now()) @db.Timestamptz(6)
524
543
 
525
544
  @@map("purchase_intakes_items")
526
545
  }
527
546
 
528
547
  //---------------------------------- PURCHASEINTAKESITEMS MODEL END ----------------------------------
529
548
 
549
+ //---------------------------------- SEND BACK MODEL END ---------------------------------------
550
+
551
+ model SendBack {
552
+ id Int @id @default(autoincrement())
553
+ uuid String? @unique @default(uuid())
554
+ purchase_intake_id Int?
555
+ purchase_intake PurchaseIntake? @relation(fields: [purchase_intake_id], references: [id], onDelete: Cascade)
556
+ item_json Json? @db.JsonB
557
+ send_back_reason String?
558
+ send_back_approver_id Int?
559
+ send_back_approver User? @relation(fields: [send_back_approver_id], references: [id], onDelete: Cascade)
560
+ created_at DateTime @default(now()) @db.Timestamptz(6)
561
+
562
+ @@map("send_backs")
563
+ }
564
+
565
+ //---------------------------------- SEND BACK MODEL END ---------------------------------------
566
+
530
567
  //---------------------------------- EMAILTEMPLATE MODEL END ------------------------------------------------
531
568
  model EmailTemplate {
532
569
  id Int @id @default(autoincrement())