"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:"Delete All Notifications",description:"Deletes all notifications for the authenticated creator.",operationId:"deleteAllNotifications",tags:["ICO","Creator","Notifications"],requiresAuth:!0,logModule:"USER",logTitle:"Delete all notifications",responses:{200:{description:"All notifications deleted successfully."},401:{description:"Unauthorized"},500:{description:"Internal Server Error"}}};exports.default=async e=>{const{user:t,ctx:i}=e;if(!(null==t?void 0:t.id)){null==i||i.fail("User not authenticated");throw(0,error_1.createError)({statusCode:401,message:"Unauthorized"})}null==i||i.step("Deleting all notifications");await db_1.models.notification.destroy({where:{userId:t.id},force:!0});null==i||i.success("All notifications deleted successfully");return{message:"All notifications deleted successfully."}};