procbay-schema 1.0.26 → 1.0.28
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/migrations/20250909084050_init_catalogue_vendor_table/migration.sql +0 -0
- package/prisma/migrations/20250909121726_alter_requested_catalogue_detail_status/migration.sql +0 -0
- package/prisma/migrations/20250909125931_giot_push/migration.sql +0 -0
- package/prisma/migrations/20250911110904_alter_catalogue_vendor_table/migration.sql +12 -0
- package/prisma/migrations/20250916063938_init_catalogue_cart_table/migration.sql +58 -0
- package/prisma/schema.prisma +52 -4
- package/src/prisma/edge.js +34 -4
- package/src/prisma/index-browser.js +31 -1
- package/src/prisma/index.d.ts +5888 -617
- package/src/prisma/index.js +34 -4
- package/src/prisma/package.json +1 -1
- package/src/prisma/schema.prisma +52 -4
- package/src/prisma/wasm.js +31 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "procbay-schema",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
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
|
package/prisma/migrations/20250909121726_alter_requested_catalogue_detail_status/migration.sql
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE "catalogue_vendor" ADD COLUMN "item_id" INTEGER,
|
|
3
|
+
ADD COLUMN "variant_id" INTEGER;
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
|
|
7
|
+
|
|
8
|
+
-- AddForeignKey
|
|
9
|
+
ALTER TABLE "catalogue_vendor" ADD CONSTRAINT "catalogue_vendor_item_id_fkey" FOREIGN KEY ("item_id") REFERENCES "item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
10
|
+
|
|
11
|
+
-- AddForeignKey
|
|
12
|
+
ALTER TABLE "catalogue_vendor" ADD CONSTRAINT "catalogue_vendor_variant_id_fkey" FOREIGN KEY ("variant_id") REFERENCES "item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "PurchaseIntakeTypeEnum" AS ENUM ('PURCHASE_INTAKE', 'FAST_CATALOGUE');
|
|
3
|
+
|
|
4
|
+
-- AlterTable
|
|
5
|
+
ALTER TABLE "export_logs" ALTER COLUMN "expires_at" SET DEFAULT NOW() + INTERVAL '7 days';
|
|
6
|
+
|
|
7
|
+
-- AlterTable
|
|
8
|
+
ALTER TABLE "purchase_intakes" ADD COLUMN "type" "PurchaseIntakeTypeEnum" NOT NULL DEFAULT 'PURCHASE_INTAKE';
|
|
9
|
+
|
|
10
|
+
-- AlterTable
|
|
11
|
+
ALTER TABLE "purchase_intakes_items" ADD COLUMN "price" DECIMAL(10,2) DEFAULT 0.00,
|
|
12
|
+
ADD COLUMN "vendor_id" INTEGER;
|
|
13
|
+
|
|
14
|
+
-- CreateTable
|
|
15
|
+
CREATE TABLE "catalogue_cart" (
|
|
16
|
+
"id" SERIAL NOT NULL,
|
|
17
|
+
"uuid" TEXT NOT NULL,
|
|
18
|
+
"user_id" INTEGER,
|
|
19
|
+
"vendor_id" INTEGER,
|
|
20
|
+
"item_id" INTEGER,
|
|
21
|
+
"variant_id" INTEGER,
|
|
22
|
+
"quantity" INTEGER,
|
|
23
|
+
"price" DECIMAL(15,2),
|
|
24
|
+
"total_price" DECIMAL(15,2),
|
|
25
|
+
"created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
|
|
26
|
+
"created_by" INTEGER,
|
|
27
|
+
"updated_at" TIMESTAMPTZ(6),
|
|
28
|
+
"updated_by" INTEGER,
|
|
29
|
+
"is_deleted" BOOLEAN DEFAULT false,
|
|
30
|
+
"deleted_at" TIMESTAMPTZ(6),
|
|
31
|
+
"deleted_by" INTEGER,
|
|
32
|
+
|
|
33
|
+
CONSTRAINT "catalogue_cart_pkey" PRIMARY KEY ("id")
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
-- CreateIndex
|
|
37
|
+
CREATE UNIQUE INDEX "catalogue_cart_uuid_key" ON "catalogue_cart"("uuid");
|
|
38
|
+
|
|
39
|
+
-- CreateIndex
|
|
40
|
+
CREATE INDEX "catalogue_cart_user_id_idx" ON "catalogue_cart"("user_id");
|
|
41
|
+
|
|
42
|
+
-- CreateIndex
|
|
43
|
+
CREATE INDEX "catalogue_cart_item_id_idx" ON "catalogue_cart"("item_id");
|
|
44
|
+
|
|
45
|
+
-- CreateIndex
|
|
46
|
+
CREATE INDEX "catalogue_cart_variant_id_idx" ON "catalogue_cart"("variant_id");
|
|
47
|
+
|
|
48
|
+
-- CreateIndex
|
|
49
|
+
CREATE INDEX "catalogue_cart_vendor_id_idx" ON "catalogue_cart"("vendor_id");
|
|
50
|
+
|
|
51
|
+
-- AddForeignKey
|
|
52
|
+
ALTER TABLE "catalogue_cart" ADD CONSTRAINT "catalogue_cart_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
53
|
+
|
|
54
|
+
-- AddForeignKey
|
|
55
|
+
ALTER TABLE "catalogue_cart" ADD CONSTRAINT "catalogue_cart_item_id_fkey" FOREIGN KEY ("item_id") REFERENCES "item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
56
|
+
|
|
57
|
+
-- AddForeignKey
|
|
58
|
+
ALTER TABLE "catalogue_cart" ADD CONSTRAINT "catalogue_cart_variant_id_fkey" FOREIGN KEY ("variant_id") REFERENCES "item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
|
@@ -98,6 +98,7 @@ model User {
|
|
|
98
98
|
department_head Department[] @relation("department_head")
|
|
99
99
|
budget_manager Department[] @relation("budget_manager")
|
|
100
100
|
vendor_reference VendorReference[]
|
|
101
|
+
catalogue_cart CatalogueCart[]
|
|
101
102
|
|
|
102
103
|
@@map("users")
|
|
103
104
|
}
|
|
@@ -390,8 +391,12 @@ model Item {
|
|
|
390
391
|
purchase_order_items PurchaseOrderItem[]
|
|
391
392
|
requested_catalogue_items RequestedCatalogueDetails[] @relation("ParentItemRequests")
|
|
392
393
|
requested_catalogue_variants RequestedCatalogueDetails[] @relation("VariantItemRequests")
|
|
393
|
-
catalogue_items Catalogue[] @relation("
|
|
394
|
-
catalogue_variants Catalogue[] @relation("
|
|
394
|
+
catalogue_items Catalogue[] @relation("ParentItemCatalogue")
|
|
395
|
+
catalogue_variants Catalogue[] @relation("VariantItemCatalogue")
|
|
396
|
+
catalogue_vendor_items CatalogueVendor[] @relation("ParentItemCatalogueVendor")
|
|
397
|
+
catalogue_vendor_variants CatalogueVendor[] @relation("VariantItemCatalogueVendor")
|
|
398
|
+
catalogue_cart_items CatalogueCart[] @relation("ParentItemCatalogueCart")
|
|
399
|
+
catalogue_cart_variants CatalogueCart[] @relation("VariantItemCatalogueCart")
|
|
395
400
|
|
|
396
401
|
@@unique([item_handler, item_name])
|
|
397
402
|
@@index([parent_id, is_active, is_deleted]) // For variant queries
|
|
@@ -439,6 +444,11 @@ enum PurchaseRequestStatusEnum {
|
|
|
439
444
|
Rejected
|
|
440
445
|
}
|
|
441
446
|
|
|
447
|
+
enum PurchaseIntakeTypeEnum {
|
|
448
|
+
PURCHASE_INTAKE
|
|
449
|
+
FAST_CATALOGUE
|
|
450
|
+
}
|
|
451
|
+
|
|
442
452
|
model PurchaseIntake {
|
|
443
453
|
id Int @id @default(autoincrement())
|
|
444
454
|
uuid String? @unique @default(uuid())
|
|
@@ -446,6 +456,7 @@ model PurchaseIntake {
|
|
|
446
456
|
pr_number String? @unique
|
|
447
457
|
requestor_id Int?
|
|
448
458
|
user User? @relation(fields: [requestor_id], references: [id], onDelete: Cascade)
|
|
459
|
+
type PurchaseIntakeTypeEnum @default(PURCHASE_INTAKE)
|
|
449
460
|
department String?
|
|
450
461
|
request_date DateTime? @default(now()) @db.Timestamptz(6)
|
|
451
462
|
items_or_services_description String?
|
|
@@ -498,11 +509,13 @@ model PurchaseIntakeItem {
|
|
|
498
509
|
purchase_intake PurchaseIntake? @relation(fields: [purchase_intakes_id], references: [id], onDelete: Cascade)
|
|
499
510
|
item_id Int?
|
|
500
511
|
items Item? @relation(fields: [item_id], references: [id], onDelete: Cascade)
|
|
512
|
+
vendor_id Int?
|
|
501
513
|
quantity Int?
|
|
502
514
|
initial_quantity Int?
|
|
503
515
|
open_quantity Int?
|
|
504
516
|
closed_quantity Int? @default(0)
|
|
505
517
|
unit_of_measurement String?
|
|
518
|
+
price Decimal? @default(0.00) @db.Decimal(10, 2)
|
|
506
519
|
location_id Int?
|
|
507
520
|
location Location? @relation(fields: [location_id], references: [id], onDelete: Cascade)
|
|
508
521
|
status PurchaseIntakeItemEnum @default(Open)
|
|
@@ -2555,9 +2568,9 @@ model Catalogue {
|
|
|
2555
2568
|
uuid String @unique @default(uuid())
|
|
2556
2569
|
req_catalogue_id Int?
|
|
2557
2570
|
item_id Int?
|
|
2558
|
-
parent_item Item? @relation("
|
|
2571
|
+
parent_item Item? @relation("ParentItemCatalogue", fields: [item_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
2559
2572
|
variant_id Int?
|
|
2560
|
-
variant Item? @relation("
|
|
2573
|
+
variant Item? @relation("VariantItemCatalogue", fields: [variant_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
2561
2574
|
status CatalogueStatusEnum @default(ACTIVE)
|
|
2562
2575
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
2563
2576
|
created_by Int?
|
|
@@ -2588,6 +2601,10 @@ model CatalogueVendor {
|
|
|
2588
2601
|
uuid String @unique @default(uuid())
|
|
2589
2602
|
catalogue_id Int?
|
|
2590
2603
|
catalogue Catalogue? @relation(fields: [catalogue_id], references: [id], onDelete: Cascade)
|
|
2604
|
+
item_id Int?
|
|
2605
|
+
parent_item Item? @relation("ParentItemCatalogueVendor", fields: [item_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
2606
|
+
variant_id Int?
|
|
2607
|
+
variant Item? @relation("VariantItemCatalogueVendor", fields: [variant_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
2591
2608
|
vendor_id Int?
|
|
2592
2609
|
stock Int?
|
|
2593
2610
|
price Decimal? @db.Decimal(15, 2)
|
|
@@ -2606,3 +2623,34 @@ model CatalogueVendor {
|
|
|
2606
2623
|
}
|
|
2607
2624
|
|
|
2608
2625
|
//---------------------------------- CATALOGUE VENDOR MODEL END ---------------------------------------
|
|
2626
|
+
//---------------------------------- CATALOGUE CART MODEL START ---------------------------------------
|
|
2627
|
+
|
|
2628
|
+
model CatalogueCart {
|
|
2629
|
+
id Int @id @default(autoincrement())
|
|
2630
|
+
uuid String @unique @default(uuid())
|
|
2631
|
+
user_id Int?
|
|
2632
|
+
user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
2633
|
+
vendor_id Int?
|
|
2634
|
+
item_id Int?
|
|
2635
|
+
item Item? @relation("ParentItemCatalogueCart", fields: [item_id], references: [id], onDelete: Cascade)
|
|
2636
|
+
variant_id Int?
|
|
2637
|
+
variant Item? @relation("VariantItemCatalogueCart", fields: [variant_id], references: [id], onDelete: Cascade)
|
|
2638
|
+
quantity Int?
|
|
2639
|
+
price Decimal? @db.Decimal(15, 2)
|
|
2640
|
+
total_price Decimal? @db.Decimal(15, 2)
|
|
2641
|
+
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
2642
|
+
created_by Int?
|
|
2643
|
+
updated_at DateTime? @updatedAt @db.Timestamptz(6)
|
|
2644
|
+
updated_by Int?
|
|
2645
|
+
is_deleted Boolean? @default(false)
|
|
2646
|
+
deleted_at DateTime? @db.Timestamptz(6)
|
|
2647
|
+
deleted_by Int?
|
|
2648
|
+
|
|
2649
|
+
@@index([user_id])
|
|
2650
|
+
@@index([item_id])
|
|
2651
|
+
@@index([variant_id])
|
|
2652
|
+
@@index([vendor_id])
|
|
2653
|
+
@@map("catalogue_cart")
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
//---------------------------------- CATALOGUE CART MODEL END ---------------------------------------
|