mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 07:03:25 +00:00
31 lines
793 B
TypeScript
31 lines
793 B
TypeScript
import { DateTime } from 'luxon';
|
|
import hash from '@adonisjs/core/services/hash';
|
|
import { compose } from '@adonisjs/core/helpers';
|
|
import { BaseModel, column } from '@adonisjs/lucid/orm';
|
|
import { withAuthFinder } from '@adonisjs/auth/mixins/lucid';
|
|
|
|
const AuthFinder = withAuthFinder(() => hash.use('scrypt'), {
|
|
uids: ['email'],
|
|
passwordColumnName: 'password',
|
|
});
|
|
|
|
export default class User extends compose(BaseModel, AuthFinder) {
|
|
@column({ isPrimary: true })
|
|
declare id: number;
|
|
|
|
@column()
|
|
declare fullName: string | null;
|
|
|
|
@column()
|
|
declare email: string;
|
|
|
|
@column()
|
|
declare password: string;
|
|
|
|
@column.dateTime({ autoCreate: true })
|
|
declare createdAt: DateTime;
|
|
|
|
@column.dateTime({ autoCreate: true, autoUpdate: true })
|
|
declare updatedAt: DateTime | null;
|
|
}
|