Implement CRUD operations for blog posts with Create, Edit, and Delete handlers
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 52s

This commit is contained in:
2025-10-25 11:34:59 +08:00
parent 166382ffa8
commit b05f797eb1
9 changed files with 371 additions and 0 deletions

View File

@@ -36,6 +36,34 @@ type (
}
)
type (
CreatePostReq {
title string `json:"title"`
content string `json:"content"`
cover_image_key string `json:"cover_image_key"`
}
CreatePostResp {
post_id string `json:"post_id"`
}
)
type (
EditPostReq {
post_id string `json:"post_id"`
title string `json:"title"`
content string `json:"content"`
cover_image_key string `json:"cover_image_key"`
}
EditPostResp {}
)
type (
DeletePostReq {
post_id string `json:"post_id"`
}
DeletePostResp {}
)
@server (
prefix: /api/blog
)
@@ -48,6 +76,33 @@ service Blog {
get /ping (PingReq) returns (PingResp)
}
@server (
middleware: SuperAdminAuthMiddleware
prefix: /api/blog/post
)
service Blog {
@doc (
summary: "Create a new blog post"
description: "Create a new blog post"
)
@handler CreatePostHandler
post /create (CreatePostReq) returns (CreatePostResp)
@doc (
summary: "Edit an existing blog post"
description: "Edit an existing blog post"
)
@handler EditPostHandler
post /edit (EditPostReq) returns (EditPostResp)
@doc (
summary: "Delete a blog post"
description: "Delete a blog post"
)
@handler DeletePostHandler
post /delete (DeletePostReq) returns (DeletePostResp)
}
@server (
middleware: SuperAdminAuthMiddleware
prefix: /api/blog