Added Tags

This commit is contained in:
2021-08-16 22:38:58 +02:00
parent 98f9402de4
commit 2c4a7c0dda
5 changed files with 130 additions and 0 deletions

21
app/Models/Tag.ts Normal file
View File

@@ -0,0 +1,21 @@
import { DateTime } from 'luxon'
import {BaseModel, BelongsTo, belongsTo, column} from '@ioc:Adonis/Lucid/Orm'
import Translation from "App/Models/Translation";
export default class Tag extends BaseModel {
@column({ isPrimary: true })
public id: number
@belongsTo(() => Translation, {
foreignKey: 'labelId'
})
public label: BelongsTo<typeof Translation>
public labelId: number
@column.dateTime({ autoCreate: true })
public createdAt: DateTime
@column.dateTime({ autoCreate: true, autoUpdate: true })
public updatedAt: DateTime
}