Skip to content

Commit 5744f09

Browse files
committed
fix: use randomUUID in CLI create demo
1 parent 8dfc690 commit 5744f09

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adminforth/commands/createApp/templates/adminuser.ts.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import AdminForth, { AdminForthDataTypes } from 'adminforth';
22
import type { AdminForthResourceInput, AdminForthResource, AdminUser } from 'adminforth';
3+
import { randomUUID } from 'crypto';
34

45
async function canModifyUsers({ adminUser }: { adminUser: AdminUser }): Promise<boolean> {
56
return adminUser.dbUser.role === 'superadmin';
@@ -22,7 +23,7 @@ export default {
2223
name: 'id',
2324
primaryKey: true,
2425
type: AdminForthDataTypes.STRING,
25-
fillOnCreate: ({ initialRecord, adminUser }) => Math.random().toString(36).substring(7),
26+
fillOnCreate: ({ initialRecord, adminUser }) => randomUUID(),
2627
showIn: {
2728
edit: false,
2829
create: false,

0 commit comments

Comments
 (0)