@@ -286,53 +286,53 @@ API.v1.addRoute(
286286) ;
287287
288288const saveNotificationBodySchema = ajv . compile < {
289- roomId : string ;
290- notifications : Record < string , string > ;
289+ roomId : string ;
290+ notifications : Record < string , string > ;
291291} > ( {
292- type : 'object' ,
293- properties : {
294- roomId : { type : 'string' } ,
295- notifications : {
296- type : 'object' ,
297- minProperties : 1 ,
298- additionalProperties : { type : 'string' } ,
299- } ,
300- } ,
301- required : [ 'roomId' , 'notifications' ] ,
302- additionalProperties : false ,
292+ type : 'object' ,
293+ properties : {
294+ roomId : { type : 'string' } ,
295+ notifications : {
296+ type : 'object' ,
297+ minProperties : 1 ,
298+ additionalProperties : { type : 'string' } ,
299+ } ,
300+ } ,
301+ required : [ 'roomId' , 'notifications' ] ,
302+ additionalProperties : false ,
303303} ) ;
304304
305305const saveNotificationResponseSchema = ajv . compile ( {
306- type : 'object' ,
307- properties : {
308- success : { type : 'boolean' , enum : [ true ] } ,
309- } ,
310- required : [ 'success' ] ,
311- additionalProperties : false ,
306+ type : 'object' ,
307+ properties : {
308+ success : { type : 'boolean' , enum : [ true ] } ,
309+ } ,
310+ required : [ 'success' ] ,
311+ additionalProperties : false ,
312312} ) ;
313313
314314export const roomsSaveNotificationEndpoint = API . v1 . post (
315- 'rooms.saveNotification' ,
316- {
317- authRequired : true ,
318- body : saveNotificationBodySchema ,
319- response : {
320- 200 : saveNotificationResponseSchema ,
321- 400 : validateBadRequestErrorResponse ,
322- 401 : validateUnauthorizedErrorResponse ,
323- } ,
324- } ,
325- async function action ( ) {
326- const { roomId, notifications } = this . bodyParams ;
327-
328- await Promise . all (
329- Object . entries ( notifications as Notifications ) . map ( async ( [ notificationKey , notificationValue ] ) =>
330- saveNotificationSettingsMethod ( this . userId , roomId , notificationKey as NotificationFieldType , notificationValue ) ,
331- ) ,
332- ) ;
333-
334- return API . v1 . success ( ) ;
335- } ,
315+ 'rooms.saveNotification' ,
316+ {
317+ authRequired : true ,
318+ body : saveNotificationBodySchema ,
319+ response : {
320+ 200 : saveNotificationResponseSchema ,
321+ 400 : validateBadRequestErrorResponse ,
322+ 401 : validateUnauthorizedErrorResponse ,
323+ } ,
324+ } ,
325+ async function action ( ) {
326+ const { roomId, notifications } = this . bodyParams ;
327+
328+ await Promise . all (
329+ Object . entries ( notifications as Notifications ) . map ( async ( [ notificationKey , notificationValue ] ) =>
330+ saveNotificationSettingsMethod ( this . userId , roomId , notificationKey as NotificationFieldType , notificationValue ) ,
331+ ) ,
332+ ) ;
333+
334+ return API . v1 . success ( ) ;
335+ } ,
336336) ;
337337
338338API . v1 . addRoute (
0 commit comments