2020-02-09 07:58:29 +00:00
|
|
|
const Model = require('flitter-orm/src/model/Model')
|
|
|
|
const uuid = require('uuid/v4')
|
2020-10-13 15:16:21 +00:00
|
|
|
const ActiveScope = require('../scopes/Active.scope')
|
2020-02-09 07:58:29 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Codium Model
|
|
|
|
* -------------------------------------------------------------
|
|
|
|
* Put some description here!
|
|
|
|
*/
|
|
|
|
class Codium extends Model {
|
|
|
|
static get schema() {
|
|
|
|
// Return a flitter-orm schema here.
|
|
|
|
return {
|
2020-10-13 14:24:28 +00:00
|
|
|
Language: {type: String, default: 'javascript'},
|
2020-02-09 07:58:29 +00:00
|
|
|
NodeId: String,
|
|
|
|
PageId: String,
|
|
|
|
code: String,
|
|
|
|
UUID: { type: String, default: () => uuid() },
|
2020-10-13 15:16:21 +00:00
|
|
|
Active: { type: Boolean, default: true },
|
2020-02-09 07:58:29 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-13 15:16:21 +00:00
|
|
|
|
|
|
|
static scopes = [new ActiveScope]
|
2020-02-09 07:58:29 +00:00
|
|
|
|
|
|
|
// Static and instance methods can go here
|
2020-10-13 14:24:28 +00:00
|
|
|
get page() {
|
|
|
|
const Page = require('./Page.model')
|
|
|
|
return this.belongs_to_one(Page, 'PageId', 'UUID')
|
|
|
|
}
|
2020-02-09 07:58:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = Codium
|