tethys.backend/app/Models/Dataset.ts
Arno Kaimbacher c4f4eff0d9 - daraggable crators and contributors inside Pages/Submitter/Dataset/Create.Vue
- typescript and prettier updates
- FileUpload component with dark mode and dragable uploads
- comment FontFamily in tailwind.config.js
2023-06-16 16:44:28 +02:00

53 lines
1.2 KiB
TypeScript

import {
column,
BaseModel,
SnakeCaseNamingStrategy,
// computed,
manyToMany,
ManyToMany,
} from '@ioc:Adonis/Lucid/Orm';
import { DateTime } from 'luxon';
import Person from './Person';
export default class Dataset extends BaseModel {
public static namingStrategy = new SnakeCaseNamingStrategy();
public static primaryKey = 'id';
public static table = 'documents';
public static selfAssignPrimaryKey = false;
@column({ isPrimary: true })
public id: number;
@column({})
public server_state: boolean;
@column({})
public publisherName: string;
@column.dateTime({ columnName: 'embargo_date' })
public embargoDate: DateTime;
@column({})
public type: string;
@column.dateTime({ columnName: 'server_date_published' })
public serverDatePublished: DateTime;
@column.dateTime({ autoCreate: true, columnName: 'created_at' })
public createdAt: DateTime;
@column.dateTime({ autoCreate: true, autoUpdate: true })
public updatedAt: DateTime;
@manyToMany(() => Person, {
pivotForeignKey: 'document_id',
pivotRelatedForeignKey: 'person_id',
pivotTable: 'link_documents_persons',
pivotColumns: ['role', 'sort_order', 'allow_email_contact']
})
public persons: ManyToMany<typeof Person>;
}