Models unit; session model; generalize session classes/interfaces
This commit is contained in:
@@ -4,3 +4,4 @@ export { default as ControllerUnit } from '../../lib/src/unit/Controllers.ts'
|
||||
export { default as MiddlewareUnit } from '../../lib/src/unit/Middlewares.ts'
|
||||
export { default as RoutesUnit } from '../../lib/src/unit/Routes.ts'
|
||||
export { default as HttpKernelUnit } from '../../lib/src/unit/HttpKernel.ts'
|
||||
export { default as ModelsUnit } from '../../orm/src/ModelsUnit.ts'
|
||||
|
||||
@@ -6,4 +6,9 @@ export default {
|
||||
enable: true,
|
||||
text: 'Daton',
|
||||
},
|
||||
|
||||
session: {
|
||||
driver: 'database', // memory | database
|
||||
model: 'http:Session', // required for database
|
||||
}
|
||||
}
|
||||
|
||||
20
app/models/http/Session.model.ts
Normal file
20
app/models/http/Session.model.ts
Normal 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
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
import {
|
||||
ConfigUnit,
|
||||
DatabaseUnit,
|
||||
ControllerUnit,
|
||||
MiddlewareUnit,
|
||||
RoutesUnit,
|
||||
HttpKernelUnit
|
||||
ConfigUnit, DatabaseUnit, ControllerUnit, MiddlewareUnit, RoutesUnit, HttpKernelUnit, ModelsUnit
|
||||
} from './bundle/daton_units.ts'
|
||||
|
||||
export default [
|
||||
ConfigUnit,
|
||||
DatabaseUnit,
|
||||
ModelsUnit,
|
||||
HttpKernelUnit,
|
||||
MiddlewareUnit,
|
||||
ControllerUnit,
|
||||
|
||||
Reference in New Issue
Block a user