Update page model relationships

This commit is contained in:
garrettmills 2020-02-08 08:07:26 -06:00
parent ef2e315480
commit 7c8bcd928f

View File

@ -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') {