Update:Create & update API endpoints to create with new data model

This commit is contained in:
advplyr 2024-08-17 17:18:40 -05:00
parent 1b914d5d4f
commit 5308fd8b46
6 changed files with 184 additions and 70 deletions

View file

@ -359,7 +359,7 @@ class Database {
* @param {string} username
* @param {string} pash
* @param {Auth} auth
* @returns {boolean} true if created
* @returns {Promise<boolean>} true if created
*/
async createRootUser(username, pash, auth) {
if (!this.sequelize) return false
@ -379,17 +379,6 @@ class Database {
return this.models.setting.updateSettingObj(settings.toJSON())
}
async createUser(oldUser) {
if (!this.sequelize) return false
await this.models.user.createFromOld(oldUser)
return true
}
updateUser(oldUser) {
if (!this.sequelize) return false
return this.models.user.updateFromOld(oldUser)
}
updateBulkBooks(oldBooks) {
if (!this.sequelize) return false
return Promise.all(oldBooks.map((oldBook) => this.models.book.saveFromOld(oldBook)))