🐛 fix: move prisma id generator to service and repo
This commit is contained in:
8
src/helpers/databases/createManyWithUUID.ts
Normal file
8
src/helpers/databases/createManyWithUUID.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { generateUUIDv7 } from "./uuidv7";
|
||||
|
||||
function createManyWithUUID<T extends { id?: string }>(items: T[]): T[] {
|
||||
return items.map((i) => ({
|
||||
...i,
|
||||
id: i.id ?? generateUUIDv7(),
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user