stuff
This commit is contained in:
Regular → Executable
+13
-5
@@ -1,6 +1,6 @@
|
||||
import { DateTime } from 'luxon'
|
||||
import { BaseModel, column, hasMany } from '@adonisjs/lucid/orm'
|
||||
import type { HasMany } from '@adonisjs/lucid/types/relations'
|
||||
import { BaseModel, column, manyToMany } from '@adonisjs/lucid/orm'
|
||||
import type { ManyToMany } from '@adonisjs/lucid/types/relations'
|
||||
import RestaurantMenuItem from './restaurant_menu_item.js'
|
||||
|
||||
export default class RestaurantMenu extends BaseModel {
|
||||
@@ -16,6 +16,14 @@ export default class RestaurantMenu extends BaseModel {
|
||||
@column()
|
||||
declare name: string
|
||||
|
||||
@hasMany(() => RestaurantMenuItem)
|
||||
declare items: HasMany<typeof RestaurantMenuItem>
|
||||
}
|
||||
@column({ columnName: 'name_hu' })
|
||||
declare nameHu: string | null
|
||||
|
||||
@column({ columnName: 'name_en' })
|
||||
declare nameEn: string | null
|
||||
|
||||
@manyToMany(() => RestaurantMenuItem, {
|
||||
pivotTable: 'menu_item_menus',
|
||||
})
|
||||
declare items: ManyToMany<typeof RestaurantMenuItem>
|
||||
}
|
||||
|
||||
Regular → Executable
+25
-5
@@ -1,5 +1,8 @@
|
||||
import { DateTime } from 'luxon'
|
||||
import { BaseModel, column } from '@adonisjs/lucid/orm'
|
||||
import { BaseModel, column, belongsTo, manyToMany } from '@adonisjs/lucid/orm'
|
||||
import type { BelongsTo, ManyToMany } from '@adonisjs/lucid/types/relations'
|
||||
import Category from '#models/category'
|
||||
import RestaurantMenu from '#models/restaurant_menu'
|
||||
|
||||
export default class RestaurantMenuItem extends BaseModel {
|
||||
@column({ isPrimary: true })
|
||||
@@ -14,6 +17,12 @@ export default class RestaurantMenuItem extends BaseModel {
|
||||
@column()
|
||||
declare name: string
|
||||
|
||||
@column({ columnName: 'name_hu' })
|
||||
declare nameHu: string | null
|
||||
|
||||
@column({ columnName: 'name_en' })
|
||||
declare nameEn: string | null
|
||||
|
||||
@column()
|
||||
declare priceSmall: number
|
||||
|
||||
@@ -23,9 +32,20 @@ export default class RestaurantMenuItem extends BaseModel {
|
||||
@column()
|
||||
declare description: string | null
|
||||
|
||||
//connet to restaurant_menu
|
||||
@column()
|
||||
declare menu_id: number | null
|
||||
@column({ columnName: 'description_hu' })
|
||||
declare descriptionHu: string | null
|
||||
|
||||
@column({ columnName: 'description_en' })
|
||||
declare descriptionEn: string | null
|
||||
|
||||
}
|
||||
@column({ columnName: 'category_id' })
|
||||
declare categoryId: number | null
|
||||
|
||||
@belongsTo(() => Category)
|
||||
declare category: BelongsTo<typeof Category>
|
||||
|
||||
@manyToMany(() => RestaurantMenu, {
|
||||
pivotTable: 'menu_item_menus',
|
||||
})
|
||||
declare menus: ManyToMany<typeof RestaurantMenu>
|
||||
}
|
||||
|
||||
Regular → Executable
+3
@@ -20,6 +20,9 @@ export default class User extends compose(BaseModel, AuthFinder) {
|
||||
@column()
|
||||
declare email: string
|
||||
|
||||
@column()
|
||||
declare role: string
|
||||
|
||||
@column({ serializeAs: null })
|
||||
declare password: string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user