File tree Expand file tree Collapse file tree
infrastructure/persistence/seeds Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 */
77
88import { AsyncLocalStorage } from 'async_hooks' ;
9- import { v4 as uuidv4 } from 'uuid ' ;
9+ import { randomUUID } from 'crypto ' ;
1010
1111/**
1212 * Request context data
@@ -110,7 +110,7 @@ export class RequestContextManager {
110110 */
111111 static createFromRequest ( req : any ) : RequestContext {
112112 return {
113- requestId : req . id || req . headers [ 'x-request-id' ] || uuidv4 ( ) ,
113+ requestId : req . id || req . headers [ 'x-request-id' ] || randomUUID ( ) ,
114114 tenantId : req . user ?. tenantId || req . headers [ 'x-tenant-id' ] ,
115115 workspaceId : req . user ?. workspaceId || req . headers [ 'x-workspace-id' ] ,
116116 userId : req . user ?. id || req . user ?. userId ,
Original file line number Diff line number Diff line change 1- import { v4 as uuidv4 } from 'uuid ' ;
1+ import { randomUUID } from 'crypto ' ;
22
33export class GroupId {
44 private constructor ( private readonly value : string ) {
@@ -8,7 +8,7 @@ export class GroupId {
88 }
99
1010 static create ( id ?: string ) : GroupId {
11- return new GroupId ( id || uuidv4 ( ) ) ;
11+ return new GroupId ( id || randomUUID ( ) ) ;
1212 }
1313
1414 getValue ( ) : string {
Original file line number Diff line number Diff line change 1- import { v4 as uuidv4 } from 'uuid ' ;
1+ import { randomUUID } from 'crypto ' ;
22
33export class OrganizationId {
44 private constructor ( private readonly value : string ) {
@@ -8,7 +8,7 @@ export class OrganizationId {
88 }
99
1010 static create ( id ?: string ) : OrganizationId {
11- return new OrganizationId ( id || uuidv4 ( ) ) ;
11+ return new OrganizationId ( id || randomUUID ( ) ) ;
1212 }
1313
1414 getValue ( ) : string {
Original file line number Diff line number Diff line change 1- import { v4 as uuidv4 } from 'uuid ' ;
1+ import { randomUUID } from 'crypto ' ;
22
33export class PermissionId {
44 private constructor ( private readonly value : string ) {
@@ -8,7 +8,7 @@ export class PermissionId {
88 }
99
1010 static create ( id ?: string ) : PermissionId {
11- return new PermissionId ( id || uuidv4 ( ) ) ;
11+ return new PermissionId ( id || randomUUID ( ) ) ;
1212 }
1313
1414 getValue ( ) : string {
Original file line number Diff line number Diff line change 1- import { v4 as uuidv4 } from 'uuid ' ;
1+ import { randomUUID } from 'crypto ' ;
22
33export class RegionId {
44 private constructor ( private readonly value : string ) {
@@ -8,7 +8,7 @@ export class RegionId {
88 }
99
1010 static create ( id ?: string ) : RegionId {
11- return new RegionId ( id || uuidv4 ( ) ) ;
11+ return new RegionId ( id || randomUUID ( ) ) ;
1212 }
1313
1414 getValue ( ) : string {
Original file line number Diff line number Diff line change 1- import { v4 as uuidv4 } from 'uuid ' ;
1+ import { randomUUID } from 'crypto ' ;
22
33export class RoleId {
44 private constructor ( private readonly value : string ) {
@@ -8,7 +8,7 @@ export class RoleId {
88 }
99
1010 static create ( id ?: string ) : RoleId {
11- return new RoleId ( id || uuidv4 ( ) ) ;
11+ return new RoleId ( id || randomUUID ( ) ) ;
1212 }
1313
1414 getValue ( ) : string {
Original file line number Diff line number Diff line change 1- import { v4 as uuidv4 } from 'uuid ' ;
1+ import { randomUUID } from 'crypto ' ;
22
33export class TenantId {
44 private constructor ( private readonly value : string ) {
@@ -8,7 +8,7 @@ export class TenantId {
88 }
99
1010 static create ( id ?: string ) : TenantId {
11- return new TenantId ( id || uuidv4 ( ) ) ;
11+ return new TenantId ( id || randomUUID ( ) ) ;
1212 }
1313
1414 getValue ( ) : string {
Original file line number Diff line number Diff line change 11import { ValueObject } from '../../../../shared/domain/base/ValueObject' ;
2- import { v4 as uuid } from 'uuid ' ;
2+ import { randomUUID } from 'crypto ' ;
33
44export class UserId extends ValueObject < string > {
55 private constructor ( value : string ) { super ( value ) ; }
@@ -14,7 +14,7 @@ export class UserId extends ValueObject<string> {
1414 }
1515
1616 static generate ( ) : UserId {
17- return new UserId ( uuid ( ) ) ;
17+ return new UserId ( randomUUID ( ) ) ;
1818 }
1919
2020 protected validate ( value : string ) : void {
Original file line number Diff line number Diff line change 1- import { v4 as uuidv4 } from 'uuid ' ;
1+ import { randomUUID } from 'crypto ' ;
22
33export class WorkspaceId {
44 private constructor ( private readonly value : string ) {
@@ -8,7 +8,7 @@ export class WorkspaceId {
88 }
99
1010 static create ( id ?: string ) : WorkspaceId {
11- return new WorkspaceId ( id || uuidv4 ( ) ) ;
11+ return new WorkspaceId ( id || randomUUID ( ) ) ;
1212 }
1313
1414 getValue ( ) : string {
Original file line number Diff line number Diff line change 11import { DataSource } from 'typeorm' ;
2- import { v4 as uuidv4 } from 'uuid ' ;
2+ import { randomUUID } from 'crypto ' ;
33
44export async function seedGroups ( dataSource : DataSource ) : Promise < void > {
55 const groupRepository = dataSource . getRepository ( 'group_users' ) ;
@@ -15,7 +15,7 @@ export async function seedGroups(dataSource: DataSource): Promise<void> {
1515 const existing = await groupRepository . findOne ( { where : { name : group . name } } ) ;
1616 if ( ! existing ) {
1717 await groupRepository . save ( {
18- group_user_id : uuidv4 ( ) ,
18+ group_user_id : randomUUID ( ) ,
1919 ...group ,
2020 isActive : true ,
2121 tenant_id : null ,
You can’t perform that action at this time.
0 commit comments