"use strict";async function getPost(t){return await db_1.models.post.findOne({where:{id:t},include:[{model:db_1.models.author,as:"author",include:[{model:db_1.models.user,as:"user",attributes:["id","firstName","lastName","email","avatar"],include:[{model:db_1.models.role,as:"role",attributes:["name"]}]}]},{model:db_1.models.category,as:"category"},{model:db_1.models.tag,as:"tags",through:{attributes:[]}}]})}Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;exports.getPost=getPost;const db_1=require("@b/db");exports.metadata={summary:"Retrieves a single blog post by ID",description:"This endpoint retrieves a single blog post by its ID.",operationId:"getPostById",tags:["Admin","Content"],requiresAuth:!1,parameters:[{index:0,name:"id",in:"path",description:"The ID of the blog post to retrieve",required:!0,schema:{type:"string",description:"Post ID"}}],responses:{200:{description:"Blog post retrieved successfully",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean",description:"Indicates if the request was successful"},statusCode:{type:"number",description:"HTTP status code",example:200},data:{type:"object",properties:{id:{type:"string"},title:{type:"string"},content:{type:"string"},categoryId:{type:"string"},authorId:{type:"string"},slug:{type:"string"},description:{type:"string",nullable:!0},status:{type:"string",enum:["PUBLISHED","DRAFT","TRASH"]},image:{type:"string",nullable:!0},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time",nullable:!0},author:{type:"object",properties:{id:{type:"string"},userId:{type:"string"}}},category:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"}}},postTag:{type:"array",items:{type:"object",properties:{id:{type:"string"},postId:{type:"string"},tagId:{type:"string"}}}}}}}}}}},404:{description:"Blog post not found"},500:{description:"Internal server error"}},permission:"view.blog.post",demoMask:["author.user.email"],logModule:"ADMIN_BLOG",logTitle:"Get blog post by ID"};exports.default=async t=>{const{params:e,ctx:s}=t;null==s||s.step("Validating blog post ID");null==s||s.step("Fetching blog post with relations");const o=await getPost(e.id);null==s||s.success("Blog post retrieved successfully");return o};