mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 14:43:24 +00:00
34 lines
849 B
TypeScript
34 lines
849 B
TypeScript
import Collection from '#models/collection';
|
|
import type { GoogleToken } from '@adonisjs/ally/types';
|
|
import { column, manyToMany } from '@adonisjs/lucid/orm';
|
|
import type { ManyToMany } from '@adonisjs/lucid/types/relations';
|
|
import AppBaseModel from './app_base_model.js';
|
|
|
|
export default class User extends AppBaseModel {
|
|
@column()
|
|
declare email: string;
|
|
|
|
@column()
|
|
declare name: string;
|
|
|
|
@column({ serializeAs: 'nickName' })
|
|
declare nickName: string; // public username
|
|
|
|
@column({ serializeAs: 'avatarUrl' })
|
|
declare avatarUrl: string;
|
|
|
|
@column()
|
|
declare isAdmin: boolean;
|
|
|
|
@column({ serializeAs: null })
|
|
declare token: GoogleToken;
|
|
|
|
@column({ serializeAs: null })
|
|
declare providerId: string;
|
|
|
|
@manyToMany(() => Collection, {
|
|
relatedKey: 'authorId',
|
|
})
|
|
declare collections: ManyToMany<typeof Collection>;
|
|
}
|