update
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { BaseModel, column, manyToMany } from '@adonisjs/lucid/orm'
|
||||
import type { ManyToMany } from '@adonisjs/lucid/types/relations'
|
||||
import { DateTime } from 'luxon'
|
||||
import Admin from '#base_modules/Admin/model/admin'
|
||||
|
||||
export default class Tenant extends BaseModel {
|
||||
@column({ isPrimary: true, columnName: 'id' })
|
||||
declare id: number
|
||||
|
||||
@column({ columnName: 'name' })
|
||||
declare name: string
|
||||
|
||||
@column({ columnName: 'slug' })
|
||||
declare slug: string
|
||||
|
||||
@column({ columnName: 'status' })
|
||||
declare status: 'active' | 'inactive'
|
||||
|
||||
@column.dateTime({ autoCreate: true, columnName: 'created_at' })
|
||||
declare createdAt: DateTime
|
||||
|
||||
@column.dateTime({ autoCreate: true, autoUpdate: true, columnName: 'updated_at' })
|
||||
declare updatedAt: DateTime | null
|
||||
|
||||
@manyToMany(() => Admin, {
|
||||
pivotTable: 'admin_tenants',
|
||||
pivotForeignKey: 'tenant_id',
|
||||
pivotRelatedForeignKey: 'admin_id',
|
||||
})
|
||||
declare admins: ManyToMany<typeof Admin>
|
||||
}
|
||||
Reference in New Issue
Block a user