"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 category",operationId:"updateCategory",tags:["Admin","Content","Category"],parameters:[{index:0,name:"id",in:"path",description:"ID of the category to update",required:!0,schema:{type:"string"}}],requestBody:{description:"New data for the category",content:{"application/json":{schema:utils_1.categoryUpdateSchema}}},responses:(0,query_1.updateRecordResponses)("Category"),requiresAuth:!0,permission:"edit.blog.category",logModule:"ADMIN_BLOG",logTitle:"Update category"};exports.default=async e=>{const{body:t,params:a,ctx:r}=e,{id:s}=a,{name:o,slug:i,image:d,description:u}=t;null==r||r.step("Validating category ID and data");null==r||r.step("Updating category");const c=await(0,query_1.updateRecord)("category",s,{name:o,slug:i,image:d,description:u});null==r||r.success("Category updated successfully");return c};