fix: Collection names were incorrect

This commit is contained in:
buzz-lightsnack-2007 2025-04-07 21:15:12 +08:00
parent f6ec954c6f
commit 5fa9e6efd6
2 changed files with 7 additions and 3 deletions

View file

@ -26,7 +26,9 @@ class DBManagement {
configure (COLLECTION, SCHEMA) { configure (COLLECTION, SCHEMA) {
this[`schema`] = new Mongoose.Schema(SCHEMA); this[`schema`] = new Mongoose.Schema(SCHEMA);
this[`collection`] = COLLECTION; this[`collection`] = COLLECTION;
this.state.then(() => {this.model = this[`connection`].model(`URL`, this[`schema`]);}) this.state.then(() => {
this.model = this[`connection`].model(this[`collection`], this[`schema`]);
})
} }
/* /*
@ -40,7 +42,7 @@ class DBManagement {
await this.state; await this.state;
let RESULT = []; let RESULT = [];
if ((CRITERIA && CRITERIA instanceof Object) ? !Object.keys(CRITERIA).length : true) { if ((CRITERIA && CRITERIA instanceof Object) ? !(Object.keys(CRITERIA).length) : true) {
RESULT = await this.model.find(); RESULT = await this.model.find();
} else if (CRITERIA instanceof Object) { } else if (CRITERIA instanceof Object) {
RESULT = await this.model.find(CRITERIA); RESULT = await this.model.find(CRITERIA);

View file

@ -53,4 +53,6 @@ class UsersManagement extends DBManagement {
return (CURRENT); return (CURRENT);
}; };
}; };
} }
module.exports = UsersManagement;