add linter, update swagger doc

This commit is contained in:
Дмитрий Гуляченков authored and Максим Мержанов committed 2020-09-22 16:47:24 +03:00
1 parent c4a34c6cd2
commit 091f3ed06e
25 files changed
+1893 -115

No files matched your search

+11 -5
View File
@@ -4,14 +4,15 @@ import (
"context"
"fmt"
rd "github.com/go-redis/redis/v8"
rdLib "github.com/integration-system/isp-lib/v2/redis"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"isp-system-service/domain"
"isp-system-service/entity"
"isp-system-service/model"
"isp-system-service/redis"
rd "github.com/go-redis/redis/v8"
rdLib "github.com/integration-system/isp-lib/v2/redis"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
var AccessList accessListController
@@ -65,8 +66,10 @@ func (c accessListController) SetOne(request entity.AccessList) (*domain.CountRe
_, err = redis.Client.Get().UseDb(rdLib.ApplicationPermissionDb, func(p rd.Pipeliner) error {
key := fmt.Sprintf("%d|%s", request.AppId, request.Method)
_, err := p.Set(context.Background(), key, request.Value, 0).Result()
return err
})
return err
})
if err != nil {
@@ -95,7 +98,7 @@ func (c accessListController) SetList(request domain.SetListRequest) ([]domain.M
oldAccessList := make([]entity.AccessList, 0)
err = model.DbClient.RunInTransaction(func(repository model.AccessListRepository) error {
if request.RemoveOld == true {
if request.RemoveOld {
oldAccessList, err = repository.DeleteById(request.AppId)
if err != nil {
return err
@@ -142,6 +145,7 @@ func (c accessListController) SetList(request domain.SetListRequest) ([]domain.M
return nil
})
return err
})
if err != nil {
@@ -168,6 +172,7 @@ func (accessListController) convertAccessList(accessLists []entity.AccessList) [
Value: access.Value,
}
}
return methodInfos
}
@@ -179,5 +184,6 @@ func (accessListController) checkAppById(appId int32) error {
if app == nil {
return status.Errorf(codes.NotFound, "application '%d' not found", appId)
}
return nil
}