Update page model relationships

master
garrettmills 4 years ago
parent ef2e315480
commit 7c8bcd928f

@ -16,7 +16,7 @@ class Page extends Model {
return {
UUID: {type: String, default: () => uuid()},
Name: String,
OrgUserId: String,
OrgUserId: ObjectId,
IsPublic: {type: Boolean, default: true},
IsVisibleInMenu: {type: Boolean, default: true},
ParentId: String,
@ -37,16 +37,16 @@ class Page extends Model {
get nodes() {
const Node = this.models.get("api:Node");
return this.has_many(Node, "NodeIds", "_id");
return this.has_many(Node, "NodeIds", "UUID");
}
get childPages() {
const Page = this.models.get("api:Page")
return this.has_many(Page, "ChildPageIds", "_id")
return this.has_many(Page, "ChildPageIds", "UUID")
}
get parent() {
const Parent = this.models.get("api:Page")
return this.belongs_to_one(Parent, "ParentId", "_id")
return this.belongs_to_one(Parent, "ParentId", "UUID")
}
accessible_by(user, mode = 'view') {

Loading…
Cancel
Save