MSP-5186 Swag fmt
This commit is contained in:
1 parent
d469809107
commit
3a94df1eb0
7 files changed
+304
-277
No files matched your search
+33
-30
@@ -26,16 +26,17 @@ func NewAccessList(service AccessListService) AccessList {
|
||||
}
|
||||
|
||||
// GetById godoc
|
||||
// @Tags accessList
|
||||
// @Summary Получить список доступности методов для приложения
|
||||
// @Description Возвращает список методов для приложения, для которых заданы настройки доступа
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity false "идентификатор приложения"
|
||||
// @Success 200 {array} domain.MethodInfo "список доступности методов"
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /access_list/get_by_id [POST]
|
||||
//
|
||||
// @Tags accessList
|
||||
// @Summary Получить список доступности методов для приложения
|
||||
// @Description Возвращает список методов для приложения, для которых заданы настройки доступа
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity false "идентификатор приложения"
|
||||
// @Success 200 {array} domain.MethodInfo "список доступности методов"
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /access_list/get_by_id [POST]
|
||||
func (c AccessList) GetById(ctx context.Context, req domain.Identity) ([]domain.MethodInfo, error) {
|
||||
result, err := c.service.GetById(ctx, req.Id)
|
||||
switch {
|
||||
@@ -49,16 +50,17 @@ func (c AccessList) GetById(ctx context.Context, req domain.Identity) ([]domain.
|
||||
}
|
||||
|
||||
// SetOne godoc
|
||||
// @Tags accessList
|
||||
// @Summary Настроить доступность метода для приложения
|
||||
// @Description Возвращает количество измененных строк
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.AccessListSetOneRequest false "объект для настройки доступа"
|
||||
// @Success 200 {object} domain.AccessListSetOneResponse "количество измененных строк"
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /access_list/set_one [POST]
|
||||
//
|
||||
// @Tags accessList
|
||||
// @Summary Настроить доступность метода для приложения
|
||||
// @Description Возвращает количество измененных строк
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.AccessListSetOneRequest false "объект для настройки доступа"
|
||||
// @Success 200 {object} domain.AccessListSetOneResponse "количество измененных строк"
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /access_list/set_one [POST]
|
||||
func (c AccessList) SetOne(ctx context.Context, req domain.AccessListSetOneRequest) (*domain.AccessListSetOneResponse, error) {
|
||||
result, err := c.service.SetOne(ctx, req)
|
||||
switch {
|
||||
@@ -72,16 +74,17 @@ func (c AccessList) SetOne(ctx context.Context, req domain.AccessListSetOneReque
|
||||
}
|
||||
|
||||
// SetList godoc
|
||||
// @Tags accessList
|
||||
// @Summary Настроить доступность списка методов для приложения
|
||||
// @Description Возвращает список методов для приложения, для которых заданы настройки доступа
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.AccessListSetListRequest false "объект настройки доступа"
|
||||
// @Success 200 {array} domain.MethodInfo "список доступности методов"
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /access_list/set_list [POST]
|
||||
//
|
||||
// @Tags accessList
|
||||
// @Summary Настроить доступность списка методов для приложения
|
||||
// @Description Возвращает список методов для приложения, для которых заданы настройки доступа
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.AccessListSetListRequest false "объект настройки доступа"
|
||||
// @Success 200 {array} domain.MethodInfo "список доступности методов"
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /access_list/set_list [POST]
|
||||
func (c AccessList) SetList(ctx context.Context, req domain.AccessListSetListRequest) ([]domain.MethodInfo, error) {
|
||||
result, err := c.service.SetList(ctx, req)
|
||||
switch {
|
||||
|
||||
+108
-99
@@ -34,17 +34,18 @@ func NewApplication(service ApplicationService) Application {
|
||||
}
|
||||
|
||||
// GetById godoc
|
||||
// @Tags application
|
||||
// @Summary Получить приложение по идентификатору
|
||||
// @Description Возвращает описание приложения по его идентификатору
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор приложения"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_application_by_id [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Получить приложение по идентификатору
|
||||
// @Description Возвращает описание приложения по его идентификатору
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор приложения"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_application_by_id [POST]
|
||||
func (c Application) GetById(ctx context.Context, req domain.Identity) (*domain.ApplicationWithTokens, error) {
|
||||
result, err := c.service.GetById(ctx, req.Id)
|
||||
switch {
|
||||
@@ -58,59 +59,63 @@ func (c Application) GetById(ctx context.Context, req domain.Identity) (*domain.
|
||||
}
|
||||
|
||||
// GetByIdList godoc
|
||||
// @Tags application
|
||||
// @Summary Получить список приложений
|
||||
// @Description Возвращает массив приложений с токенами по их идентификаторам
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer false "Массив идентификаторов приложений"
|
||||
// @Success 200 {array} domain.ApplicationWithTokens
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_applications [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Получить список приложений
|
||||
// @Description Возвращает массив приложений с токенами по их идентификаторам
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer false "Массив идентификаторов приложений"
|
||||
// @Success 200 {array} domain.ApplicationWithTokens
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_applications [POST]
|
||||
func (c Application) GetByIdList(ctx context.Context, req []int) ([]*domain.ApplicationWithTokens, error) {
|
||||
return c.service.GetByIdList(ctx, req)
|
||||
}
|
||||
|
||||
// GetByServiceId godoc
|
||||
// @Tags application
|
||||
// @Summary Получить список приложений по идентификатору сервиса
|
||||
// @Description Возвращает список приложений по запрошенному идентификатору сервиса
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор сервиса"
|
||||
// @Success 200 {array} domain.ApplicationWithTokens
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_applications_by_service_id [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Получить список приложений по идентификатору сервиса
|
||||
// @Description Возвращает список приложений по запрошенному идентификатору сервиса
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор сервиса"
|
||||
// @Success 200 {array} domain.ApplicationWithTokens
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_applications_by_service_id [POST]
|
||||
func (c Application) GetByServiceId(ctx context.Context, req domain.Identity) ([]*domain.ApplicationWithTokens, error) {
|
||||
return c.service.GetByServiceId(ctx, req.Id)
|
||||
}
|
||||
|
||||
// GetSystemTree godoc
|
||||
// @Tags application
|
||||
// @Summary Метод получения системного дерева
|
||||
// @Description Возвращает описание взаимосвязей сервисов и приложений
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} domain.DomainWithService
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_system_tree [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Метод получения системного дерева
|
||||
// @Description Возвращает описание взаимосвязей сервисов и приложений
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} domain.DomainWithService
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_system_tree [POST]
|
||||
func (c Application) GetSystemTree(ctx context.Context) ([]*domain.DomainWithService, error) {
|
||||
return c.service.SystemTree(ctx, domain.DefaultSystemId)
|
||||
}
|
||||
|
||||
// CreateUpdate godoc
|
||||
// @Tags application
|
||||
// @Summary Создать/обновить приложение
|
||||
// @Description Если приложение с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.ApplicationCreateUpdateRequest true "Объект приложения"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 409 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/create_update_application [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Создать/обновить приложение
|
||||
// @Description Если приложение с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.ApplicationCreateUpdateRequest true "Объект приложения"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 409 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/create_update_application [POST]
|
||||
func (c Application) CreateUpdate(ctx context.Context, req domain.ApplicationCreateUpdateRequest) (*domain.ApplicationWithTokens, error) {
|
||||
result, err := c.service.CreateUpdate(ctx, req)
|
||||
switch {
|
||||
@@ -128,16 +133,17 @@ func (c Application) CreateUpdate(ctx context.Context, req domain.ApplicationCre
|
||||
}
|
||||
|
||||
// Delete godoc
|
||||
// @Tags application
|
||||
// @Summary Удалить приложения
|
||||
// @Description Удаляет приложения по списку их идентификаторов, возвращает количество удаленных приложений
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer false "Массив идентификаторов приложений"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/delete_applications [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Удалить приложения
|
||||
// @Description Удаляет приложения по списку их идентификаторов, возвращает количество удаленных приложений
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer false "Массив идентификаторов приложений"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/delete_applications [POST]
|
||||
func (c Application) Delete(ctx context.Context, req []int) (*domain.DeleteResponse, error) {
|
||||
if len(req) == 0 {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "At least one id are required")
|
||||
@@ -154,44 +160,46 @@ func (c Application) Delete(ctx context.Context, req []int) (*domain.DeleteRespo
|
||||
}
|
||||
|
||||
// NextId godoc
|
||||
// @Tags application
|
||||
// @Summary Получить следующий идентификатор приложения
|
||||
// @Description Возвращает следующий идентификатор приложения
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} integer
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/next_id [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Получить следующий идентификатор приложения
|
||||
// @Description Возвращает следующий идентификатор приложения
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} integer
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/next_id [POST]
|
||||
func (c Application) NextId(ctx context.Context) (int, error) {
|
||||
return c.service.NextId(ctx)
|
||||
}
|
||||
|
||||
// GetAll godoc
|
||||
// @Tags application
|
||||
// @Summary Получить список приложений
|
||||
// @Description Возвращает список приложений
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} domain.Application
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_all [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Получить список приложений
|
||||
// @Description Возвращает список приложений
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} domain.Application
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/get_all [POST]
|
||||
func (c Application) GetAll(ctx context.Context) ([]domain.Application, error) {
|
||||
return c.service.GetAll(ctx)
|
||||
}
|
||||
|
||||
// Create godoc
|
||||
// @Tags application
|
||||
// @Summary Создать приложение
|
||||
// @Description Если приложение с такими идентификатором или связкой `applicationGroupId`-`name` существует, то возвращает ошибку
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.CreateApplicationRequest true "Объект приложения"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 409 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/create_application [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Создать приложение
|
||||
// @Description Если приложение с такими идентификатором или связкой `applicationGroupId`-`name` существует, то возвращает ошибку
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.CreateApplicationRequest true "Объект приложения"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 409 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/create_application [POST]
|
||||
func (c Application) Create(ctx context.Context, req domain.CreateApplicationRequest) (*domain.ApplicationWithTokens, error) {
|
||||
result, err := c.service.Create(ctx, req)
|
||||
switch {
|
||||
@@ -207,18 +215,19 @@ func (c Application) Create(ctx context.Context, req domain.CreateApplicationReq
|
||||
}
|
||||
|
||||
// Update godoc
|
||||
// @Tags application
|
||||
// @Summary Обновить приложение
|
||||
// @Description Если приложение с связкой `applicationGroupId`-`name` существует или приложение не найдено, то возвращает ошибку
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.UpdateApplicationRequest true "Объект приложения"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 409 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/update_application [POST]
|
||||
//
|
||||
// @Tags application
|
||||
// @Summary Обновить приложение
|
||||
// @Description Если приложение с связкой `applicationGroupId`-`name` существует или приложение не найдено, то возвращает ошибку
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.UpdateApplicationRequest true "Объект приложения"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 409 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /application/update_application [POST]
|
||||
func (c Application) Update(ctx context.Context, req domain.UpdateApplicationRequest) (*domain.ApplicationWithTokens, error) {
|
||||
result, err := c.service.Update(ctx, req)
|
||||
switch {
|
||||
|
||||
+42
-38
@@ -27,16 +27,17 @@ func NewDomain(service DomainService) Domain {
|
||||
}
|
||||
|
||||
// GetById godoc
|
||||
// @Tags domain
|
||||
// @Summary Получить домен по идентификатору
|
||||
// @Description Возвращает описание домена по его идентификатору
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор домена"
|
||||
// @Success 200 {object} domain.Domain
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /domain/get_domain_by_id [POST]
|
||||
//
|
||||
// @Tags domain
|
||||
// @Summary Получить домен по идентификатору
|
||||
// @Description Возвращает описание домена по его идентификатору
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор домена"
|
||||
// @Success 200 {object} domain.Domain
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /domain/get_domain_by_id [POST]
|
||||
func (c Domain) GetById(ctx context.Context, req domain.Identity) (*domain.Domain, error) {
|
||||
result, err := c.service.GetById(ctx, req.Id)
|
||||
switch {
|
||||
@@ -50,29 +51,31 @@ func (c Domain) GetById(ctx context.Context, req domain.Identity) (*domain.Domai
|
||||
}
|
||||
|
||||
// GetBySystemId godoc
|
||||
// @Tags domain
|
||||
// @Summary Получить домены по идентификатору системы
|
||||
// @Description Возвращает список доменов по системному идентификатору
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body integer false "Идентификатор системы"
|
||||
// @Success 200 {array} domain.Domain
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /domain/get_domains_by_system_id [POST]
|
||||
//
|
||||
// @Tags domain
|
||||
// @Summary Получить домены по идентификатору системы
|
||||
// @Description Возвращает список доменов по системному идентификатору
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body integer false "Идентификатор системы"
|
||||
// @Success 200 {array} domain.Domain
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /domain/get_domains_by_system_id [POST]
|
||||
func (c Domain) GetBySystemId(ctx context.Context) ([]domain.Domain, error) {
|
||||
return c.service.GetBySystemId(ctx, domain.DefaultSystemId)
|
||||
}
|
||||
|
||||
// CreateUpdate godoc
|
||||
// @Tags domain
|
||||
// @Summary Создать/обновить домен
|
||||
// @Description Если домен с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.DomainCreateUpdateRequest true "Объект домена"
|
||||
// @Success 200 {object} domain.Domain
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /domain/create_update_domain [POST]
|
||||
//
|
||||
// @Tags domain
|
||||
// @Summary Создать/обновить домен
|
||||
// @Description Если домен с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.DomainCreateUpdateRequest true "Объект домена"
|
||||
// @Success 200 {object} domain.Domain
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /domain/create_update_domain [POST]
|
||||
func (c Domain) CreateUpdate(ctx context.Context, req domain.DomainCreateUpdateRequest) (*domain.Domain, error) {
|
||||
result, err := c.service.CreateUpdate(ctx, req, domain.DefaultSystemId)
|
||||
switch {
|
||||
@@ -90,16 +93,17 @@ func (c Domain) CreateUpdate(ctx context.Context, req domain.DomainCreateUpdateR
|
||||
}
|
||||
|
||||
// Delete godoc
|
||||
// @Tags domain
|
||||
// @Summary Удаление доменов
|
||||
// @Description Удаляет домены по списку их идентификаторов, возвращает количество удаленных доменов
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer false "Массив идентификаторов доменов"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /domain/delete_domains [POST]
|
||||
//
|
||||
// @Tags domain
|
||||
// @Summary Удаление доменов
|
||||
// @Description Удаляет домены по списку их идентификаторов, возвращает количество удаленных доменов
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer false "Массив идентификаторов доменов"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /domain/delete_domains [POST]
|
||||
func (c Domain) Delete(ctx context.Context, req []int) (*domain.DeleteResponse, error) {
|
||||
if len(req) == 0 {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "at least one id are required")
|
||||
|
||||
+20
-18
@@ -23,15 +23,16 @@ func NewSecure(service SecureService) Secure {
|
||||
}
|
||||
|
||||
// Authenticate godoc
|
||||
// @Tags secure
|
||||
// @Summary Метод аутентификации токена
|
||||
// @Description Проверяет наличие токена в системе,
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.AuthenticateRequest true "Тело запроса"
|
||||
// @Success 200 {array} domain.AuthenticateResponse
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /secure/authenticate [POST]
|
||||
//
|
||||
// @Tags secure
|
||||
// @Summary Метод аутентификации токена
|
||||
// @Description Проверяет наличие токена в системе,
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.AuthenticateRequest true "Тело запроса"
|
||||
// @Success 200 {array} domain.AuthenticateResponse
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /secure/authenticate [POST]
|
||||
func (c Secure) Authenticate(ctx context.Context, req domain.AuthenticateRequest) (*domain.AuthenticateResponse, error) {
|
||||
result, err := c.service.Authenticate(ctx, req.Token)
|
||||
switch {
|
||||
@@ -56,15 +57,16 @@ func (c Secure) Authenticate(ctx context.Context, req domain.AuthenticateRequest
|
||||
}
|
||||
|
||||
// Authorize godoc
|
||||
// @Tags secure
|
||||
// @Summary Метод авторизации приложения
|
||||
// @Description Проверяет доступ приложения к запрашиваемому ендпоинту
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.AuthorizeRequest true "Тело запрос"
|
||||
// @Success 200 {array} domain.AuthorizeResponse
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /secure/authorize [POST]
|
||||
//
|
||||
// @Tags secure
|
||||
// @Summary Метод авторизации приложения
|
||||
// @Description Проверяет доступ приложения к запрашиваемому ендпоинту
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.AuthorizeRequest true "Тело запрос"
|
||||
// @Success 200 {array} domain.AuthorizeResponse
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /secure/authorize [POST]
|
||||
func (c Secure) Authorize(ctx context.Context, req domain.AuthorizeRequest) (*domain.AuthorizeResponse, error) {
|
||||
result, err := c.service.Authorize(ctx, req.ApplicationId, req.Endpoint)
|
||||
switch {
|
||||
|
||||
+55
-50
@@ -29,16 +29,17 @@ func NewService(service ServiceService) Service {
|
||||
}
|
||||
|
||||
// GetById godoc
|
||||
// @Tags service
|
||||
// @Summary Получить сервис по идентификатору
|
||||
// @Description Возвращает описание сервиса по его идентификатору
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор сервиса"
|
||||
// @Success 200 {object} domain.Service
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/get_service_by_id [POST]
|
||||
//
|
||||
// @Tags service
|
||||
// @Summary Получить сервис по идентификатору
|
||||
// @Description Возвращает описание сервиса по его идентификатору
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор сервиса"
|
||||
// @Success 200 {object} domain.Service
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/get_service_by_id [POST]
|
||||
func (c Service) GetById(ctx context.Context, req domain.Identity) (*domain.Service, error) {
|
||||
result, err := c.service.GetById(ctx, req.Id)
|
||||
switch {
|
||||
@@ -52,46 +53,49 @@ func (c Service) GetById(ctx context.Context, req domain.Identity) (*domain.Serv
|
||||
}
|
||||
|
||||
// Get godoc
|
||||
// @Tags service
|
||||
// @Summary Получить список сервисов
|
||||
// @Description Возвращает список сервисов по их идентификаторам
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer false "Массив идентификаторов сервисов"
|
||||
// @Success 200 {array} domain.Service
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/get_service [POST]
|
||||
//
|
||||
// @Tags service
|
||||
// @Summary Получить список сервисов
|
||||
// @Description Возвращает список сервисов по их идентификаторам
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer false "Массив идентификаторов сервисов"
|
||||
// @Success 200 {array} domain.Service
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/get_service [POST]
|
||||
func (c Service) Get(ctx context.Context, req []int) ([]domain.Service, error) {
|
||||
return c.service.GetByIdList(ctx, req)
|
||||
}
|
||||
|
||||
// GetByDomainId godoc
|
||||
// @Tags service
|
||||
// @Summary Получить список сервисов по идентификатору домена
|
||||
// @Description Возвращает список сервисов по идентификатору домена
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор домена"
|
||||
// @Success 200 {array} domain.Service
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/get_services_by_domain_id [POST]
|
||||
//
|
||||
// @Tags service
|
||||
// @Summary Получить список сервисов по идентификатору домена
|
||||
// @Description Возвращает список сервисов по идентификатору домена
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор домена"
|
||||
// @Success 200 {array} domain.Service
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/get_services_by_domain_id [POST]
|
||||
func (c Service) GetByDomainId(ctx context.Context, req domain.Identity) ([]domain.Service, error) {
|
||||
return c.service.GetByDomainId(ctx, req.Id)
|
||||
}
|
||||
|
||||
// CreateUpdate godoc
|
||||
// @Tags service
|
||||
// @Summary Создать/обновить сервис
|
||||
// @Description Если сервис с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.ServiceCreateUpdateRequest true "Объект сервиса"
|
||||
// @Success 200 {object} domain.Service
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 409 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/create_update_service [POST]
|
||||
//
|
||||
// @Tags service
|
||||
// @Summary Создать/обновить сервис
|
||||
// @Description Если сервис с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.ServiceCreateUpdateRequest true "Объект сервиса"
|
||||
// @Success 200 {object} domain.Service
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 404 {object} domain.GrpcError
|
||||
// @Failure 409 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/create_update_service [POST]
|
||||
func (c Service) CreateUpdate(ctx context.Context, req domain.ServiceCreateUpdateRequest) (*domain.Service, error) {
|
||||
result, err := c.service.CreateUpdate(ctx, req)
|
||||
switch {
|
||||
@@ -109,16 +113,17 @@ func (c Service) CreateUpdate(ctx context.Context, req domain.ServiceCreateUpdat
|
||||
}
|
||||
|
||||
// Delete godoc
|
||||
// @Tags service
|
||||
// @Summary Удалить сервисы
|
||||
// @Description Удаляет сервисов по списку их идентификаторов, возвращает количество удаленных сервисов
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer true "Массив идентификаторов сервисов"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/delete_service [POST]
|
||||
//
|
||||
// @Tags service
|
||||
// @Summary Удалить сервисы
|
||||
// @Description Удаляет сервисов по списку их идентификаторов, возвращает количество удаленных сервисов
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []integer true "Массив идентификаторов сервисов"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} domain.GrpcError
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /service/delete_service [POST]
|
||||
func (c Service) Delete(ctx context.Context, req []int) (*domain.DeleteResponse, error) {
|
||||
if len(req) == 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "at least one id are required")
|
||||
|
||||
+40
-36
@@ -28,29 +28,31 @@ func NewToken(service TokenService) Token {
|
||||
}
|
||||
|
||||
// GetByAppId godoc
|
||||
// @Tags token
|
||||
// @Summary Получить токены по идентификатору приложения
|
||||
// @Description Возвращает список токенов, привязанных к приложению
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор приложения"
|
||||
// @Success 200 {array} entity.Token
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /token/get_tokens_by_app_id [POST]
|
||||
//
|
||||
// @Tags token
|
||||
// @Summary Получить токены по идентификатору приложения
|
||||
// @Description Возвращает список токенов, привязанных к приложению
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор приложения"
|
||||
// @Success 200 {array} entity.Token
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /token/get_tokens_by_app_id [POST]
|
||||
func (c Token) GetByAppId(ctx context.Context, req domain.Identity) ([]domain.Token, error) {
|
||||
return c.service.GetByAppId(ctx, req.Id)
|
||||
}
|
||||
|
||||
// Create godoc
|
||||
// @Tags token
|
||||
// @Summary Создать токен
|
||||
// @Description Создает токен и привязывает его к приложению
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.TokenCreateRequest true "Объект создания токена"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /token/create_token [POST]
|
||||
//
|
||||
// @Tags token
|
||||
// @Summary Создать токен
|
||||
// @Description Создает токен и привязывает его к приложению
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.TokenCreateRequest true "Объект создания токена"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /token/create_token [POST]
|
||||
func (c Token) Create(ctx context.Context, req domain.TokenCreateRequest) (*domain.ApplicationWithTokens, error) {
|
||||
result, err := c.service.Create(ctx, req)
|
||||
switch {
|
||||
@@ -68,29 +70,31 @@ func (c Token) Create(ctx context.Context, req domain.TokenCreateRequest) (*doma
|
||||
}
|
||||
|
||||
// Revoke godoc
|
||||
// @Tags token
|
||||
// @Summary Отозвать токены
|
||||
// @Description Отвязывает токены от приложений и удаляет их
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.TokenRevokeRequest true "Объект отзыва токенов"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /token/revoke_tokens [POST]
|
||||
//
|
||||
// @Tags token
|
||||
// @Summary Отозвать токены
|
||||
// @Description Отвязывает токены от приложений и удаляет их
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.TokenRevokeRequest true "Объект отзыва токенов"
|
||||
// @Success 200 {object} domain.ApplicationWithTokens
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /token/revoke_tokens [POST]
|
||||
func (c Token) Revoke(ctx context.Context, req domain.TokenRevokeRequest) (*domain.ApplicationWithTokens, error) {
|
||||
return c.service.Revoke(ctx, req)
|
||||
}
|
||||
|
||||
// RevokeForApp godoc
|
||||
// @Tags token
|
||||
// @Summary Отозвать токены для приложения
|
||||
// @Description Отвязывает токены от приложений и удаляет их по идентификатору приложения
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор приложения"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /token/revoke_tokens_for_app [POST]
|
||||
//
|
||||
// @Tags token
|
||||
// @Summary Отозвать токены для приложения
|
||||
// @Description Отвязывает токены от приложений и удаляет их по идентификатору приложения
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.Identity true "Идентификатор приложения"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 500 {object} domain.GrpcError
|
||||
// @Router /token/revoke_tokens_for_app [POST]
|
||||
func (c Token) RevokeForApp(ctx context.Context, req domain.Identity) (*domain.DeleteResponse, error) {
|
||||
return c.service.RevokeByAppId(ctx, req.Id)
|
||||
}
|
||||
Reference in new issue
Block a user