feat(journal): add category show/update API routes and MCP tools

This commit is contained in:
Jakub Zych
2026-11-28 15:05:45 +01:00
parent a047d4284f
commit daa29c8aa8
8 changed files with 580 additions and 58 deletions

View File

@@ -18,6 +18,7 @@ const (
errPublishPermission = "You do not have permission to publish posts"
errEditPermission = "You do not have permission to edit this post"
errPostNotFound = "Post not found"
errCategoryNotFound = "Category not found"
errImageNotFound = "Image not found"
errValidationFailed = "Validation failed"
msgPostDeleted = "Post deleted"
@@ -26,6 +27,7 @@ const (
permAccessPosts = "golem15.journal.access_posts"
permAccessOtherPosts = "golem15.journal.access_other_posts"
permAccessPublish = "golem15.journal.access_publish"
permAccessCategories = "golem15.journal.access_categories"
journalCover = "golem15.journal.*"
)
@@ -105,6 +107,14 @@ func requireAccessPosts(w http.ResponseWriter, pr *bouncer.Principal) bool {
return true
}
func requireAccessCategories(w http.ResponseWriter, pr *bouncer.Principal) bool {
if !cabana.Allows(pr, []string{permAccessCategories}) {
writeAPIError(w, http.StatusForbidden, errInsufficientPerms)
return false
}
return true
}
func gdb(app *backpack.App) (*gorm.DB, error) {
if app == nil {
return nil, errors.New("journal api: application is not configured")