[MSP-1388]::[v] описание для swagger

This commit is contained in:
Leonid Nikolaev committed 2023-01-27 20:27:26 +03:00
1 parent b4e9c9a563
commit 2e2b903463
5 files changed
+40 -12

No files matched your search

+22 -4
View File
@@ -9,10 +9,8 @@ import (
)
type LockerService interface {
// All(ctx context.Context) ([]domain.Locker, error)
// Get(ctx context.Context, id int) (*domain.Locker, error)
Lock(ctx context.Context, req domain.Request) (*domain.LockResponse, error)
UnLock(ctx context.Context, req domain.Request) (domain.LockResponse, error)
UnLock(ctx context.Context, req domain.Request) (*domain.LockResponse, error)
}
type Locker struct {
@@ -20,12 +18,32 @@ type Locker struct {
logger log.Logger
}
// Lock
// @Tags locker
// @Summary выставляем лок на строку
// @Description `key` - строка для лока
// @Description Возвращаем ключ для разблокировки
// @Accept json
// @Produce json
// @Success 200 {object} domain.LockResponse
// @Failure 500 {object}
// @Router /api/isp-lock-service/lock [POST]
func (l Locker) Lock(ctx context.Context, req domain.Request) (*domain.LockResponse, error) {
l.logger.Debug(ctx, "call ctrl.Lock")
return l.s.Lock(ctx, req)
}
func (l Locker) UnLock(ctx context.Context, req domain.Request) (domain.LockResponse, error) {
// UnLock
// @Tags locker
// @Summary снимаем лок со строки
// @Description `key` - строка для лока
// @Description `locKKey` - ключ для разблокировки, полученный из Lock
// @Accept json
// @Produce json
// @Success 200 {object} domain.LockResponse
// @Failure 500 {object} {}
// @Router /api/isp-lock-service/lock [POST]
func (l Locker) UnLock(ctx context.Context, req domain.Request) (*domain.LockResponse, error) {
l.logger.Debug(ctx, "call ctrl.UnLock")
return l.s.UnLock(ctx, req)
}