You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
814 B

const Model = require("flitter-orm/src/model/Model");
const { ObjectId } = require("mongodb");
//custom
const NodeData = require("./NodeData.model");
/*
* Node Model
* -------------------------------------------------------------
* Put some description here!
*/
class Node extends Model {
static get schema() {
// Return a flitter-orm schema here.
return {
Type: String,
Value: NodeData,
PageId: ObjectId,
CreatedAt: { type: Date, default: () => new Date() },
UpdatedAt: { type: Date, default: () => new Date() },
CreatedUserId: { type: ObjectId },
UpdateUserId: { type: ObjectId }
};
}
// Static and instance methods can go here
get page() {
const Page = this.model.get("api:Page")
return this.belongs_to_one(Page, "PageId", "_id")
}
}
module.exports = exports = Node;