"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 Duration",operationId:"updateInvestmentDuration",tags:["Admin","Investment Durations"],parameters:[{index:0,name:"id",in:"path",description:"ID of the Investment Duration to update",required:!0,schema:{type:"string"}}],requestBody:{description:"New data for the Investment Duration",content:{"application/json":{schema:utils_1.investmentDurationUpdateSchema}}},responses:(0,query_1.updateRecordResponses)("Investment Duration"),requiresAuth:!0,permission:"edit.investment.duration",logModule:"ADMIN_FIN",logTitle:"Update Investment Duration"};exports.default=async e=>{const{body:t,params:n,ctx:a}=e,{id:i}=n,{duration:s,timeframe:r}=t;null==a||a.step("Validating investment duration data");null==a||a.step("Updating investment duration record");const o=await(0,query_1.updateRecord)("investmentDuration",i,{duration:s,timeframe:r});null==a||a.success();return o};