Update ORM to fix relationship bug

This commit is contained in:
garrettmills
2020-02-11 01:09:24 -06:00
parent b82d7a51f2
commit b427a16601
4 changed files with 24 additions and 16 deletions

View File

@@ -22,7 +22,6 @@ class Menu extends Controller {
children: nodes,
noDelete: true,
virtual: true,
expanded: true,
})
return res.api(menu)

View File

@@ -30,6 +30,9 @@ class Page extends Model {
CreatedUserId: {type: String},
UpdateUserId: {type: String},
ChildPageIds: [String],
noDelete: { type: Boolean, default: false },
virtual: { type: Boolean, default: false },
};
}
@@ -37,13 +40,13 @@ class Page extends Model {
// Static and instance methods can go here
get user() {
const User = this.models.get("auth:User");
return this.belongs_to_one(User, "OrgUserId", "_id");
const User = this.models.get("auth:User")
return this.belongs_to_one(User, "OrgUserId", "_id")
}
get nodes() {
const Node = this.models.get("api:Node");
return this.has_many(Node, "NodeIds", "UUID");
const Node = this.models.get("api:Node")
return this.has_many(Node, "NodeIds", "UUID")
}
get childPages() {
const Page = this.models.get("api:Page")