forked from geolba/tethys.backend
- update to AdonisJS 6
This commit is contained in:
parent
f828ca4491
commit
cb51a4136f
167 changed files with 21485 additions and 21212 deletions
|
@ -1,8 +1,10 @@
|
|||
import { column, BaseModel, SnakeCaseNamingStrategy, belongsTo, BelongsTo } from '@ioc:Adonis/Lucid/Orm';
|
||||
import User from './User';
|
||||
import { column, BaseModel, SnakeCaseNamingStrategy, belongsTo } from '@adonisjs/lucid/orm';
|
||||
import User from './User.js';
|
||||
import { DateTime } from 'luxon';
|
||||
import dayjs from 'dayjs';
|
||||
import Encryption from '@ioc:Adonis/Core/Encryption';
|
||||
// import Encryption from '@ioc:Adonis/Core/Encryption';
|
||||
import encryption from '@adonisjs/core/services/encryption';
|
||||
import type { BelongsTo } from "@adonisjs/lucid/types/relations";
|
||||
|
||||
export default class TotpSecret extends BaseModel {
|
||||
public static namingStrategy = new SnakeCaseNamingStrategy();
|
||||
|
@ -21,16 +23,16 @@ export default class TotpSecret extends BaseModel {
|
|||
// public twoFactorSecret: string;
|
||||
@column({
|
||||
serializeAs: null,
|
||||
consume: (value: string) => (value ? JSON.parse(Encryption.decrypt(value) ?? '{}') : null),
|
||||
prepare: (value: string) => Encryption.encrypt(JSON.stringify(value)),
|
||||
consume: (value: string) => (value ? JSON.parse(encryption.decrypt(value) ?? '{}') : null),
|
||||
prepare: (value: string) => encryption.encrypt(JSON.stringify(value)),
|
||||
})
|
||||
public twoFactorSecret?: string | null;
|
||||
|
||||
// serializeAs: null removes the model properties from the serialized output.
|
||||
@column({
|
||||
serializeAs: null,
|
||||
consume: (value: string) => (value ? JSON.parse(Encryption.decrypt(value) ?? '[]') : []),
|
||||
prepare: (value: string[]) => Encryption.encrypt(JSON.stringify(value)),
|
||||
consume: (value: string) => (value ? JSON.parse(encryption.decrypt(value) ?? '[]') : []),
|
||||
prepare: (value: string[]) => encryption.encrypt(JSON.stringify(value)),
|
||||
})
|
||||
public twoFactorRecoveryCodes?: string[] | null;
|
||||
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue