feat: add auth to swagerr add middleware for check admin

This commit is contained in:
d3m0k1d
2026-02-14 16:26:27 +03:00
parent 05a8f0cbc7
commit 7e4dbd7e56
6 changed files with 123 additions and 3 deletions

View File

@@ -95,6 +95,7 @@ func (h *PostHandlers) GetPost(c *gin.Context) {
// @Accept json
// @Produce json
// @Param post body storage.PostCreate true "Post data"
// @Security Bearer
// @Success 200 {object} models.SuccessResponse{data=storage.Post}
// @Failure 400 {object} models.ErrorResponse "Invalid request"
// @Router /posts [post]
@@ -127,6 +128,7 @@ func (h *PostHandlers) CreatePost(c *gin.Context) {
// @Param id path int true "Post ID"
// @Param post body storage.PostCreate true "Post data"
// @Produce json
// @Security Bearer
// @Success 200 {object} models.SuccessResponse{data=storage.PostCreate}
// @Failure 400 {object} models.ErrorResponse "Invalid ID format"
// @Failure 500 {object} models.ErrorResponse "Internal server error"
@@ -162,6 +164,7 @@ func (h *PostHandlers) UpdatePost(c *gin.Context) {
// @Param id path int true "Post ID"
// @Accept json
// @Produce json
// @Security Bearer
// @Failure 404 {object} models.ErrorResponse "Post not found"
// @Failure 400 {object} models.ErrorResponse "Invalid ID format"
// @Failure 500 {object} models.ErrorResponse "Internal server error"