"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const query_1=require("@b/utils/query"),utils_1=require("../utils");exports.metadata={summary:"Updates a specific Investment",operationId:"updateInvestment",tags:["Admin","Investments"],parameters:[{index:0,name:"id",in:"path",description:"ID of the Investment to update",required:!0,schema:{type:"string"}}],requestBody:{description:"New data for the Investment",content:{"application/json":{schema:utils_1.investmentUpdateSchema}}},responses:(0,query_1.updateRecordResponses)("Investment"),requiresAuth:!0,permission:"edit.investment",logModule:"ADMIN_FIN",logTitle:"Update Investment History"};exports.default=async e=>{const{body:t,params:s,ctx:n}=e,{id:a}=s,{userId:r,planId:i,durationId:d,amount:u,profit:o,result:p,status:m,endDate:l}=t;null==n||n.step("Validating investment data");null==n||n.step("Updating investment record");const c=await(0,query_1.updateRecord)("investment",a,{userId:r,planId:i,durationId:d,amount:u,profit:o,result:p,status:m,endDate:l});null==n||n.success();return c};