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, children: nodes,
noDelete: true, noDelete: true,
virtual: true, virtual: true,
expanded: true,
}) })
return res.api(menu) return res.api(menu)

View File

@ -30,6 +30,9 @@ class Page extends Model {
CreatedUserId: {type: String}, CreatedUserId: {type: String},
UpdateUserId: {type: String}, UpdateUserId: {type: String},
ChildPageIds: [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 // Static and instance methods can go here
get user() { get user() {
const User = this.models.get("auth:User"); const User = this.models.get("auth:User")
return this.belongs_to_one(User, "OrgUserId", "_id"); return this.belongs_to_one(User, "OrgUserId", "_id")
} }
get nodes() { get nodes() {
const Node = this.models.get("api:Node"); const Node = this.models.get("api:Node")
return this.has_many(Node, "NodeIds", "UUID"); return this.has_many(Node, "NodeIds", "UUID")
} }
get childPages() { get childPages() {
const Page = this.models.get("api:Page") const Page = this.models.get("api:Page")

View File

@ -22,8 +22,8 @@
"flitter-di": "^0.4.1", "flitter-di": "^0.4.1",
"flitter-flap": "^0.5.2", "flitter-flap": "^0.5.2",
"flitter-forms": "^0.8.1", "flitter-forms": "^0.8.1",
"flitter-orm": "^0.2.1", "flitter-orm": "^0.2.2",
"flitter-upload": "^0.8.0", "flitter-upload": "^0.8.0",
"libflitter": "^0.46.3" "libflitter": "^0.46.4"
} }
} }

View File

@ -1041,15 +1041,16 @@ flitter-forms@^0.8.1:
recursive-readdir "^2.2.2" recursive-readdir "^2.2.2"
validator "^10.11.0" validator "^10.11.0"
flitter-orm@^0.2.1: flitter-orm@^0.2.2:
version "0.2.1" version "0.2.2"
resolved "https://registry.yarnpkg.com/flitter-orm/-/flitter-orm-0.2.1.tgz#d73e85c88995e25f62b1e65086e1cdc0f005974b" resolved "https://registry.yarnpkg.com/flitter-orm/-/flitter-orm-0.2.2.tgz#b30e11c32f8467bb540a718a30824c28eb9599bd"
integrity sha512-2e+G1JHm8NQXQNkLI1zH//eM54KtaoKB4mm3Q3AkuZUPbGzNiVNuNw2J/A4dJ505W9PzFBUL09aXz7lGpyVV8w== integrity sha512-zZOgbdehzYI21B6/Y0QdVlGIbFgN490TPAwB+krlCbG9Ht7ofoaokRW0WpehDiwfrNkjH+3VgexAW6gQcVhBXw==
dependencies: dependencies:
flitter-di "^0.4.0" flitter-di "^0.4.0"
json-stringify-safe "^5.0.1" json-stringify-safe "^5.0.1"
mongodb "^3.5.1" mongodb "^3.5.1"
object-hash "^2.0.1" object-hash "^2.0.1"
uuid "^3.4.0"
flitter-upload@^0.8.0: flitter-upload@^0.8.0:
version "0.8.0" version "0.8.0"
@ -1508,10 +1509,10 @@ leven@^1.0.2:
resolved "https://registry.yarnpkg.com/leven/-/leven-1.0.2.tgz#9144b6eebca5f1d0680169f1a6770dcea60b75c3" resolved "https://registry.yarnpkg.com/leven/-/leven-1.0.2.tgz#9144b6eebca5f1d0680169f1a6770dcea60b75c3"
integrity sha1-kUS27ryl8dBoAWnxpncNzqYLdcM= integrity sha1-kUS27ryl8dBoAWnxpncNzqYLdcM=
libflitter@^0.46.3: libflitter@^0.46.4:
version "0.46.3" version "0.46.4"
resolved "https://registry.yarnpkg.com/libflitter/-/libflitter-0.46.3.tgz#26381648d2bf9e41559dfc28bf9508b0d3c56156" resolved "https://registry.yarnpkg.com/libflitter/-/libflitter-0.46.4.tgz#ea9d59446c43eb17a4dbf14d8a13f34a1a61c8fd"
integrity sha512-5VS0y8ooz+Dke9M+fPNyO5TUd6lS1FmMcrTugA7a8U9kjpMnnNUfn1GMAM6HycPMmY6SVUetAb20TCL/N3kuUQ== integrity sha512-rXlgH44YAkPwKWo0Qu5fKt8zrGKT4DTSQfcFhxsmJVmT+aYoQLDMXQhCk/TgpvsAL+RkGqpCP3/wIum99frraA==
dependencies: dependencies:
colors "^1.3.3" colors "^1.3.3"
connect-mongodb-session "^2.2.0" connect-mongodb-session "^2.2.0"
@ -1523,7 +1524,7 @@ libflitter@^0.46.3:
express-graphql "^0.9.0" express-graphql "^0.9.0"
express-session "^1.15.6" express-session "^1.15.6"
flitter-di "^0.4.0" flitter-di "^0.4.0"
flitter-orm "^0.2.1" flitter-orm "^0.2.2"
graphql "^14.5.4" graphql "^14.5.4"
http-status "^1.4.2" http-status "^1.4.2"
mongo-schematic-class "^1.0.3" mongo-schematic-class "^1.0.3"
@ -2887,6 +2888,11 @@ uuid@^3.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
uuid@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
uuid@~1.4.1: uuid@~1.4.1:
version "1.4.2" version "1.4.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-1.4.2.tgz#453019f686966a6df83cdc5244e7c990ecc332fc" resolved "https://registry.yarnpkg.com/uuid/-/uuid-1.4.2.tgz#453019f686966a6df83cdc5244e7c990ecc332fc"