diff options
author | 2024-02-10 18:19:14 -0700 | |
---|---|---|
committer | 2024-02-13 06:59:44 +0530 | |
commit | 7584d2d7a7110aef0331ebfa178b2295842c59fa (patch) | |
tree | 900cd71237e6231b57936fcce77ff229cd459041 /database/factories/TokenFactory.ts | |
parent | upgrade recipes submodule (diff) | |
download | ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.gz ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.zst ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.zip |
refactor: project maintenance
- work in progress
Diffstat (limited to 'database/factories/TokenFactory.ts')
-rw-r--r-- | database/factories/TokenFactory.ts | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/database/factories/TokenFactory.ts b/database/factories/TokenFactory.ts index 5afc679..0774dcd 100644 --- a/database/factories/TokenFactory.ts +++ b/database/factories/TokenFactory.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import Token from 'App/Models/Token'; | 1 | import Token from '#app/Models/Token' |
2 | import Factory from '@ioc:Adonis/Lucid/Factory'; | 2 | import Factory from '@adonisjs/lucid/factories' |
3 | import { DateTime } from 'luxon'; | 3 | import { DateTime } from 'luxon' |
4 | 4 | ||
5 | export default Factory.define(Token, async ({ faker }) => ({ | 5 | export default Factory.define(Token, async ({ faker }) => ({ |
6 | token: faker.string.alphanumeric(32), | 6 | token: faker.string.alphanumeric(32), |
@@ -9,9 +9,6 @@ export default Factory.define(Token, async ({ faker }) => ({ | |||
9 | created_at: DateTime.now(), | 9 | created_at: DateTime.now(), |
10 | updated_at: DateTime.now(), | 10 | updated_at: DateTime.now(), |
11 | })) | 11 | })) |
12 | .state( | 12 | .state('old_token', (token) => (token.updated_at = DateTime.now().minus({ hours: 25 }))) |
13 | 'old_token', | 13 | .state('revoked', (token) => (token.is_revoked = true)) |
14 | token => (token.updated_at = DateTime.now().minus({ hours: 25 })), | 14 | .build() |
15 | ) | ||
16 | .state('revoked', token => (token.is_revoked = true)) | ||
17 | .build(); | ||