http

package
v0.0.0-...-3010e5a Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilReference = errors.New("got nil reference")
)

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func New

func New(
	log *zap.Logger,
	cfg controller.Config,
	service controller.Service,
) (*Controller, error)

New initializes application with provided objects.

func (*Controller) HandleCreateRecord

func (srv *Controller) HandleCreateRecord(ctx *fiber.Ctx) error

HandleCreateRecord creates new record into service.

@Tags		records-controller
@Summary	Создание новых записей
@Accept		json,xml,x-www-form-urlencoded
@Produce	json
@Param		request	body		model.CreateRecordRequest	true	"Records"
@Success	201		{object}	model.CreateRecordResponse	"Created"
@Failure	400		{object}	model.BadRequestResponse	"Bad Request"
@Router		/api/records/ [post]

func (*Controller) HandleGetAllRecords

func (srv *Controller) HandleGetAllRecords(ctx *fiber.Ctx) error

HandleGetAllRecords returns all records.

@Tags		records-controller
@Summary	Получение записей пользователя
@Accept		json
@Produce	json
@Success	200	{object}	model.GetAllRecordsResponse	"OK
@Failure	400	{object}	model.BadRequestResponse	"Bad Request"
@Router		/api/records/ [get]

func (*Controller) HandleGetRecord

func (srv *Controller) HandleGetRecord(ctx *fiber.Ctx) error

HandleGetRecord returns record by id.

@Tags		records-controller
@Summary	Получение записи
@Accept		json
@Produce	json
@Param		record_id	path		int							true	"record identifier"
@Success	200			{object}	model.GetRecordResponse		"OK"
@Failure	400			{object}	model.BadRequestResponse	"Bad Request"
@Router		/api/records/{record_id} [get]

func (*Controller) HandleGetUserRecords

func (srv *Controller) HandleGetUserRecords(ctx *fiber.Ctx) error

HandleGetUserRecords returns records of user.

@Tags		records-controller
@Summary	Получение записей пользователя
@Accept		json
@Produce	json
@Param		user_id	path		string							true	"user identifier"
@Success	200		{object}	model.GetUserRecordsResponse	"OK
@Failure	400		{object}	model.BadRequestResponse		"Bad Request"
@Router		/api/user/{user_id}/records [get]

func (*Controller) HandlePing

func (srv *Controller) HandlePing(ctx *fiber.Ctx) error

func (*Controller) Start

func (srv *Controller) Start(context.Context) error

func (*Controller) Stop

func (srv *Controller) Stop(context.Context) error

Stop gracefully stops server.

Jump to

Keyboard shortcuts

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