mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-03-28 03:29:25 +01:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { DateTime } from 'luxon'
|
|
import { BaseModel, column, hasMany, SnakeCaseNamingStrategy } from '@adonisjs/lucid/orm'
|
|
import CuratedCollectionResource from './curated_collection_resource.js'
|
|
import type { HasMany } from '@adonisjs/lucid/types/relations'
|
|
import type { CuratedCollectionType } from '../../types/curated_collections.js'
|
|
|
|
export default class CuratedCollection extends BaseModel {
|
|
static namingStrategy = new SnakeCaseNamingStrategy()
|
|
|
|
@column({ isPrimary: true })
|
|
declare slug: string
|
|
|
|
@column()
|
|
declare type: CuratedCollectionType
|
|
|
|
@column()
|
|
declare name: string
|
|
|
|
@column()
|
|
declare description: string
|
|
|
|
@column()
|
|
declare icon: string
|
|
|
|
@column()
|
|
declare language: string
|
|
|
|
@hasMany(() => CuratedCollectionResource, {
|
|
foreignKey: 'curated_collection_slug',
|
|
localKey: 'slug',
|
|
})
|
|
declare resources: HasMany<typeof CuratedCollectionResource>
|
|
|
|
@column.dateTime({ autoCreate: true })
|
|
declare created_at: DateTime
|
|
|
|
@column.dateTime({ autoCreate: true, autoUpdate: true })
|
|
declare updated_at: DateTime
|
|
}
|