2024-03-14 19:25:27 +00:00
|
|
|
import { column, SnakeCaseNamingStrategy, hasMany } from '@adonisjs/lucid/orm';
|
2024-04-30 09:50:50 +00:00
|
|
|
import BaseModel from './base_model.js';
|
|
|
|
import Collection from './collection.js';
|
2024-03-14 19:25:27 +00:00
|
|
|
import type { HasMany } from "@adonisjs/lucid/types/relations";
|
2023-09-28 20:43:46 +00:00
|
|
|
|
|
|
|
export default class CollectionRole extends BaseModel {
|
|
|
|
public static namingStrategy = new SnakeCaseNamingStrategy();
|
|
|
|
public static primaryKey = 'id';
|
|
|
|
public static table = 'collections_roles';
|
|
|
|
public static fillable: string[] = ['name', 'oai_name', 'visible'];
|
|
|
|
|
|
|
|
@column({
|
|
|
|
isPrimary: true,
|
|
|
|
})
|
|
|
|
public id: number;
|
|
|
|
|
|
|
|
@column({})
|
|
|
|
public name: string;
|
|
|
|
|
|
|
|
@column({})
|
|
|
|
public oai_name?: string;
|
|
|
|
|
|
|
|
@column({})
|
|
|
|
public position: number;
|
|
|
|
|
|
|
|
@column({})
|
|
|
|
public visible: boolean;
|
|
|
|
|
|
|
|
@column({})
|
|
|
|
public visible_frontdoor: boolean;
|
|
|
|
|
|
|
|
@column({})
|
|
|
|
public visible_oai: boolean;
|
|
|
|
|
|
|
|
@hasMany(() => Collection, {
|
|
|
|
foreignKey: 'role_id',
|
|
|
|
})
|
|
|
|
public collections: HasMany<typeof Collection>;
|
|
|
|
}
|