Skip to content

Commit b0e4c0c

Browse files
committed
Merge branch 'next' of github.com:devforth/adminforth into next
2 parents ab84e7c + 94392f2 commit b0e4c0c

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

adminforth/documentation/docs/tutorial/07-Plugins/02-TwoFactorsAuth.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,19 @@ First, you need to create a passkeys table in your schema.prisma file:
231231
```ts title='./schema.prisma'
232232
//diff-add
233233
model passkeys {
234-
//diff-add
235-
credential_id String @id
236-
//diff-add
234+
//diff-add
235+
id String @id
236+
//diff-add
237+
credential_id String
238+
//diff-add
237239
user_id String
238-
//diff-add
240+
//diff-add
239241
meta String
240-
//diff-add
242+
//diff-add
241243
@@index([user_id])
242-
//diff-add
244+
//diff-add
245+
@@index([credential_id])
246+
//diff-add
243247
}
244248
```
245249
@@ -253,18 +257,25 @@ npm run makemigration -- --name add-passkeys ; npm run migrate:local
253257
Next, you need to create a new resource for passkeys:
254258
255259
```ts title='./resources/passkeys.ts'
256-
import { AdminForthDataTypes, AdminForthResourceInput } from "../../adminforth";
260+
import { AdminForthDataTypes, AdminForthResourceInput } from "adminforth";
261+
import { randomUUID } from "crypto";
257262

258263
export default {
259264
dataSource: 'maindb',
260265
table: 'passkeys',
261266
resourceId: 'passkeys',
262267
label: 'Passkeys',
263268
columns: [
269+
{
270+
name: 'id',
271+
label: 'ID',
272+
primaryKey: true,
273+
showIn: { all: false},
274+
fillOnCreate: () => randomUUID(),
275+
},
264276
{
265277
name: 'credential_id',
266278
label: 'Credential ID',
267-
primaryKey: true,
268279
},
269280
{
270281
name: 'user_id',

0 commit comments

Comments
 (0)