efiber-prisma-schema 1.12.2 → 1.12.4

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": "efiber-prisma-schema",
3
- "version": "1.12.2",
3
+ "version": "1.12.4",
4
4
  "description": "Database schema for eFiber",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,95 @@
1
+ -- AlterTable
2
+ ALTER TABLE "Project" ADD COLUMN "mapElementTemplateId" TEXT;
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "qrCodeTag" ADD COLUMN "mapElementId" TEXT;
6
+
7
+ -- AlterTable
8
+ ALTER TABLE "qrCodeTemplate" ADD COLUMN "mapElementTemplateId" TEXT;
9
+
10
+ -- CreateTable
11
+ CREATE TABLE "MapElementTemplate" (
12
+ "id" TEXT NOT NULL,
13
+ "no" SERIAL NOT NULL,
14
+ "status" TEXT NOT NULL DEFAULT 'active',
15
+ "name" TEXT,
16
+ "photos" JSONB,
17
+ "texts" JSONB,
18
+ "files" JSONB,
19
+ "zone" JSONB,
20
+ "geometry" JSONB,
21
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
22
+ "updatedAt" TIMESTAMP(3) NOT NULL,
23
+ "deletedAt" TIMESTAMP(3),
24
+ "updatedById" TEXT,
25
+ "networkElementId" TEXT NOT NULL,
26
+ "clusterId" TEXT,
27
+
28
+ CONSTRAINT "MapElementTemplate_pkey" PRIMARY KEY ("id")
29
+ );
30
+
31
+ -- CreateTable
32
+ CREATE TABLE "MapElement" (
33
+ "id" TEXT NOT NULL,
34
+ "no" SERIAL NOT NULL,
35
+ "status" TEXT NOT NULL DEFAULT 'active',
36
+ "name" TEXT,
37
+ "photos" JSONB,
38
+ "texts" JSONB,
39
+ "files" JSONB,
40
+ "zone" JSONB,
41
+ "geometry" JSONB,
42
+ "coordinates" JSONB,
43
+ "autoincrement" BOOLEAN NOT NULL DEFAULT true,
44
+ "namePrefix" TEXT,
45
+ "templateIndex" INTEGER,
46
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
47
+ "updatedAt" TIMESTAMP(3) NOT NULL,
48
+ "deletedAt" TIMESTAMP(3),
49
+ "updatedById" TEXT,
50
+ "networkElementId" TEXT NOT NULL,
51
+ "templateId" TEXT,
52
+ "projectId" TEXT,
53
+ "clusterId" TEXT,
54
+
55
+ CONSTRAINT "MapElement_pkey" PRIMARY KEY ("id")
56
+ );
57
+
58
+ -- CreateIndex
59
+ CREATE UNIQUE INDEX "MapElementTemplate_id_key" ON "MapElementTemplate"("id");
60
+
61
+ -- CreateIndex
62
+ CREATE UNIQUE INDEX "MapElement_id_key" ON "MapElement"("id");
63
+
64
+ -- AddForeignKey
65
+ ALTER TABLE "Project" ADD CONSTRAINT "Project_mapElementTemplateId_fkey" FOREIGN KEY ("mapElementTemplateId") REFERENCES "MapElementTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
66
+
67
+ -- AddForeignKey
68
+ ALTER TABLE "MapElementTemplate" ADD CONSTRAINT "MapElementTemplate_updatedById_fkey" FOREIGN KEY ("updatedById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
69
+
70
+ -- AddForeignKey
71
+ ALTER TABLE "MapElementTemplate" ADD CONSTRAINT "MapElementTemplate_networkElementId_fkey" FOREIGN KEY ("networkElementId") REFERENCES "NetworkElement"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
72
+
73
+ -- AddForeignKey
74
+ ALTER TABLE "MapElementTemplate" ADD CONSTRAINT "MapElementTemplate_clusterId_fkey" FOREIGN KEY ("clusterId") REFERENCES "Cluster"("id") ON DELETE SET NULL ON UPDATE CASCADE;
75
+
76
+ -- AddForeignKey
77
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_updatedById_fkey" FOREIGN KEY ("updatedById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
78
+
79
+ -- AddForeignKey
80
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_networkElementId_fkey" FOREIGN KEY ("networkElementId") REFERENCES "NetworkElement"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
81
+
82
+ -- AddForeignKey
83
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "MapElementTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
84
+
85
+ -- AddForeignKey
86
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE SET NULL ON UPDATE CASCADE;
87
+
88
+ -- AddForeignKey
89
+ ALTER TABLE "MapElement" ADD CONSTRAINT "MapElement_clusterId_fkey" FOREIGN KEY ("clusterId") REFERENCES "Cluster"("id") ON DELETE SET NULL ON UPDATE CASCADE;
90
+
91
+ -- AddForeignKey
92
+ ALTER TABLE "qrCodeTemplate" ADD CONSTRAINT "qrCodeTemplate_mapElementTemplateId_fkey" FOREIGN KEY ("mapElementTemplateId") REFERENCES "MapElementTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
93
+
94
+ -- AddForeignKey
95
+ ALTER TABLE "qrCodeTag" ADD CONSTRAINT "qrCodeTag_mapElementId_fkey" FOREIGN KEY ("mapElementId") REFERENCES "MapElement"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,8 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "MapElementType" AS ENUM ('Marker', 'Polyline', 'Polygon');
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "MapElement" ADD COLUMN "mapElementType" "MapElementType" NOT NULL DEFAULT 'Marker';
6
+
7
+ -- AlterTable
8
+ ALTER TABLE "MapElementTemplate" ADD COLUMN "mapElementType" "MapElementType" NOT NULL DEFAULT 'Marker';
@@ -78,6 +78,12 @@ enum MetricType {
78
78
  FormulaResult
79
79
  }
80
80
 
81
+ enum MapElementType {
82
+ Marker
83
+ Polyline
84
+ Polygon
85
+ }
86
+
81
87
  model Country {
82
88
  id String @id @unique @default(uuid())
83
89
  no Int @default(autoincrement())
@@ -462,6 +468,8 @@ model User {
462
468
  integrationUserLocation integrationUserLocation[]
463
469
  CamusatClient CamusatClient[]
464
470
  IntegrationReportTemplate IntegrationReportTemplate[]
471
+ MapElementTemplate MapElementTemplate[]
472
+ MapElement MapElement[]
465
473
  }
466
474
 
467
475
  model MainProject {
@@ -536,6 +544,9 @@ model Project {
536
544
  SFUTemplate SFUTemplate[]
537
545
  BuildingTemplate BuildingTemplate[]
538
546
  usersOnline integrationProjectUserStatus[]
547
+ MapElementTemplate MapElementTemplate? @relation(fields: [mapElementTemplateId], references: [id])
548
+ mapElementTemplateId String?
549
+ MapElement MapElement[]
539
550
  }
540
551
 
541
552
  model integrationProjectUserStatus {
@@ -1281,12 +1292,12 @@ model ReportFormats {
1281
1292
  }
1282
1293
 
1283
1294
  model NetworkElement {
1284
- id String @id @unique @default(uuid())
1285
- no Int @default(autoincrement())
1286
- type String @unique
1287
- createdAt DateTime @default(now())
1288
- updatedAt DateTime @updatedAt
1289
- deletedAt DateTime?
1295
+ id String @id @unique @default(uuid())
1296
+ no Int @default(autoincrement())
1297
+ type String @unique
1298
+ createdAt DateTime @default(now())
1299
+ updatedAt DateTime @updatedAt
1300
+ deletedAt DateTime?
1290
1301
  classification NetworkElementClassification @default(NetworkElement)
1291
1302
 
1292
1303
  PboFat PboFat[]
@@ -1310,6 +1321,8 @@ model NetworkElement {
1310
1321
  FDTSROTemplate FDTSROTemplate[]
1311
1322
  SFUTemplate SFUTemplate[]
1312
1323
  BuildingTemplate BuildingTemplate[]
1324
+ MapElementTemplate MapElementTemplate[]
1325
+ MapElement MapElement[]
1313
1326
  }
1314
1327
 
1315
1328
  model Cable {
@@ -2214,6 +2227,79 @@ model BuildingTemplate {
2214
2227
  Building Building[]
2215
2228
  }
2216
2229
 
2230
+ model MapElementTemplate {
2231
+ id String @id @unique @default(uuid())
2232
+ no Int @default(autoincrement())
2233
+
2234
+ status String @default("active")
2235
+ name String?
2236
+ photos Json? //Upload files for photos
2237
+ texts Json? //Add text attributes to the map element
2238
+ files Json? //Upload files for the map element
2239
+ zone Json? //Color code for zone
2240
+ geometry Json? //Icon for the map element
2241
+
2242
+ mapElementType MapElementType @default(Marker)
2243
+
2244
+ createdAt DateTime @default(now())
2245
+ updatedAt DateTime @updatedAt
2246
+ deletedAt DateTime?
2247
+
2248
+ updatedBy User? @relation(fields: [updatedById], references: [id])
2249
+ updatedById String?
2250
+
2251
+ networkElement NetworkElement @relation(fields: [networkElementId], references: [id])
2252
+ networkElementId String
2253
+
2254
+
2255
+ projects Project[]
2256
+
2257
+ cluster Cluster? @relation(fields: [clusterId], references: [id])
2258
+ clusterId String?
2259
+ qrCodeTemplate qrCodeTemplate[]
2260
+ MapElement MapElement[]
2261
+ }
2262
+
2263
+ model MapElement {
2264
+ id String @id @unique @default(uuid())
2265
+ no Int @default(autoincrement())
2266
+
2267
+ status String @default("active")
2268
+ name String?
2269
+ photos Json? //Upload files for photos
2270
+ texts Json? //Add text attributes to the map element
2271
+ files Json? //Upload files for the map element
2272
+ zone Json? //Color code for zone
2273
+ geometry Json? //Icon for the map element
2274
+ coordinates Json?
2275
+ autoincrement Boolean @default(true)
2276
+ namePrefix String?
2277
+ templateIndex Int?
2278
+
2279
+ mapElementType MapElementType @default(Marker)
2280
+
2281
+ createdAt DateTime @default(now())
2282
+ updatedAt DateTime @updatedAt
2283
+ deletedAt DateTime?
2284
+
2285
+ updatedBy User? @relation(fields: [updatedById], references: [id])
2286
+ updatedById String?
2287
+
2288
+ networkElement NetworkElement @relation(fields: [networkElementId], references: [id])
2289
+ networkElementId String
2290
+
2291
+ template MapElementTemplate? @relation(fields: [templateId], references: [id])
2292
+ templateId String?
2293
+
2294
+ project Project? @relation(fields: [projectId], references: [id])
2295
+ projectId String?
2296
+
2297
+ cluster Cluster? @relation(fields: [clusterId], references: [id])
2298
+ clusterId String?
2299
+
2300
+ qrCodeTag qrCodeTag[]
2301
+ }
2302
+
2217
2303
  model NetworkElementInstallation {
2218
2304
  id String @id @unique @default(uuid())
2219
2305
  no Int @default(autoincrement())
@@ -2297,6 +2383,8 @@ model Cluster {
2297
2383
  usersOnline integrationProjectUserStatus[]
2298
2384
  qrCodeTemplate qrCodeTemplate[]
2299
2385
  integrationUserLocation integrationUserLocation[]
2386
+ MapElementTemplate MapElementTemplate[]
2387
+ MapElement MapElement[]
2300
2388
  }
2301
2389
 
2302
2390
  model qrCodeTemplate {
@@ -2359,7 +2447,9 @@ model qrCodeTemplate {
2359
2447
 
2360
2448
  // cable Cable? @relation(fields: [networkElementId], references: [id])
2361
2449
  // pboFat PboFat? @relation(fields: [networkElementId], references: [id])
2362
- qrCodeTag qrCodeTag[]
2450
+ qrCodeTag qrCodeTag[]
2451
+ MapElementTemplate MapElementTemplate? @relation(fields: [mapElementTemplateId], references: [id])
2452
+ mapElementTemplateId String?
2363
2453
  }
2364
2454
 
2365
2455
  model qrCodeTag {
@@ -2407,8 +2497,10 @@ model qrCodeTag {
2407
2497
  sfu SFU? @relation(fields: [sfuId], references: [id])
2408
2498
  sfuId String?
2409
2499
 
2410
- building Building? @relation(fields: [buildingId], references: [id])
2411
- buildingId String?
2500
+ building Building? @relation(fields: [buildingId], references: [id])
2501
+ buildingId String?
2502
+ MapElement MapElement? @relation(fields: [mapElementId], references: [id])
2503
+ mapElementId String?
2412
2504
  }
2413
2505
 
2414
2506
  model installationSequence {
@@ -2489,7 +2581,7 @@ model ReportMetric {
2489
2581
  elementType NetworkElementChildType?
2490
2582
  attributeName String //Name of the attribute to be reported
2491
2583
 
2492
- metricType MetricType?
2584
+ metricType MetricType?
2493
2585
 
2494
2586
  // Aggregation across records
2495
2587
  formula AggregationOperation?
@@ -2501,7 +2593,7 @@ model ReportMetric {
2501
2593
  // Usage Classification
2502
2594
  usage ReportUsage[] @default([TABLE])
2503
2595
 
2504
- ReportTable ReportTable[]
2596
+ ReportTable ReportTable[]
2505
2597
  }
2506
2598
 
2507
2599
  model ReportFormulaConfig {