"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const db_1=require("@b/db"),error_1=require("@b/utils/error");exports.metadata={summary:"Mark All Notifications as Read",description:"Marks all notifications as read for the authenticated creator.",operationId:"markAllNotificationsRead",tags:["ICO","Creator","Notifications"],requiresAuth:!0,logModule:"USER",logTitle:"Mark all notifications as read",responses:{200:{description:"All notifications marked as read successfully."},401:{description:"Unauthorized"},500:{description:"Internal Server Error"}}};exports.default=async e=>{const{user:r,ctx:a}=e;if(!(null==r?void 0:r.id)){null==a||a.fail("User not authenticated");throw(0,error_1.createError)({statusCode:401,message:"Unauthorized"})}null==a||a.step("Marking all notifications as read");await db_1.models.notification.update({read:!0},{where:{userId:r.id}});null==a||a.success("All notifications marked as read");return{message:"All notifications marked as read successfully."}};