2020-02-08 01:50:10 +00:00
|
|
|
const Model = require('flitter-orm/src/model/Model')
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Example Model
|
|
|
|
* -------------------------------------------------------------
|
|
|
|
* This is a sample model. The schema or structure of the model should
|
|
|
|
* be specified here. It is then passed to flitter-orm and can be accessed
|
|
|
|
* globally using the canonical models service.
|
|
|
|
*/
|
|
|
|
class Example extends Model {
|
|
|
|
static get services() {
|
|
|
|
return [...super.services, 'output']
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the flitter-orm schema of the model.
|
|
|
|
* @returns {object}
|
|
|
|
*/
|
|
|
|
static get schema() {
|
|
|
|
return {
|
2020-02-08 11:17:29 +00:00
|
|
|
Name: String,
|
|
|
|
CreateDate: {type: Date, default: () => new Date},
|
2020-02-08 01:50:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
log_name() {
|
|
|
|
this.output.info(`[Example Model] ${this.name}`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = Example
|