From 1eaab9475ac12d460b3cdb322b6f3a96f8cfcded Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Mon, 8 Jan 2024 11:37:20 +1100 Subject: [PATCH] Add modifyUser function to modify the user's messages --- src/models/userLevels.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/models/userLevels.ts b/src/models/userLevels.ts index 58b0e93..f253ffe 100644 --- a/src/models/userLevels.ts +++ b/src/models/userLevels.ts @@ -56,6 +56,10 @@ export class UserLevelsSvc { async deleteUser(userId:string) { return await this.model.destroy({where: {id: userId}}); } + async modifyUser(userId:string, updatedMessages:number) { + await this.model.update({messages: updatedMessages}, {where: {id: userId}}); + return (await this.model.findByPk(userId)).dataValues; + } async messageIncremental(userId:string) { const data = await this.model.findByPk(userId); if (data) {