forked from geolba/tethys.backend
- validate all file-upload via clamdscan (clamav), throw ValidationException in case of an error
- add @types/clamscan and clamscan for node - package clamav-daemon and clamav-frehshclam for docker - add API Controller: HomeController.ts for /api/years and /api/sitelinks/{year} change root path of file storage from '/storage/app/public/files' to '/storage/app/public' - adapt dockerfile to use node:18-bookworm-slim
This commit is contained in:
parent
5f8fe1c16d
commit
b6b1c90ff8
20 changed files with 941 additions and 278 deletions
|
@ -22,9 +22,10 @@ import License from './License';
|
|||
import Subject from './Subject';
|
||||
import File from './File';
|
||||
import Coverage from './Coverage';
|
||||
import DatasetReference from './DatasetReference';
|
||||
import DatasetReference from './DatasetReference';
|
||||
import Collection from './Collection';
|
||||
import DatasetIdentifier from './DatasetIdentifier';
|
||||
import Project from './Project';
|
||||
|
||||
export default class Dataset extends BaseModel {
|
||||
public static namingStrategy = new SnakeCaseNamingStrategy();
|
||||
|
@ -53,6 +54,12 @@ export default class Dataset extends BaseModel {
|
|||
@column({})
|
||||
public language: string;
|
||||
|
||||
@column({})
|
||||
public publish_id: number | null = null;
|
||||
|
||||
@column({})
|
||||
public project_id: number | null = null;
|
||||
|
||||
@column({})
|
||||
public account_id: number | null = null;
|
||||
|
||||
|
@ -62,7 +69,6 @@ export default class Dataset extends BaseModel {
|
|||
@column({})
|
||||
public reviewer_id: number | null = null;
|
||||
|
||||
|
||||
@column({})
|
||||
public reject_editor_note: string | null;
|
||||
|
||||
|
@ -107,6 +113,11 @@ export default class Dataset extends BaseModel {
|
|||
})
|
||||
public user: BelongsTo<typeof User>;
|
||||
|
||||
@belongsTo(() => Project, {
|
||||
foreignKey: 'project_id',
|
||||
})
|
||||
public project: BelongsTo<typeof Project>;
|
||||
|
||||
@hasMany(() => Title, {
|
||||
foreignKey: 'document_id',
|
||||
})
|
||||
|
@ -146,11 +157,15 @@ export default class Dataset extends BaseModel {
|
|||
})
|
||||
public references: HasMany<typeof DatasetReference>;
|
||||
|
||||
// public function collections()
|
||||
// {
|
||||
// return $this
|
||||
// ->belongsToMany(Collection::class, 'link_documents_collections', 'document_id', 'collection_id');
|
||||
// }
|
||||
// Dataset.hasMany(Reference, {
|
||||
// foreignKey: "related_document_id",
|
||||
// as: "referenced_by",
|
||||
// });
|
||||
@hasMany(() => DatasetReference, {
|
||||
foreignKey: 'related_document_id',
|
||||
})
|
||||
public referenced_by: HasMany<typeof DatasetReference>;
|
||||
|
||||
@manyToMany(() => Collection, {
|
||||
pivotForeignKey: 'document_id',
|
||||
pivotRelatedForeignKey: 'collection_id',
|
||||
|
@ -159,11 +174,10 @@ export default class Dataset extends BaseModel {
|
|||
public collections: ManyToMany<typeof Collection>;
|
||||
|
||||
@hasOne(() => DatasetIdentifier, {
|
||||
foreignKey: 'document_id',
|
||||
foreignKey: 'dataset_id',
|
||||
})
|
||||
public identifier: HasOne<typeof DatasetIdentifier>;
|
||||
|
||||
|
||||
@computed({
|
||||
serializeAs: 'main_title',
|
||||
})
|
||||
|
@ -172,4 +186,26 @@ export default class Dataset extends BaseModel {
|
|||
const mainTitle = this.titles?.find((title) => title.type === 'Main');
|
||||
return mainTitle ? mainTitle.value : null;
|
||||
}
|
||||
|
||||
@manyToMany(() => Person, {
|
||||
pivotForeignKey: 'document_id',
|
||||
pivotRelatedForeignKey: 'person_id',
|
||||
pivotTable: 'link_documents_persons',
|
||||
pivotColumns: ['role', 'sort_order', 'allow_email_contact'],
|
||||
onQuery(query) {
|
||||
query.wherePivot('role', 'author');
|
||||
},
|
||||
})
|
||||
public authors: ManyToMany<typeof Person>;
|
||||
|
||||
@manyToMany(() => Person, {
|
||||
pivotForeignKey: 'document_id',
|
||||
pivotRelatedForeignKey: 'person_id',
|
||||
pivotTable: 'link_documents_persons',
|
||||
pivotColumns: ['role', 'sort_order', 'allow_email_contact'],
|
||||
onQuery(query) {
|
||||
query.wherePivot('role', 'contributor');
|
||||
},
|
||||
})
|
||||
public contributors: ManyToMany<typeof Person>;
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue