procbay-schema 1.0.63 → 1.0.65
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/json/core-data/departments.json +1 -0
- package/prisma/migrations/20251031061927_init/migration.sql +0 -0
- package/prisma/migrations/20251103094558_added_user_envirnoment_in_user_table/migration.sql +5 -0
- package/prisma/schema.prisma +6 -0
- package/prisma/seeders/serial-number-config.seed.js +29 -50
- package/src/prisma/edge.js +10 -4
- package/src/prisma/index-browser.js +7 -1
- package/src/prisma/index.d.ts +231 -2
- package/src/prisma/index.js +10 -4
- package/src/prisma/package.json +1 -1
- package/src/prisma/schema.prisma +6 -0
- package/src/prisma/wasm.js +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "procbay-schema",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.65",
|
|
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/schema.prisma
CHANGED
|
@@ -39,6 +39,11 @@ enum StatusEnum {
|
|
|
39
39
|
Suspended
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
enum EnvironmentEnum {
|
|
43
|
+
PRODUCTION
|
|
44
|
+
SANDBOX
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
model User {
|
|
43
48
|
id Int @id @default(autoincrement())
|
|
44
49
|
uuid String? @unique @default(uuid())
|
|
@@ -68,6 +73,7 @@ model User {
|
|
|
68
73
|
is_deleted Boolean @default(false)
|
|
69
74
|
deleted_at DateTime? @db.Timestamptz(6)
|
|
70
75
|
deleted_by Int?
|
|
76
|
+
user_environment EnvironmentEnum @default(PRODUCTION)
|
|
71
77
|
user_roles UserRole[]
|
|
72
78
|
user_department UserDepartment[]
|
|
73
79
|
approval_hierarchy ApprovalHierarchy[]
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { PrismaClient } from "../../src/prisma/index.js";
|
|
2
2
|
import { loadCoreData } from "./utils/json-loader.js";
|
|
3
|
-
import {
|
|
4
|
-
createProgressTracker,
|
|
5
|
-
logSeederStart,
|
|
6
|
-
logSeederComplete,
|
|
7
|
-
logEntityError,
|
|
8
|
-
} from "./utils/progress-tracker.js";
|
|
3
|
+
import { seedCoreEntity } from "./utils/core-seeder.js";
|
|
9
4
|
|
|
10
5
|
export async function seedSerialNumberConfigurations(
|
|
11
6
|
prismaClient,
|
|
@@ -14,51 +9,35 @@ export async function seedSerialNumberConfigurations(
|
|
|
14
9
|
// Use the passed client or create new one only if needed (for standalone testing)
|
|
15
10
|
const prisma = prismaClient || new PrismaClient();
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
module: serialConfig.module,
|
|
36
|
-
},
|
|
37
|
-
update: {
|
|
38
|
-
alias: serialConfig.alias,
|
|
12
|
+
try {
|
|
13
|
+
// Load serial-number configurations from JSON
|
|
14
|
+
const serialNumberData = loadCoreData("serial-number-config");
|
|
15
|
+
|
|
16
|
+
// Process serial number configurations with optimized core seeder
|
|
17
|
+
const result = await seedCoreEntity(
|
|
18
|
+
prisma,
|
|
19
|
+
serialNumberData,
|
|
20
|
+
"serial number configurations",
|
|
21
|
+
{
|
|
22
|
+
model: "serialNumberConfiguration",
|
|
23
|
+
whereField: "module",
|
|
24
|
+
updateFields: ["alias"], // Only update alias, preserve current_number
|
|
25
|
+
createFields: ["module", "alias", "initial_number", "current_number"],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
performanceConfig: seederManager?.performanceConfig || {
|
|
29
|
+
profile: "stability",
|
|
39
30
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"serial number configuration",
|
|
51
|
-
serialConfig.module,
|
|
52
|
-
error.message
|
|
53
|
-
);
|
|
31
|
+
enableRetries: true,
|
|
32
|
+
logProgress: true,
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return result;
|
|
37
|
+
} finally {
|
|
38
|
+
// Only disconnect if we created our own client
|
|
39
|
+
if (!prismaClient) {
|
|
40
|
+
await prisma.$disconnect();
|
|
54
41
|
}
|
|
55
|
-
tracker.update();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
logSeederComplete("Serial number configurations");
|
|
59
|
-
|
|
60
|
-
// Only disconnect if we created our own client
|
|
61
|
-
if (!prismaClient) {
|
|
62
|
-
await prisma.$disconnect();
|
|
63
42
|
}
|
|
64
43
|
}
|