"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const db_1=require("@b/db"),query_1=require("@b/utils/query");exports.metadata={summary:"Deletes a transaction",operationId:"deleteTransaction",tags:["Admin","Transaction"],parameters:(0,query_1.deleteRecordParams)("transaction"),responses:(0,query_1.deleteRecordResponses)("Transaction"),requiresAuth:!0,permission:"delete.withdraw",logModule:"ADMIN_FIN",logTitle:"Delete Withdraw Log"};exports.default=async e=>{const{params:t,query:r,ctx:a}=e;null==a||a.step("Deleting associated admin profit");await db_1.models.adminProfit.destroy({where:{transactionId:t.id}});null==a||a.step("Deleting withdraw log");const s=await(0,query_1.handleSingleDelete)({model:"transaction",id:t.id,query:r});null==a||a.success("Withdraw log deleted successfully");return s};