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