handler

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler added in v1.1.0

type AuthHandler struct {
	Core *core.Core

	AuthService *service.AuthService
}

func NewAuthHandler added in v1.1.0

func NewAuthHandler(c *core.Core, authService *service.AuthService) *AuthHandler

func (*AuthHandler) Login added in v1.1.0

func (h *AuthHandler) Login(c *fiber.Ctx) error

Login @summary Login existing user @tags auth @produce json @param payload body request.LoginRequest true "JSON payload" @router /api/v1/auth/login [post] @success 201 {object} utils.JSONResponse{data=transformer.LoginTransformer} @success 422

func (*AuthHandler) Me added in v1.1.0

func (h *AuthHandler) Me(c *fiber.Ctx) error

Me @summary Get authenticated user @tags auth @produce json @router /api/v1/auth/me [get] @success 201 {object} utils.JSONResponse{data=transformer.MeTransformer} @success 401 @Security Bearer

func (*AuthHandler) Register added in v1.1.0

func (h *AuthHandler) Register(c *fiber.Ctx) error

Register @summary Register a new user @tags auth @produce json @param payload body request.RegisterRequest true "JSON payload" @router /api/v1/auth/register [post] @success 201 {object} utils.JSONResponse{data=transformer.RegisterTransformer} @success 422

type BlogHandler added in v1.1.0

type BlogHandler struct {
	Core *core.Core

	BlogService *service.BlogService
}

func NewBlogHandler added in v1.1.0

func NewBlogHandler(c *core.Core, blogService *service.BlogService) *BlogHandler

func (*BlogHandler) Destroy added in v1.1.0

func (h *BlogHandler) Destroy(c *fiber.Ctx) error

DeleteBlog @summary Delete existing blog by ID @tags blog @produce json @param id path int true "blog id" @router /api/v1/blogs/{id} [delete] @success 200 {object} utils.JSONResponse @success 404 @Security Bearer

func (*BlogHandler) Index added in v1.1.0

func (h *BlogHandler) Index(c *fiber.Ctx) error

GetBlogs @summary Get all blogs @tags blog @produce json @router /api/v1/blogs [get] @success 200 {object} utils.JSONResponse{data=[]transformer.BlogTransformer} @Security Bearer

func (*BlogHandler) Show added in v1.1.0

func (h *BlogHandler) Show(c *fiber.Ctx) error

GetBlog @summary Get single blog by ID @tags blog @produce json @param id path int true "blog id" @router /api/v1/blogs/{id} [get] @success 200 {object} utils.JSONResponse{data=transformer.BlogTransformer} @failure 404 @Security Bearer

func (*BlogHandler) Store added in v1.1.0

func (h *BlogHandler) Store(c *fiber.Ctx) error

StoreBlog @summary Save blog to database @tags blog @produce json @param payload body request.CreateBlogRequest true "JSON payload" @router /api/v1/blogs [post] @success 201 {object} utils.JSONResponse{data=transformer.BlogTransformer} @success 422 @Security Bearer

func (*BlogHandler) Update added in v1.1.0

func (h *BlogHandler) Update(c *fiber.Ctx) error

UpdateBlog @summary Update existing blog by ID @tags blog @produce json @param id path int true "blog id" @param payload body request.UpdateBlogRequest true "JSON payload" @router /api/v1/blogs/{id} [put] @success 200 {object} utils.JSONResponse{data=transformer.BlogTransformer} @success 404 @success 422 @Security Bearer

type Handler

type Handler struct {
	Core *core.Core
	Ping *PingHandler
	Auth *AuthHandler
	Blog *BlogHandler
}

func NewHandler

func NewHandler(
	c *core.Core,
	authService *service.AuthService,
	blogService *service.BlogService,
) *Handler

type PingHandler

type PingHandler struct {
	Core *core.Core
}

func NewPingHandler

func NewPingHandler(c *core.Core) *PingHandler

func (*PingHandler) Ping

func (h *PingHandler) Ping(c *fiber.Ctx) error

Ping @summary Ping to the service @description Do a ping to service just make sure service is working normally. @tags tools @produce json @router /api/v1/ping [get] @success 200 {object} utils.JSONResponse

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL