created User-Model and Employee-Model
This commit is contained in:
41
app/Models/Employee.ts
Normal file
41
app/Models/Employee.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { DateTime } from 'luxon'
|
||||
import { BaseModel, belongsTo, BelongsTo, column } from '@ioc:Adonis/Lucid/Orm'
|
||||
import User from 'App/Models/User'
|
||||
|
||||
export default class Employee extends BaseModel {
|
||||
@column({ isPrimary: true })
|
||||
public id: number
|
||||
|
||||
@column.dateTime({ autoCreate: true })
|
||||
public createdAt: DateTime
|
||||
|
||||
@column.dateTime({ autoCreate: true, autoUpdate: true })
|
||||
public updatedAt: DateTime
|
||||
|
||||
@column()
|
||||
public firstName : string
|
||||
|
||||
@column()
|
||||
public lastName : string
|
||||
|
||||
@column()
|
||||
public shorthand: string
|
||||
|
||||
@column()
|
||||
public email : string
|
||||
|
||||
@column()
|
||||
public phone : string
|
||||
|
||||
@column()
|
||||
public mobile : string
|
||||
|
||||
@column()
|
||||
public contractHours : number
|
||||
|
||||
@column()
|
||||
public userId : number
|
||||
|
||||
@belongsTo(() => User)
|
||||
public user: BelongsTo<typeof User>
|
||||
}
|
||||
Reference in New Issue
Block a user