procbay-schema 1.0.27 → 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/20250911110904_alter_catalogue_vendor_table/migration.sql +0 -0
- package/prisma/migrations/20250916063938_init_catalogue_cart_table/migration.sql +58 -0
- package/prisma/schema.prisma +42 -0
- package/src/prisma/edge.js +32 -4
- package/src/prisma/index-browser.js +29 -1
- package/src/prisma/index.d.ts +4452 -539
- package/src/prisma/index.js +32 -4
- package/src/prisma/package.json +1 -1
- package/src/prisma/schema.prisma +42 -0
- package/src/prisma/wasm.js +29 -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
|
|
@@ -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
|
}
|
|
@@ -394,6 +395,8 @@ model Item {
|
|
|
394
395
|
catalogue_variants Catalogue[] @relation("VariantItemCatalogue")
|
|
395
396
|
catalogue_vendor_items CatalogueVendor[] @relation("ParentItemCatalogueVendor")
|
|
396
397
|
catalogue_vendor_variants CatalogueVendor[] @relation("VariantItemCatalogueVendor")
|
|
398
|
+
catalogue_cart_items CatalogueCart[] @relation("ParentItemCatalogueCart")
|
|
399
|
+
catalogue_cart_variants CatalogueCart[] @relation("VariantItemCatalogueCart")
|
|
397
400
|
|
|
398
401
|
@@unique([item_handler, item_name])
|
|
399
402
|
@@index([parent_id, is_active, is_deleted]) // For variant queries
|
|
@@ -441,6 +444,11 @@ enum PurchaseRequestStatusEnum {
|
|
|
441
444
|
Rejected
|
|
442
445
|
}
|
|
443
446
|
|
|
447
|
+
enum PurchaseIntakeTypeEnum {
|
|
448
|
+
PURCHASE_INTAKE
|
|
449
|
+
FAST_CATALOGUE
|
|
450
|
+
}
|
|
451
|
+
|
|
444
452
|
model PurchaseIntake {
|
|
445
453
|
id Int @id @default(autoincrement())
|
|
446
454
|
uuid String? @unique @default(uuid())
|
|
@@ -448,6 +456,7 @@ model PurchaseIntake {
|
|
|
448
456
|
pr_number String? @unique
|
|
449
457
|
requestor_id Int?
|
|
450
458
|
user User? @relation(fields: [requestor_id], references: [id], onDelete: Cascade)
|
|
459
|
+
type PurchaseIntakeTypeEnum @default(PURCHASE_INTAKE)
|
|
451
460
|
department String?
|
|
452
461
|
request_date DateTime? @default(now()) @db.Timestamptz(6)
|
|
453
462
|
items_or_services_description String?
|
|
@@ -500,11 +509,13 @@ model PurchaseIntakeItem {
|
|
|
500
509
|
purchase_intake PurchaseIntake? @relation(fields: [purchase_intakes_id], references: [id], onDelete: Cascade)
|
|
501
510
|
item_id Int?
|
|
502
511
|
items Item? @relation(fields: [item_id], references: [id], onDelete: Cascade)
|
|
512
|
+
vendor_id Int?
|
|
503
513
|
quantity Int?
|
|
504
514
|
initial_quantity Int?
|
|
505
515
|
open_quantity Int?
|
|
506
516
|
closed_quantity Int? @default(0)
|
|
507
517
|
unit_of_measurement String?
|
|
518
|
+
price Decimal? @default(0.00) @db.Decimal(10, 2)
|
|
508
519
|
location_id Int?
|
|
509
520
|
location Location? @relation(fields: [location_id], references: [id], onDelete: Cascade)
|
|
510
521
|
status PurchaseIntakeItemEnum @default(Open)
|
|
@@ -2612,3 +2623,34 @@ model CatalogueVendor {
|
|
|
2612
2623
|
}
|
|
2613
2624
|
|
|
2614
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 ---------------------------------------
|