forked from geolba/tethys.backend
- add methods for releasing datasets from submitter
- npm updates - side menu with child items - flash messages via HttpContext response (extended via macro)
This commit is contained in:
parent
e0ff71b117
commit
f403c3109f
37 changed files with 1020 additions and 482 deletions
|
@ -8,14 +8,17 @@ import {
|
|||
BelongsTo,
|
||||
hasMany,
|
||||
HasMany,
|
||||
computed,
|
||||
} from '@ioc:Adonis/Lucid/Orm';
|
||||
import { DateTime } from 'luxon';
|
||||
import dayjs from 'dayjs';
|
||||
import Person from './Person';
|
||||
import User from './User';
|
||||
import Title from './Title';
|
||||
import Description from './Description';
|
||||
import License from './License';
|
||||
import Subject from './Subject';
|
||||
import File from './File';
|
||||
|
||||
export default class Dataset extends BaseModel {
|
||||
public static namingStrategy = new SnakeCaseNamingStrategy();
|
||||
|
@ -47,10 +50,29 @@ export default class Dataset extends BaseModel {
|
|||
@column({})
|
||||
public account_id: number | null = null;
|
||||
|
||||
@column({})
|
||||
public editor_id: number | null = null;
|
||||
|
||||
@column({})
|
||||
public reviewer_id: number | null = null;
|
||||
|
||||
@column({})
|
||||
public reject_editor_note: string;
|
||||
|
||||
@column({})
|
||||
public reject_reviewer_note: string;
|
||||
|
||||
@column.dateTime({ columnName: 'server_date_published' })
|
||||
public serverDatePublished: DateTime;
|
||||
|
||||
@column.dateTime({ autoCreate: true, columnName: 'created_at' })
|
||||
// @column.dateTime({ autoCreate: true, columnName: 'created_at' })
|
||||
@column.dateTime({
|
||||
serialize: (value: Date | null) => {
|
||||
return value ? dayjs(value).format('MMMM D YYYY HH:mm a') : value;
|
||||
},
|
||||
autoCreate: true,
|
||||
columnName: 'created_at',
|
||||
})
|
||||
public createdAt: DateTime;
|
||||
|
||||
@column.dateTime({ autoCreate: true, autoUpdate: true, columnName: 'server_date_modified' })
|
||||
|
@ -100,9 +122,17 @@ export default class Dataset extends BaseModel {
|
|||
})
|
||||
public subjects: ManyToMany<typeof Subject>;
|
||||
|
||||
// async save(): Promise<this> {
|
||||
// // Call the parent save method to persist changes to the database
|
||||
// await super.save();
|
||||
// return this;
|
||||
// }
|
||||
@hasMany(() => File, {
|
||||
foreignKey: 'document_id',
|
||||
})
|
||||
public files: HasMany<typeof File>;
|
||||
|
||||
@computed({
|
||||
serializeAs: 'main_title',
|
||||
})
|
||||
public get mainTitle() {
|
||||
// return `${this.firstName} ${this.lastName}`;
|
||||
const mainTitle = this.titles?.find((title) => title.type === 'Main');
|
||||
return mainTitle ? mainTitle.value : null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue