temp admin necesitity

This commit is contained in:
2025-12-10 06:27:25 +00:00
parent 59bc3d494f
commit bd59419a0e

View File

@@ -59,6 +59,11 @@ func (store *Store) CreatePost(ctx *gin.Context) {
}
userID := uint(userIDF)
if !(*claims)["admin"].(bool) {
ctx.JSON(http.StatusForbidden, gin.H{"error": "you are not admin :("})
return
}
// Create post
post := models.Post{Title: input.Title, Content: input.Content, AuthorID: userID}
tx := store.DB.Create(&post)