diff options
author | 2024-02-10 18:37:40 -0700 | |
---|---|---|
committer | 2024-02-13 06:59:44 +0530 | |
commit | e1c47572a6235fd8fd20af888ac3a11c7ae1369d (patch) | |
tree | 2dccff36a441916d7014037cef3f7ce84a790cad /app/Models/Token.ts | |
parent | refactor: project maintenance (diff) | |
download | ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.gz ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.zst ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.zip |
updates
Diffstat (limited to 'app/Models/Token.ts')
-rw-r--r-- | app/Models/Token.ts | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/app/Models/Token.ts b/app/Models/Token.ts index a8c29dd..9c843b8 100644 --- a/app/Models/Token.ts +++ b/app/Models/Token.ts | |||
@@ -1,39 +1,39 @@ | |||
1 | import { DateTime } from 'luxon' | 1 | import { DateTime } from 'luxon'; |
2 | import { BaseModel, column, hasOne } from '@adonisjs/lucid/orm' | 2 | import { BaseModel, column, hasOne } from '@adonisjs/lucid/orm'; |
3 | import User from './User.js' | 3 | import User from './User.js'; |
4 | import { HasOne } from '@adonisjs/lucid/types/relations' | 4 | import { HasOne } from '@adonisjs/lucid/types/relations'; |
5 | 5 | ||
6 | export default class Token extends BaseModel { | 6 | export default class Token extends BaseModel { |
7 | @column({ isPrimary: true }) | 7 | @column({ isPrimary: true }) |
8 | public id: number | 8 | public id: number; |
9 | 9 | ||
10 | @hasOne(() => User, { | 10 | @hasOne(() => User, { |
11 | localKey: 'user_id', | 11 | localKey: 'user_id', |
12 | foreignKey: 'id', | 12 | foreignKey: 'id', |
13 | }) | 13 | }) |
14 | public user: HasOne<typeof User> | 14 | public user: HasOne<typeof User>; |
15 | 15 | ||
16 | @column() | 16 | @column() |
17 | public user_id: number | 17 | public user_id: number; |
18 | 18 | ||
19 | @column() | 19 | @column() |
20 | public token: string | 20 | public token: string; |
21 | 21 | ||
22 | @column() | 22 | @column() |
23 | public type: string | 23 | public type: string; |
24 | 24 | ||
25 | @column() | 25 | @column() |
26 | public is_revoked: boolean | 26 | public is_revoked: boolean; |
27 | 27 | ||
28 | @column() | 28 | @column() |
29 | public name: string | 29 | public name: string; |
30 | 30 | ||
31 | @column.dateTime() | 31 | @column.dateTime() |
32 | public expires_at: DateTime | 32 | public expires_at: DateTime; |
33 | 33 | ||
34 | @column.dateTime({ autoCreate: true }) | 34 | @column.dateTime({ autoCreate: true }) |
35 | public created_at: DateTime | 35 | public created_at: DateTime; |
36 | 36 | ||
37 | @column.dateTime({ autoCreate: true, autoUpdate: true }) | 37 | @column.dateTime({ autoCreate: true, autoUpdate: true }) |
38 | public updated_at: DateTime | 38 | public updated_at: DateTime; |
39 | } | 39 | } |