Models unit; session model; generalize session classes/interfaces

This commit is contained in:
garrettmills
2020-07-27 09:41:04 -05:00
parent 878de025d8
commit 25a37cf1a2
27 changed files with 331 additions and 37 deletions

View File

@@ -0,0 +1,20 @@
import {Field} from '../../../orm/src/model/Field.ts'
import {Type} from '../../../orm/src/db/types.ts'
import {SessionModel} from '../../../lib/src/module.ts'
export default class Session extends SessionModel {
protected static table = 'sessions'
protected static key = 'session_id'
protected static readonly CREATED_AT = 'start_time'
protected static readonly UPDATED_AT = null // No updated at
@Field(Type.int)
protected session_id!: number
@Field(Type.int)
protected user_id?: number
@Field(Type.timestamp)
protected start_time!: Date
}