tethys.backend/app/Models/Collection.ts
Arno Kaimbacher cf859ba402
All checks were successful
CI Pipeline / japa-tests (push) Successful in 54s
- remove VOLUME assignments from DOXKERFILE
- add package @opensearch-project/opensearch for manipulating opensearch index
- index tethys datasets via new command  IndexDatasets, callable node ace index:datasets or node ace index:datasets -p 193
- add mapping file for opensearch index in public/records.json
- added solr.xslt for transforming Datset model to json for opensearch adding in opensearch
- added route /editor/ dataset/:id/update (beginning of editor/DatasetController.ts
- npm updates
2023-10-17 15:45:41 +02:00

53 lines
1.3 KiB
TypeScript

import { column, SnakeCaseNamingStrategy, manyToMany, ManyToMany, belongsTo, BelongsTo } from '@ioc:Adonis/Lucid/Orm';
import Dataset from './Dataset';
import BaseModel from './BaseModel';
import CollectionRole from './CollectionRole';
export default class Collection extends BaseModel {
public static namingStrategy = new SnakeCaseNamingStrategy();
public static primaryKey = 'id';
public static table = 'collections';
public static fillable: string[] = ['name', 'number', 'role_id'];
@column({
isPrimary: true,
})
public id: number;
@column({})
public document_id: number;
@column({})
public role_id?: number;
@column({})
public number?: string;
@column({})
public name: string;
@column({})
public oai_subset?: string;
@column({})
public parent_id?: number;
@column({})
public visible: boolean;
@column({})
public visible_publish: boolean;
@manyToMany(() => Dataset, {
pivotForeignKey: 'collection_id',
pivotRelatedForeignKey: 'document_id',
pivotTable: 'link_documents_collections',
})
public datasets: ManyToMany<typeof Dataset>;
@belongsTo(() => CollectionRole, {
foreignKey: 'role_id',
})
public collectionRole: BelongsTo<typeof CollectionRole>;
}