|
1 | | -import { v4 as uuidv4 } from 'uuid'; |
| 1 | +import { randomUUID } from 'node:crypto'; |
2 | 2 |
|
3 | 3 | import { createActivity } from './activity'; |
4 | 4 | import { PermitStage, PermitState } from '../db/codes/enums'; |
@@ -82,7 +82,7 @@ export const generateGeneralProjectData = async ( |
82 | 82 |
|
83 | 83 | if (data.permits.appliedPermits?.length) { |
84 | 84 | appliedPermits = data.permits.appliedPermits.map((x: Permit) => { |
85 | | - const permitId = x.permitId ?? uuidv4(); |
| 85 | + const permitId = x.permitId ?? randomUUID(); |
86 | 86 |
|
87 | 87 | // Add each tracker for this permit with the proper permitId |
88 | 88 | x.permitTracking?.forEach((pt) => appliedPermitTrackers.push({ ...pt, permitId })); |
@@ -113,7 +113,7 @@ export const generateGeneralProjectData = async ( |
113 | 113 |
|
114 | 114 | if (data.permits.investigatePermits?.length) { |
115 | 115 | investigatePermits = data.permits.investigatePermits.map((x: Permit) => ({ |
116 | | - permitId: x.permitId ?? uuidv4(), |
| 116 | + permitId: x.permitId ?? randomUUID(), |
117 | 117 | permitTypeId: x.permitTypeId, |
118 | 118 | activityId: activityId, |
119 | 119 | stage: PermitStage.PRE_SUBMISSION, |
@@ -142,7 +142,7 @@ export const generateGeneralProjectData = async ( |
142 | 142 | ...basic, |
143 | 143 | ...location, |
144 | 144 | ...permits, |
145 | | - generalProjectId: uuidv4(), |
| 145 | + generalProjectId: randomUUID(), |
146 | 146 | activityId: activityId, |
147 | 147 | submittedAt: data.submittedAt ? new Date(data.submittedAt) : new Date(), |
148 | 148 | applicationStatus: data.applicationStatus ?? ApplicationStatus.NEW, |
|
0 commit comments