2025-05-14 11:54:07: merge [master:138dde59487c426482ca2f7c3e9db90630787f98];

This commit is contained in:
txix committed 2025-05-14 11:54:07 +03:00
1 parent a648f4f9a7
commit c5b82152e0
13 files changed
+286 -120

No files matched your search

+19
View File
@@ -55,6 +55,25 @@ func (s Application) GetById(ctx context.Context, appId int) (*domain.Applicatio
return arr[0], nil
}
func (s Application) GetByToken(ctx context.Context, tokenStr string) (*domain.GetApplicationByTokenResponse, error) {
token, err := s.tokenRepo.GetTokenById(ctx, tokenStr)
if err != nil {
return nil, errors.WithMessage(err, "get token by id")
}
if token == nil {
return nil, domain.ErrApplicationNotFound
}
app, err := s.appRepo.GetApplicationById(ctx, token.AppId)
if err != nil {
return nil, errors.WithMessage(err, "get app by id")
}
return &domain.GetApplicationByTokenResponse{
ApplicationId: app.Id,
ApplicationGroupId: app.ApplicationGroupId,
}, nil
}
func (s Application) GetByIdList(ctx context.Context, idList []int) ([]*domain.ApplicationWithTokens, error) {
res, err := s.appRepo.GetApplicationByIdList(ctx, idList)
if err != nil {
+1
View File
@@ -7,6 +7,7 @@ import (
type TokenRepo interface {
GetTokenByAppIdList(ctx context.Context, appIdList []int) ([]entity.Token, error)
GetTokenById(ctx context.Context, token string) (*entity.Token, error)
}
type DomainRepo interface {