forked from geolba/tethys.backend
initial commit
This commit is contained in:
commit
4fc3bb0a01
202 changed files with 41729 additions and 0 deletions
62
app/Models/File.ts
Normal file
62
app/Models/File.ts
Normal file
|
@ -0,0 +1,62 @@
|
|||
import { DateTime } from 'luxon';
|
||||
import {
|
||||
column,
|
||||
BaseModel,
|
||||
hasMany, HasMany,
|
||||
// manyToMany,
|
||||
// ManyToMany,
|
||||
SnakeCaseNamingStrategy,
|
||||
} from '@ioc:Adonis/Lucid/Orm';
|
||||
import HashValue from './HashValue';
|
||||
|
||||
export default class File extends BaseModel {
|
||||
public static namingStrategy = new SnakeCaseNamingStrategy();
|
||||
public static primaryKey = 'id';
|
||||
public static table = 'document_files';
|
||||
public static selfAssignPrimaryKey = false;
|
||||
|
||||
@column({
|
||||
isPrimary: true,
|
||||
})
|
||||
public id: number;
|
||||
|
||||
@column({})
|
||||
public pathName: string;
|
||||
|
||||
@column()
|
||||
public label: string;
|
||||
|
||||
@column()
|
||||
public comment: string;
|
||||
|
||||
@column()
|
||||
public mimetype: string;
|
||||
|
||||
@column()
|
||||
public language: string;
|
||||
|
||||
@column()
|
||||
public fileSize: bigint;
|
||||
|
||||
@column()
|
||||
public visibleInOai: boolean;
|
||||
|
||||
@column()
|
||||
public sortOrder: number;
|
||||
|
||||
@column.dateTime({ autoCreate: true })
|
||||
public createdAt: DateTime;
|
||||
|
||||
@column.dateTime({ autoCreate: true, autoUpdate: true })
|
||||
public updatedAt: DateTime;
|
||||
|
||||
// public function hashvalues()
|
||||
// {
|
||||
// return $this->hasMany(HashValue::class, 'file_id', 'id');
|
||||
// }
|
||||
|
||||
@hasMany(() => HashValue, {
|
||||
foreignKey: 'file_id',
|
||||
})
|
||||
public hashvalues: HasMany<typeof HashValue>;
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue