forked from geolba/tethys.backend
initial commit
This commit is contained in:
commit
4fc3bb0a01
202 changed files with 41729 additions and 0 deletions
52
app/Models/Dataset.ts
Normal file
52
app/Models/Dataset.ts
Normal file
|
@ -0,0 +1,52 @@
|
|||
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>;
|
||||
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue