mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 15:05:35 +00:00
30 lines
754 B
TypeScript
30 lines
754 B
TypeScript
import AppBaseModel from '#models/app_base_model';
|
|
import Link from '#models/link';
|
|
import User from '#models/user';
|
|
import { belongsTo, column, manyToMany } from '@adonisjs/lucid/orm';
|
|
import type { BelongsTo, ManyToMany } from '@adonisjs/lucid/types/relations';
|
|
import { Visibility } from '../enums/visibility.js';
|
|
|
|
export default class Collection extends AppBaseModel {
|
|
@column()
|
|
declare name: string;
|
|
|
|
@column()
|
|
declare description: string | null;
|
|
|
|
@column()
|
|
declare visibility: Visibility;
|
|
|
|
@column()
|
|
declare nextId: string;
|
|
|
|
@column()
|
|
declare authorId: string;
|
|
|
|
@belongsTo(() => User, { foreignKey: 'authorId' })
|
|
declare author: BelongsTo<typeof User>;
|
|
|
|
@manyToMany(() => Link)
|
|
declare links: ManyToMany<typeof Link>;
|
|
}
|