feat: added mutation for update user settings

This commit is contained in:
Mir Arif Hasan
2022-12-19 18:12:49 +06:00
parent 4affb2bc5b
commit 53dc40e8c7
3 changed files with 57 additions and 0 deletions

View File

@@ -35,5 +35,24 @@ export class UserSettingsResolver {
return userSettings.right;
}
@Mutation(() => UserSettings, {
description: 'Update user settings for given user',
})
@UseGuards(GqlAuthGuard)
async updateUserSettings(
@GqlUser() user: User,
@Args({
name: 'properties',
description: 'JSON string of properties object',
})
properties: string,
) {
const updatedUserSettings =
await this.userSettingsService.updateUserSettings(user, properties);
if (E.isLeft(updatedUserSettings)) throwErr(updatedUserSettings.left);
return updatedUserSettings.right;
}
/* Subscriptions */
}