8 Commits
Author SHA1 Message Date
txix e4445eca46 2026-02-11 16:48:41: merge [main:c304645d60621efc82700d4c7e501c49a2b2935b];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-02-11 16:48:42 +03:00
txix 1651a1fc3c 2025-11-26 10:06:04: merge [main:924c6ad2c9a493beb1cc9a0762a1c1fe11cf7b12];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-11-26 10:06:04 +03:00
txix 882e5c67a7 2025-09-17 18:08:10: merge [main:7652dd1205feaea22b42541290b3a7b021960a3e];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-09-17 18:08:10 +03:00
txix d7a7e4ee0d 2025-08-21 15:03:50: merge [main:135c25ca951814b87d4ee6a93bfd35ce5aef95f1]; 2025-08-21 15:03:50 +03:00
txix ec0f1a02d1 2025-05-27 15:03:30: merge [master:f7d84c21ab1049a1f10eacacc773ddeead8d619b];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-05-27 15:03:30 +03:00
txix 65cfb65f8e 2025-05-26 17:34:40: merge [master:d02a58345e9261c6f2b75cea3d6c36e07d9a7cfc]; 2025-05-26 17:34:40 +03:00
txix c0687a264e 2025-05-26 17:31:46: merge [master:4b0510d2764306aa9a1a7375512e74d7d7876cef]; 2025-05-26 17:31:46 +03:00
txix c5b82152e0 2025-05-14 11:54:07: merge [master:138dde59487c426482ca2f7c3e9db90630787f98]; 2025-05-14 11:54:07 +03:00
37 changed files with 3373 additions and 1717 deletions

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
name: Create and publish a Docker image
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
APP_NAME: ${{ github.event.repository.name }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get version from tag
id: version_reader
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: |
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
org.opencontainers.image.version=${{ steps.version_reader.outputs.version }}
build-args: |
app_name=${{ env.APP_NAME }}
version=${{ steps.version_reader.outputs.version }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
+64 -48
View File
@@ -1,53 +1,69 @@
version: "2"
run:
allow-parallel-runners: true
issues:
exclude-rules:
- path: controller #достаточное кол-во контекса на уровне контроллеров
linters:
- wrapcheck
- path: transaction #транзакции прозрачны
linters:
- wrapcheck
linters:
enable-all: true
default: all
disable:
- goimports #у нас собственные правила форматирования импортов
- wsl #расставление пробелов очень индивидуально
- varnamelen #очень индивидуально (db)
- exhaustruct #не имеет смысла
- contextcheck #не имеет смысла
- gci #у нас собственные правила форматирования импортов
- gofumpt #у нас собственные правила форматирования импортов
- nolintlint #Goland все равно форматирует с отступом
- nlreturn #не всегда имеет смысл
- godot #не актуально для свагера
- godox #не позволяет оставлять todo
- depguard #не всегда имеет смысл
- dupword #не имеет смысла
- tagalign #не всегда имеет смысл
- musttag #у нас собственные правило: не используем теги, если работаем с пакетом isp-kit/json и с внутренними структурами(между нашими сервисами), при этом теги обязательный для всех внених для нас структур
- perfsprint #мнимая производительность в угоду читаемости
- gomnd #устарел
- exportloopref #устарел
- execinquery #устарел
linters-settings:
funlen:
lines: 80
lll:
line-length: 150
cyclop:
max-complexity: 15 #по умолчанию 10 мало
revive:
- contextcheck # не имеет смысла
- depguard # не всегда имеет смысл
- dupword # не имеет смысла
- exhaustruct # не имеет смысла
- godot # не актуально для swagger
- godox # не позволяет оставлять todo
- musttag # у нас собственное правило: не используем теги, если работаем с пакетом isp-kit/json и с внутренними структурами(между нашими сервисами), при этом теги обязательный для всех внешних для нас структур
- nlreturn # не всегда имеет смысл
- nolintlint # Goland все равно форматирует с отступом
- perfsprint # мнимая производительность в угоду читаемости
- tagalign # не всегда имеет смысл
- varnamelen # очень индивидуально (db)
- wsl # расставление пробелов очень индивидуально
- wsl_v5 # расставление пробелов очень индивидуально
settings:
cyclop:
max-complexity: 15 # по умолчанию 10 мало
funlen:
lines: 80
lll:
line-length: 150
revive:
rules:
- name: var-naming # отключаем Id -> ID
disabled: true
staticcheck:
checks: # отключаем Id -> ID
- -ST1000
- -ST1016
- -ST1020
- -ST1021
- -ST1022
testifylint:
disable:
- compares
- equal-values
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- name: var-naming #отключаем Id -> ID
disabled: true
stylecheck:
checks: #отключаем Id -> ID
- "-ST1000"
- "-ST1016"
- "-ST1020"
- "-ST1021"
- "-ST1022"
testifylint:
disable:
- compares
- linters:
- wrapcheck
path: controller # достаточное кол-во контекста на уровне контроллеров
- linters:
- wrapcheck
path: transaction # транзакции прозрачны
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
+1 -1
View File
@@ -1 +1 @@
5.2.1
5.7.0
+16
View File
@@ -1,3 +1,19 @@
### v5.7.0
* Обновлены зависимости
* Добавлено поле `http_method` в `access_list`
### v5.6.0
* Для endpoint'а `system/secure/authenticate` в ответ добавлено поле `appName` (название приложения)
* Обновлена версия `go` до `1.25`
* Обновлены зависимости
### v5.5.0
* Обновлены зависимости
### v5.4.0
* Добавлен новый endpoint: `/access_list/delete_list` для удаления методов из списка доступов у приложений
### v5.3.1
* добавлен `Dockerfile` и скрипт для сборки и публикации образа в `GitHub Contaier Registry`
* обновлены зависимости
### v5.3.0
* Добавлен новый endpoint: `/application/get_application_by_token`
### v5.2.1
* обновлены зависимости
### v5.2.0
-41
View File
@@ -1,41 +0,0 @@
FROM dockerhub.mos.ru/mosos/arbat:15.5 as builder
RUN zypper --no-gpg-checks update -y && zypper --no-gpg-checks install -y go1.24 git
WORKDIR /build
ARG version
ENV version_env=$version
ARG app_name
ENV app_name_env=$app_name
COPY . .
ENV GOPROXY=https://repo-mirror.mos.ru/repository/go-public
RUN go build -ldflags="-X 'main.version=$version_env'" -o /main .
FROM dockerhub.mos.ru/mosos/arbat:15.5
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
RUN echo "Europe/Moscow" > /etc/timezone
ARG UID=10001
RUN useradd \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
--user-group \
appuser
RUN mkdir -p /app/data
RUN chown appuser:appuser /app/data
VOLUME /app/data
USER appuser
WORKDIR /app
ARG app_name
ENV app_name_env=$app_name
COPY --from=builder main /app/$app_name_env
COPY /conf/config.yml /app/config.yml
COPY /conf/default_remote_config.json* /app/default_remote_config.json
COPY /migrations /app/migrations
ENTRYPOINT /app/$app_name_env
+3 -1
View File
@@ -2,8 +2,11 @@ package assembly
import (
"context"
"github.com/txix-open/isp-kit/rc"
"isp-system-service/conf"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/app"
"github.com/txix-open/isp-kit/bootstrap"
@@ -12,7 +15,6 @@ import (
"github.com/txix-open/isp-kit/dbx"
"github.com/txix-open/isp-kit/grpc"
"github.com/txix-open/isp-kit/log"
"isp-system-service/conf"
)
type Assembly struct {
+56
View File
@@ -15,6 +15,8 @@ type AccessListService interface {
GetById(ctx context.Context, appId int) ([]domain.MethodInfo, error)
SetOne(ctx context.Context, request domain.AccessListSetOneRequest) (*domain.AccessListSetOneResponse, error)
SetList(ctx context.Context, req domain.AccessListSetListRequest) ([]domain.MethodInfo, error)
DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error
DeleteListWithMethods(ctx context.Context, req domain.AccessListDeleteV2ListRequest) error
}
type AccessList struct {
@@ -113,3 +115,57 @@ func (c AccessList) SetList(ctx context.Context, req domain.AccessListSetListReq
return result, nil
}
}
// DeleteList godoc
//
// @Tags accessList
// @Summary Удалить список доступных методов для приложения
// @Description Удаляет заданный список методов для приложения
// @Accept json
// @Produce json
// @Param body body domain.AccessListDeleteListRequest false "тело запроса"
// @Success 200 {object} any
// @Failure 404 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error
// @Router /access_list/delete_list [POST]
func (c AccessList) DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error {
err := c.service.DeleteList(ctx, req)
switch {
case errors.Is(err, domain.ErrApplicationNotFound):
return apierrors.New(
codes.NotFound,
domain.ErrCodeApplicationNotFound,
fmt.Sprintf("application with id %d not found", req.AppId),
err,
)
default:
return err
}
}
// DeleteListWithMethods godoc
//
// @Tags accessList
// @Summary Удалить список доступных методов для приложения
// @Description Удаляет заданный список методов для приложения
// @Accept json
// @Produce json
// @Param body body domain.AccessListDeleteV2ListRequest false "тело запроса"
// @Success 200 {object} any
// @Failure 404 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error
// @Router /access_list/delete_list_with_methods [POST]
func (c AccessList) DeleteListWithMethods(ctx context.Context, req domain.AccessListDeleteV2ListRequest) error {
err := c.service.DeleteListWithMethods(ctx, req)
switch {
case errors.Is(err, domain.ErrApplicationNotFound):
return apierrors.New(
codes.NotFound,
domain.ErrCodeApplicationNotFound,
fmt.Sprintf("application with id %d not found", req.AppId),
err,
)
default:
return err
}
}
+32
View File
@@ -11,8 +11,10 @@ import (
"google.golang.org/grpc/codes"
)
// nolint:interfacebloat
type ApplicationService interface {
GetById(ctx context.Context, appId int) (*domain.ApplicationWithTokens, error)
GetByToken(ctx context.Context, token string) (*domain.GetApplicationByTokenResponse, error)
GetByIdList(ctx context.Context, idList []int) ([]*domain.ApplicationWithTokens, error)
GetByServiceId(ctx context.Context, id int) ([]*domain.ApplicationWithTokens, error)
SystemTree(ctx context.Context, systemId int) ([]*domain.DomainWithService, error)
@@ -64,6 +66,36 @@ func (c Application) GetById(ctx context.Context, req domain.Identity) (*domain.
}
}
// GetByToken godoc
//
// @Tags application
// @Summary Получить идентификатор приложения и группы по токену
// @Description Возвращает идентификатор приложения и группы по токену
// @Accept json
// @Produce json
// @Param body body domain.GetApplicationByTokenRequest true "Тело запроса"
// @Success 200 {object} domain.GetApplicationByTokenResponse
// @Failure 400 {object} apierrors.Error
// @Failure 404 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error
// @Router /application/get_application_by_token [POST]
func (c Application) GetByToken(ctx context.Context, req domain.GetApplicationByTokenRequest) (*domain.GetApplicationByTokenResponse, error) {
result, err := c.service.GetByToken(ctx, req.Token)
switch {
case errors.Is(err, domain.ErrApplicationNotFound):
return nil, apierrors.New(
codes.NotFound,
domain.ErrCodeApplicationNotFound,
fmt.Sprintf("application with token '%s' not found", req.Token),
err,
)
case err != nil:
return nil, err
default:
return result, nil
}
}
// GetByIdList godoc
//
// @Tags application
+4 -3
View File
@@ -3,13 +3,14 @@ package controller
import (
"context"
"github.com/pkg/errors"
"isp-system-service/domain"
"github.com/pkg/errors"
)
type SecureService interface {
Authenticate(ctx context.Context, token string) (*domain.AuthData, error)
Authorize(ctx context.Context, appId int, endpoint string) (bool, error)
Authorize(ctx context.Context, req domain.AuthorizeRequest) (bool, error)
}
type Secure struct {
@@ -68,7 +69,7 @@ func (c Secure) Authenticate(ctx context.Context, req domain.AuthenticateRequest
// @Failure 500 {object} apierrors.Error
// @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)
result, err := c.service.Authorize(ctx, req)
switch {
case errors.Is(err, domain.ErrAccessListNotFound):
return &domain.AuthorizeResponse{
+9
View File
@@ -0,0 +1,9 @@
package docs
import _ "embed"
// Embedded swagger files.
var (
//go:embed swagger.json
SwaggerJson []byte
)
+2296
View File
File diff suppressed because it is too large. Load diff
-1363
View File
File diff suppressed because it is too large. Load diff
+22 -5
View File
@@ -1,9 +1,10 @@
package domain
type AccessListSetOneRequest struct {
AppId int `validate:"required"`
Method string `validate:"required"`
Value bool
AppId int `validate:"required"`
HttpMethod string
Method string `validate:"required"`
Value bool
}
type AccessListSetOneResponse struct {
@@ -17,6 +18,22 @@ type AccessListSetListRequest struct {
}
type MethodInfo struct {
Method string
Value bool
HttpMethod string
Method string
Value bool
}
type AccessListDeleteListRequest struct {
AppId int `validate:"required"`
Methods []string `validate:"required,min=1"`
}
type AccessListDeleteV2ListRequest struct {
AppId int `validate:"required"`
Methods []Method `validate:"required,min=1"`
}
type Method struct {
HttpMethod string
Method string `validate:"required"`
}
+9
View File
@@ -54,3 +54,12 @@ type UpdateApplicationRequest struct {
Name string `validate:"required"`
Description string
}
type GetApplicationByTokenRequest struct {
Token string `validate:"required"`
}
type GetApplicationByTokenResponse struct {
ApplicationId int
ApplicationGroupId int
}
+3 -1
View File
@@ -11,6 +11,7 @@ type AuthenticateResponse struct {
}
type AuthData struct {
AppName string
SystemId int
DomainId int
ServiceId int
@@ -18,7 +19,8 @@ type AuthData struct {
}
type AuthorizeRequest struct {
ApplicationId int `validate:"required"`
ApplicationId int `validate:"required"`
HttpMethod string
Endpoint string `validate:"required"`
}
+9 -3
View File
@@ -1,7 +1,13 @@
package entity
type AccessList struct {
AppId int
Method string
Value bool
AppId int
HttpMethod string
Method string
Value bool
}
type Method struct {
HttpMethod string
Method string
}
+1
View File
@@ -12,6 +12,7 @@ type Token struct {
}
type AuthData struct {
AppName string
SystemId int
DomainId int
ApplicationGroupId int
+38 -38
View File
@@ -1,82 +1,82 @@
module isp-system-service
go 1.24
go 1.25
require (
github.com/Masterminds/squirrel v1.5.4
github.com/jackc/pgx/v5 v5.7.4
github.com/jackc/pgx/v5 v5.8.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.10.0
github.com/txix-open/isp-kit v1.46.0
github.com/txix-open/jsonschema v1.2.0
google.golang.org/grpc v1.72.0
github.com/stretchr/testify v1.11.1
github.com/txix-open/isp-kit v1.64.10
github.com/txix-open/jsonschema v1.3.0
google.golang.org/grpc v1.78.0
)
require (
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coder/websocket v1.8.13 // indirect
github.com/coder/websocket v1.8.14 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/getsentry/sentry-go v0.31.1 // indirect
github.com/go-faker/faker/v4 v4.6.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/gabriel-vasile/mimetype v1.4.13 // indirect
github.com/getsentry/sentry-go v0.42.0 // indirect
github.com/go-faker/faker/v4 v4.6.1 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.8 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jmoiron/sqlx v1.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mailru/easyjson v0.9.1 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pressly/goose/v3 v3.24.2 // indirect
github.com/prometheus/client_golang v1.21.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.63.0 // indirect
github.com/prometheus/procfs v0.16.0 // indirect
github.com/pressly/goose/v3 v3.26.0 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/procfs v0.19.2 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
github.com/txix-open/bellows v1.2.0 // indirect
github.com/txix-open/etp/v4 v4.0.1 // indirect
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99 // indirect
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel v1.40.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 // indirect
go.opentelemetry.io/otel/metric v1.40.0 // indirect
go.opentelemetry.io/otel/sdk v1.40.0 // indirect
go.opentelemetry.io/otel/trace v1.40.0 // indirect
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.36.0 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/sync v0.12.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
google.golang.org/protobuf v1.36.6 // indirect
go.uber.org/zap v1.27.1 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/crypto v0.48.0 // indirect
golang.org/x/net v0.50.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.34.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
+96 -92
View File
@@ -10,28 +10,28 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE=
github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
github.com/getsentry/sentry-go v0.31.1 h1:ELVc0h7gwyhnXHDouXkhqTFSO5oslsRDk0++eyE0KJ4=
github.com/getsentry/sentry-go v0.31.1/go.mod h1:CYNcMMz73YigoHljQRG+qPF+eMq8gG72XcGN/p71BAY=
github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM=
github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/getsentry/sentry-go v0.42.0 h1:eeFMACuZTbUQf90RE8dE4tXeSe4CZyfvR1MBL7RLEt8=
github.com/getsentry/sentry-go v0.42.0/go.mod h1:eRXCoh3uvmjQLY6qu63BjUZnaBu5L5WhMV1RwYO8W5s=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-faker/faker/v4 v4.6.0 h1:6aOPzNptRiDwD14HuAnEtlTa+D1IfFuEHO8+vEFwjTs=
github.com/go-faker/faker/v4 v4.6.0/go.mod h1:ZmrHuVtTTm2Em9e0Du6CJ9CADaLEzGXW62z1YqFH0m0=
github.com/go-faker/faker/v4 v4.6.1 h1:xUyVpAjEtB04l6XFY0V/29oR332rOSPWV4lU8RwDt4k=
github.com/go-faker/faker/v4 v4.6.1/go.mod h1:arSdxNCSt7mOhdk8tEolvHeIJ7eX4OX80wXjKKvkKBY=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
@@ -41,8 +41,8 @@ github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/Nu
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/go-sql-driver/mysql v1.9.1 h1:FrjNGn/BsJQjVRuSa8CBrM5BWA9BWoXXat3KrtSb/iI=
github.com/go-sql-driver/mysql v1.9.1/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
@@ -50,16 +50,16 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.8 h1:NpbJl/eVbvrGE0MJ6X16X9SAifesl6Fwxg/YmCvubRI=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.8/go.mod h1:mi7YA+gCzVem12exXy46ZespvGtX/lZmD/RLnQhVW7U=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.7.4 h1:9wKznZrhWa2QiHL+NjTSPP6yjl3451BX3imWDnokYlg=
github.com/jackc/pgx/v5 v5.7.4/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=
github.com/jackc/pgx/v5 v5.8.0 h1:TYPDoleBBme0xGSAX3/+NujXXtpZn9HBONkQC7IEZSo=
github.com/jackc/pgx/v5 v5.8.0/go.mod h1:QVeDInX2m9VyzvNeiCJVjCkNFqzsNb43204HshNSZKw=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
@@ -68,8 +68,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -84,8 +84,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
@@ -109,22 +109,22 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pressly/goose/v3 v3.24.2 h1:c/ie0Gm8rnIVKvnDQ/scHErv46jrDv9b4I0WRcFJzYU=
github.com/pressly/goose/v3 v3.24.2/go.mod h1:kjefwFB0eR4w30Td2Gj2Mznyw94vSP+2jJYkOVNbD1k=
github.com/prometheus/client_golang v1.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
github.com/prometheus/client_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.63.0 h1:YR/EIY1o3mEFP/kZCD7iDMnLPlGyuU2Gb3HIcXnA98k=
github.com/prometheus/common v0.63.0/go.mod h1:VVFF/fBIoToEnWRVkYoXEkq3R3paCoxG9PXP74SnV18=
github.com/prometheus/procfs v0.16.0 h1:xh6oHhKwnOJKMYiYBDWmkHqQPyiY40sny36Cmx2bbsM=
github.com/prometheus/procfs v0.16.0/go.mod h1:8veyXUu3nGP7oaCxhX6yeaM5u4stL2FeMXnCqhDthZg=
github.com/pressly/goose/v3 v3.26.0 h1:KJakav68jdH0WDvoAcj8+n61WqOIaPGgH0bJWS6jpmM=
github.com/pressly/goose/v3 v3.26.0/go.mod h1:4hC1KrritdCxtuFsqgs1R4AU5bWtTAf+cnWvfhf2DNY=
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4=
github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws=
github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw=
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE=
github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -138,20 +138,20 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
github.com/txix-open/grmq v1.7.0 h1:nwenrlxEjXpK0EBCa/WbIxK+y0mF2pZxNKbheFjQVsI=
github.com/txix-open/grmq v1.7.0/go.mod h1:DAfbV4jLyxQBLG8OYJVy8kCbhucdlu/C/wl+nUDc9p8=
github.com/txix-open/isp-kit v1.46.0 h1:Rqw5X+501vEwMv6oGvC6sYU1++1XiTvxt6Ja/CD7lRw=
github.com/txix-open/isp-kit v1.46.0/go.mod h1:tWz/RGhRHx+JQZa5j1srR9kzL5YkIed3350SQ+FV1Wc=
github.com/txix-open/jsonschema v1.2.0 h1:B8TrdSsPhDvYv67oi/LVqf7/+PuqFlMsNwUzGeHfl1s=
github.com/txix-open/jsonschema v1.2.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99 h1:Z0Sqf+U+Sc6hfIXtRCIZlbJprkCjwMFbS4ZbEPQ44To=
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99/go.mod h1:pA0NYmhL0uEkkxj55S+S7MZU4e2QIt46x9XSrzrWc3c=
github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM=
github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
github.com/txix-open/isp-kit v1.64.10 h1:lAowLtShBbICZbOWQJ4ptr9LaKKRZ7CE5DBK+7LcLqM=
github.com/txix-open/isp-kit v1.64.10/go.mod h1:GvBsX5p2U3/ugK6PuWANYzSy/4YgawROm3eAKb35G6o=
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb/go.mod h1:0biAFE0bgbcKeBBAwgEDhbZz6uT1vuSETCrFQlv2RiA=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
@@ -161,52 +161,56 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 h1:0tY123n7CdWMem7MOVdKOt0YfshufLCwfE5Bob+hQuM=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0/go.mod h1:CosX/aS4eHnG9D7nESYpV753l4j9q5j3SL/PUYd2lR8=
go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0fikVry1IsiUnXjf7QFvoNN3Xw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 h1:xJ2qHD0C1BeYVTLLR9sX12+Qb95kfeD/byKj6Ky1pXg=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0/go.mod h1:u5BF1xyjstDowA1R5QAO9JHzqK+ublenEW/dyqTjBVk=
go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M=
go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE=
go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=
go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg=
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs=
go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4=
go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 h1:2pn7OzMewmYRiNtv1doZnLo3gONcnMHlFnmOR8Vgt+8=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0/go.mod h1:rjbQTDEPQymPE0YnRQp9/NuPwwtL0sesz/fnqRW/v84=
go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms=
go.opentelemetry.io/otel v1.40.0/go.mod h1:IMb+uXZUKkMXdPddhwAHm6UfOwJyh4ct1ybIlV14J0g=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 h1:QKdN8ly8zEMrByybbQgv8cWBcdAarwmIPZ6FThrWXJs=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0/go.mod h1:bTdK1nhqF76qiPoCCdyFIV+N/sRHYXYCTQc+3VCi3MI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 h1:wVZXIWjQSeSmMoxF74LzAnpVQOAFDo3pPji9Y4SOFKc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0/go.mod h1:khvBS2IggMFNwZK/6lEeHg/W57h/IX6J4URh57fuI40=
go.opentelemetry.io/otel/metric v1.40.0 h1:rcZe317KPftE2rstWIBitCdVp89A2HqjkxR3c11+p9g=
go.opentelemetry.io/otel/metric v1.40.0/go.mod h1:ib/crwQH7N3r5kfiBZQbwrTge743UDc7DTFVZrrXnqc=
go.opentelemetry.io/otel/sdk v1.40.0 h1:KHW/jUzgo6wsPh9At46+h4upjtccTmuZCFAc9OJ71f8=
go.opentelemetry.io/otel/sdk v1.40.0/go.mod h1:Ph7EFdYvxq72Y8Li9q8KebuYUr2KoeyHx0DRMKrYBUE=
go.opentelemetry.io/otel/sdk/metric v1.40.0 h1:mtmdVqgQkeRxHgRv4qhyJduP3fYJRMX4AtAlbuWdCYw=
go.opentelemetry.io/otel/sdk/metric v1.40.0/go.mod h1:4Z2bGMf0KSK3uRjlczMOeMhKU2rhUqdWNoKcYrtcBPg=
go.opentelemetry.io/otel/trace v1.40.0 h1:WA4etStDttCSYuhwvEa8OP8I5EWu24lkOzp+ZYblVjw=
go.opentelemetry.io/otel/trace v1.40.0/go.mod h1:zeAhriXecNGP/s2SEG3+Y8X9ujcJOTqQ5RgdEJcawiA=
go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A=
go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 h1:hE3bRWtU6uceqlh4fhrSnUyjKHMKB9KrTLLG+bc0ddM=
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463/go.mod h1:U90ffi8eUL9MwPcrJylN5+Mk2v3vuPDptd5yyNUiRR8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 h1:e0AIkUUhxyBKh6ssZNrAMeqhA7RKUj42346d1y02i2g=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM=
google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o=
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60=
golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 h1:JLQynH/LBHfCTSbDWl+py8C+Rg/k1OVH3xfcaiANuF0=
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:kSJwQxqmFXeo79zOmbrALdflXQeAYcUbgS7PbpMknCY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 h1:mWPCjDEyshlQYzBpMNHaEof6UX1PmHcaUODUywQ0uac=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
@@ -215,11 +219,11 @@ gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYs
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
modernc.org/libc v1.61.13 h1:3LRd6ZO1ezsFiX1y+bHd1ipyEHIJKvuprv0sLTBwLW8=
modernc.org/libc v1.61.13/go.mod h1:8F/uJWL/3nNil0Lgt1Dpz+GgkApWh04N3el3hxJcA6E=
modernc.org/libc v1.66.3 h1:cfCbjTUcdsKyyZZfEUKfoHcP3S0Wkvz3jgSzByEWVCQ=
modernc.org/libc v1.66.3/go.mod h1:XD9zO8kt59cANKvHPXpx7yS2ELPheAey0vjIuZOhOU8=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.9.1 h1:V/Z1solwAVmMW1yttq3nDdZPJqV1rM05Ccq6KMSZ34g=
modernc.org/memory v1.9.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
modernc.org/sqlite v1.36.2 h1:vjcSazuoFve9Wm0IVNHgmJECoOXLZM1KfMXbcX2axHA=
modernc.org/sqlite v1.36.2/go.mod h1:ADySlx7K4FdY5MaJcEv86hTJ0PjedAloTUuif0YS3ws=
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
modernc.org/sqlite v1.38.2 h1:Aclu7+tgjgcQVShZqim41Bbw9Cho0y/7WzYptXqkEek=
modernc.org/sqlite v1.38.2/go.mod h1:cPTJYSlgg3Sfg046yBShXENNtPrWrDX8bsbAQBzgQ5E=
+6 -4
View File
@@ -1,11 +1,13 @@
package main
import (
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/shutdown"
"isp-system-service/assembly"
"isp-system-service/conf"
"isp-system-service/routes"
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/shutdown"
)
var (
@@ -22,9 +24,9 @@ var (
// @BasePath /api/system
//go:generate swag init --parseDependency
//go:generate rm -f docs/swagger.json
//go:generate rm -f docs/swagger.yaml docs/docs.go
func main() {
boot := bootstrap.New(version, conf.Remote{}, routes.EndpointDescriptors())
boot := bootstrap.New(version, conf.Remote{}, routes.EndpointDescriptors(), cluster.GrpcTransport)
app := boot.App
logger := app.Logger()
@@ -0,0 +1,36 @@
-- +goose Up
CREATE TABLE access_list_new
(
app_id INT,
http_method VARCHAR(255) NOT NULL DEFAULT '',
method VARCHAR(255),
value BOOLEAN NOT NULL,
PRIMARY KEY (app_id, http_method, method),
CONSTRAINT FK_app_id__application_id FOREIGN KEY (app_id) REFERENCES application (id) ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO access_list_new (app_id, method, value)
SELECT app_id, method, value
FROM access_list
WHERE value = true;
DROP TABLE access_list;
ALTER TABLE access_list_new RENAME TO access_list;
-- +goose Down
CREATE TABLE access_list_old
(
app_id INT,
method VARCHAR(255),
value BOOLEAN NOT NULL,
PRIMARY KEY (app_id, method),
CONSTRAINT FK_app_id__application_id FOREIGN KEY (app_id) REFERENCES application (id) ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO access_list_old (app_id, method, value)
SELECT app_id, method, value
FROM access_list
WHERE value = true;
DROP TABLE access_list;
ALTER TABLE access_list_old RENAME TO access_list;
+54 -25
View File
@@ -4,12 +4,14 @@ import (
"context"
"database/sql"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/Masterminds/squirrel"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/txix-open/isp-kit/metrics/sql_metrics"
)
type AccessList struct {
@@ -22,14 +24,20 @@ func NewAccessList(db db.DB) AccessList {
}
}
func (r AccessList) GetAccessListByAppIdAndMethod(ctx context.Context, appId int, method string) (*entity.AccessList, error) {
func (r AccessList) GetAccessListByAppIdAndMethod(ctx context.Context, appId int, httpMethod string, method string) (*entity.AccessList, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.GetAccessListByAppIdAndMethod")
q := `
SELECT app_id, method, value
FROM access_list
WHERE app_id = $1 AND method = $2
`
SELECT app_id, http_method, method, value
FROM access_list
WHERE app_id = $1
AND method = $2
AND http_method IN ($3, '')
ORDER BY (http_method = $3) DESC
LIMIT 1;
`
result := entity.AccessList{}
err := r.db.SelectRow(ctx, &result, q, appId, method)
err := r.db.SelectRow(ctx, &result, q, appId, method, httpMethod)
switch {
case errors.Is(err, sql.ErrNoRows):
return nil, domain.ErrAccessListNotFound
@@ -41,11 +49,13 @@ func (r AccessList) GetAccessListByAppIdAndMethod(ctx context.Context, appId int
}
func (r AccessList) GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.GetAccessListByAppId")
q := `
SELECT app_id, method, value
SELECT app_id, http_method, method, value
FROM access_list
WHERE app_id = $1
`
`
result := make([]entity.AccessList, 0)
err := r.db.Select(ctx, &result, q, appId)
if err != nil {
@@ -56,8 +66,10 @@ func (r AccessList) GetAccessListByAppId(ctx context.Context, appId int) ([]enti
}
func (r AccessList) GetAccessListByAppIdList(ctx context.Context, appIdList []int) ([]entity.AccessList, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.GetAccessListByAppIdList")
q, args, err := query.New().
Select("app_id", "method", "value").
Select("app_id", "http_method", "method", "value").
From("access_list").
Where(squirrel.Eq{"app_id": appIdList}).
ToSql()
@@ -75,11 +87,13 @@ func (r AccessList) GetAccessListByAppIdList(ctx context.Context, appIdList []in
}
func (r AccessList) InsertArrayAccessList(ctx context.Context, entity []entity.AccessList) error {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.InsertArrayAccessList")
qBuilder := query.New().
Insert("access_list").
Columns("app_id", "method", "value")
Columns("app_id", "http_method", "method", "value")
for _, e := range entity {
qBuilder = qBuilder.Values(e.AppId, e.Method, e.Value)
qBuilder = qBuilder.Values(e.AppId, e.HttpMethod, e.Method, e.Value)
}
q, args, err := qBuilder.ToSql()
if err != nil {
@@ -95,15 +109,17 @@ func (r AccessList) InsertArrayAccessList(ctx context.Context, entity []entity.A
}
func (r AccessList) UpsertAccessList(ctx context.Context, e entity.AccessList) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.UpsertAccessList")
q := `
INSERT INTO access_list
(app_id, method, value)
VALUES ($1, $2, $3)
ON CONFLICT (app_id, method)
(app_id, http_method, method, value)
VALUES ($1, $2, $3, $4)
ON CONFLICT (app_id, http_method, method)
DO UPDATE
SET (value) = (SELECT EXCLUDED.value)
`
result, err := r.db.Exec(ctx, q, e.AppId, e.Method, e.Value)
`
result, err := r.db.Exec(ctx, q, e.AppId, e.HttpMethod, e.Method, e.Value)
if err != nil {
return 0, errors.WithMessagef(err, "exec query %s", q)
}
@@ -116,14 +132,25 @@ func (r AccessList) UpsertAccessList(ctx context.Context, e entity.AccessList) (
return int(rowsAffected), nil
}
func (r AccessList) DeleteAccessList(ctx context.Context, appId int, methods []string) error {
func (r AccessList) DeleteAccessList(ctx context.Context, appId int, methods []entity.Method) error {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.DeleteAccessList")
methodsClause := squirrel.Or{}
for _, method := range methods {
methodsClause = append(methodsClause, squirrel.And{
squirrel.Eq{"method": method.Method},
squirrel.Eq{"http_method": method.HttpMethod},
})
}
q, args, err := query.New().
Delete("access_list").
Where(squirrel.Eq{
"app_id": appId,
"method": methods,
Where(squirrel.And{
squirrel.Eq{
"app_id": appId,
},
methodsClause,
}).
Suffix("RETURNING app_id, method, value").
ToSql()
if err != nil {
return errors.WithMessage(err, "build query")
@@ -138,11 +165,13 @@ func (r AccessList) DeleteAccessList(ctx context.Context, appId int, methods []s
}
func (r AccessList) DeleteAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.DeleteAccessListByAppId")
q := `
DELETE FROM access_list
WHERE app_id = $1
RETURNING app_id, method, value
`
RETURNING app_id, http_method, method, value
`
result := make([]entity.AccessList, 0)
err := r.db.Select(ctx, &result, q, appId)
if err != nil {
+21 -4
View File
@@ -12,6 +12,7 @@ import (
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query"
"github.com/txix-open/isp-kit/metrics/sql_metrics"
)
type AppGroup struct {
@@ -25,11 +26,13 @@ func NewAppGroup(db db.DB) AppGroup {
}
func (r AppGroup) GetAppGroupById(ctx context.Context, id int) (*entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.GetAppGroupById")
q := `
SELECT id, name, description, domain_id, created_at, updated_at
FROM application_group
WHERE id = $1
`
`
result := entity.AppGroup{}
err := r.db.SelectRow(ctx, &result, q, id)
switch {
@@ -43,6 +46,8 @@ func (r AppGroup) GetAppGroupById(ctx context.Context, id int) (*entity.AppGroup
}
func (r AppGroup) GetAppGroupByIdList(ctx context.Context, idList []int) ([]entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.GetAppGroupByIdList")
q, arg, err := query.New().
Select("id", "name", "description", "domain_id", "created_at", "updated_at").
From("application_group").
@@ -63,6 +68,8 @@ func (r AppGroup) GetAppGroupByIdList(ctx context.Context, idList []int) ([]enti
}
func (r AppGroup) GetAppGroupByDomainId(ctx context.Context, domainIdList []int) ([]entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.GetAppGroupByDomainId")
q, arg, err := query.New().
Select("id", "name", "description", "domain_id", "created_at", "updated_at").
From("application_group").
@@ -83,11 +90,13 @@ func (r AppGroup) GetAppGroupByDomainId(ctx context.Context, domainIdList []int)
}
func (r AppGroup) GetAppGroupByNameAndDomainId(ctx context.Context, name string, domainId int) (*entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.GetAppGroupByNameAndDomainId")
q := `
SELECT id, name, description, domain_id, created_at, updated_at
FROM application_group
WHERE name = $1 AND domain_id = $2
`
`
result := entity.AppGroup{}
err := r.db.SelectRow(ctx, &result, q, name, domainId)
switch {
@@ -101,13 +110,15 @@ func (r AppGroup) GetAppGroupByNameAndDomainId(ctx context.Context, name string,
}
func (r AppGroup) CreateAppGroup(ctx context.Context, name string, desc string, domainId int) (*entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.CreateAppGroup")
q := `
INSERT INTO application_group
(name, description, domain_id)
VALUES ($1, $2, $3)
ON CONFLICT (name, domain_id) DO NOTHING
RETURNING id, name, description, domain_id, created_at, updated_at
`
`
result := entity.AppGroup{}
err := r.db.SelectRow(ctx, &result, q, name, desc, domainId)
switch {
@@ -121,12 +132,14 @@ func (r AppGroup) CreateAppGroup(ctx context.Context, name string, desc string,
}
func (r AppGroup) UpdateAppGroup(ctx context.Context, id int, name string, description string) (*entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.UpdateAppGroup")
q := `
UPDATE application_group
SET name = $1, description = $2
WHERE id = $3
RETURNING id, name, description, domain_id, created_at, updated_at
`
`
result := entity.AppGroup{}
err := r.db.SelectRow(ctx, &result, q, name, description, id)
var pgErr *pgconn.PgError
@@ -143,6 +156,8 @@ func (r AppGroup) UpdateAppGroup(ctx context.Context, id int, name string, descr
}
func (r AppGroup) DeleteAppGroup(ctx context.Context, idList []int) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.DeleteAppGroup")
q, args, err := query.New().
Delete("application_group").
Where(squirrel.Eq{"id": idList}).
@@ -165,6 +180,8 @@ func (r AppGroup) DeleteAppGroup(ctx context.Context, idList []int) (int, error)
}
func (r AppGroup) GetAllAppGroups(ctx context.Context) ([]entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.GetAllAppGroups")
q, arg, err := query.New().
Select("id", "name", "description", "domain_id", "created_at", "updated_at").
From("application_group").
+34 -7
View File
@@ -12,6 +12,7 @@ import (
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query"
"github.com/txix-open/isp-kit/metrics/sql_metrics"
)
type Application struct {
@@ -25,11 +26,13 @@ func NewApplication(db db.DB) Application {
}
func (r Application) GetApplicationById(ctx context.Context, id int) (*entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.GetApplicationById")
q := `
SELECT id, name, description, application_group_id, type, created_at, updated_at
FROM application
WHERE id = $1
`
`
result := entity.Application{}
err := r.db.SelectRow(ctx, &result, q, id)
switch {
@@ -43,6 +46,8 @@ func (r Application) GetApplicationById(ctx context.Context, id int) (*entity.Ap
}
func (r Application) GetApplicationByIdList(ctx context.Context, idList []int) ([]entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.GetApplicationByIdList")
q, args, err := query.New().
Select("id", "name", "description", "application_group_id", "type", "created_at", "updated_at").
From("application").
@@ -63,6 +68,8 @@ func (r Application) GetApplicationByIdList(ctx context.Context, idList []int) (
}
func (r Application) GetApplicationByAppGroupIdList(ctx context.Context, appGroupIdList []int) ([]entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.GetApplicationByAppGroupIdList")
q, args, err := query.New().
Select("id", "name", "description", "application_group_id", "type", "created_at", "updated_at").
From("application").
@@ -83,11 +90,13 @@ func (r Application) GetApplicationByAppGroupIdList(ctx context.Context, appGrou
}
func (r Application) GetApplicationByNameAndAppGroupId(ctx context.Context, name string, serviceId int) (*entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.GetApplicationByNameAndAppGroupId")
q := `
SELECT id, name, description, application_group_id, type, created_at, updated_at
FROM application
WHERE name = $1 AND application_group_id = $2
`
`
result := entity.Application{}
err := r.db.SelectRow(ctx, &result, q, name, serviceId)
switch {
@@ -100,14 +109,22 @@ func (r Application) GetApplicationByNameAndAppGroupId(ctx context.Context, name
}
}
func (r Application) CreateApplication(ctx context.Context, id int, name string, desc string, appGroupId int, appType string) (
*entity.Application, error) {
func (r Application) CreateApplication(
ctx context.Context,
id int,
name string,
desc string,
appGroupId int,
appType string,
) (*entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.CreateApplication")
q := `
INSERT INTO application
(id, name, description, application_group_id, type)
VALUES ($1, $2, $3, $4, $5)
RETURNING id, name, description, application_group_id, type, created_at, updated_at
`
`
result := entity.Application{}
err := r.db.SelectRow(ctx, &result, q, id, name, desc, appGroupId, appType)
if err != nil {
@@ -122,13 +139,15 @@ func (r Application) UpdateApplication(
name string,
description string,
) (*entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.UpdateApplication")
q := `
UPDATE application
SET name = $2,
description = $3
WHERE id = $1
RETURNING id, name, description, application_group_id, type, created_at, updated_at
`
`
result := entity.Application{}
err := r.db.SelectRow(ctx, &result, q, id, name, description)
if err != nil {
@@ -144,6 +163,8 @@ func (r Application) UpdateApplicationWithNewId(
name string,
description string,
) (*entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.UpdateApplicationWithNewId")
q := `
UPDATE application
SET id = $2,
@@ -151,7 +172,7 @@ func (r Application) UpdateApplicationWithNewId(
description = $4
WHERE id = $1
RETURNING id, name, description, application_group_id, type, created_at, updated_at
`
`
result := entity.Application{}
err := r.db.SelectRow(ctx, &result, q, oldId, newId, name, description)
if err != nil {
@@ -161,6 +182,8 @@ func (r Application) UpdateApplicationWithNewId(
}
func (r Application) DeleteApplicationByIdList(ctx context.Context, idList []int) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.DeleteApplicationByIdList")
q, args, err := query.New().
Delete("application").
Where(squirrel.Eq{"id": idList}).
@@ -183,6 +206,8 @@ func (r Application) DeleteApplicationByIdList(ctx context.Context, idList []int
}
func (r Application) NextApplicationId(ctx context.Context) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.NextApplicationId")
q := `SELECT COALESCE(MAX(id)+1, 1) FROM application;`
nextAppId := 0
err := r.db.SelectRow(ctx, &nextAppId, q)
@@ -193,6 +218,8 @@ func (r Application) NextApplicationId(ctx context.Context) (int, error) {
}
func (r Application) GetAllApplications(ctx context.Context) ([]entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.GetAllApplications")
q, args, err := query.New().
Select("id", "name", "description", "application_group_id", "type", "created_at", "updated_at").
From("application").
+22 -6
View File
@@ -4,12 +4,14 @@ import (
"context"
"database/sql"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/Masterminds/squirrel"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/txix-open/isp-kit/metrics/sql_metrics"
)
type Domain struct {
@@ -23,11 +25,13 @@ func NewDomain(db db.DB) Domain {
}
func (r Domain) GetDomainById(ctx context.Context, id int) (*entity.Domain, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Domain.GetDomainById")
q := `
SELECT id, name, description, system_id, created_at, updated_at
FROM domain
WHERE id = $1
`
`
result := entity.Domain{}
err := r.db.SelectRow(ctx, &result, q, id)
switch {
@@ -41,6 +45,8 @@ func (r Domain) GetDomainById(ctx context.Context, id int) (*entity.Domain, erro
}
func (r Domain) GetDomainByIdList(ctx context.Context, idList []int) ([]entity.Domain, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Domain.GetDomainByIdList")
q, args, err := query.New().
Select("id", "name", "description", "system_id", "created_at", "updated_at").
From("domain").
@@ -60,12 +66,14 @@ func (r Domain) GetDomainByIdList(ctx context.Context, idList []int) ([]entity.D
}
func (r Domain) GetDomainBySystemId(ctx context.Context, systemId int) ([]entity.Domain, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Domain.GetDomainBySystemId")
q := `
SELECT id, name, description, system_id, created_at, updated_at
FROM domain
WHERE system_id = $1
ORDER BY created_at DESC
`
`
result := make([]entity.Domain, 0)
err := r.db.Select(ctx, &result, q, systemId)
if err != nil {
@@ -76,11 +84,13 @@ func (r Domain) GetDomainBySystemId(ctx context.Context, systemId int) ([]entity
}
func (r Domain) GetDomainByNameAndSystemId(ctx context.Context, name string, systemId int) (*entity.Domain, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Domain.GetDomainByNameAndSystemId")
q := `
SELECT id, name, description, system_id, created_at, updated_at
FROM domain
WHERE name = $1 AND system_id = $2
`
`
result := entity.Domain{}
err := r.db.SelectRow(ctx, &result, q, name, systemId)
switch {
@@ -94,12 +104,14 @@ func (r Domain) GetDomainByNameAndSystemId(ctx context.Context, name string, sys
}
func (r Domain) CreateDomain(ctx context.Context, name string, desc string, systemId int) (*entity.Domain, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Domain.CreateDomain")
q := `
INSERT INTO domain
(name, description, system_id)
VALUES ($1, $2, $3)
RETURNING id, name, description, system_id, created_at, updated_at
`
`
result := entity.Domain{}
err := r.db.SelectRow(ctx, &result, q, name, desc, systemId)
if err != nil {
@@ -109,6 +121,8 @@ func (r Domain) CreateDomain(ctx context.Context, name string, desc string, syst
}
func (r Domain) UpdateDomain(ctx context.Context, id int, name string, description string) (*entity.Domain, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Domain.UpdateDomain")
q := `
UPDATE domain
SET name = $1, description = $2
@@ -128,6 +142,8 @@ func (r Domain) UpdateDomain(ctx context.Context, id int, name string, descripti
}
func (r Domain) DeleteDomain(ctx context.Context, idList []int) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Domain.DeleteDomain")
q, args, err := query.New().
Delete("domain").
Where(squirrel.Eq{"id": idList}).
+17 -5
View File
@@ -4,12 +4,14 @@ import (
"context"
"database/sql"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/Masterminds/squirrel"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/txix-open/isp-kit/metrics/sql_metrics"
)
type Token struct {
@@ -23,12 +25,14 @@ func NewToken(db db.DB) Token {
}
func (r Token) SaveToken(ctx context.Context, token string, appId int, expireTime int) (*entity.Token, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.SaveToken")
q := `
INSERT INTO token
(token, app_id, expire_time)
VALUES ($1, $2, $3)
RETURNING token, app_id, expire_time, created_at
`
`
result := entity.Token{}
err := r.db.SelectRow(ctx, &result, q, token, appId, expireTime)
if err != nil {
@@ -39,11 +43,13 @@ func (r Token) SaveToken(ctx context.Context, token string, appId int, expireTim
}
func (r Token) GetTokenById(ctx context.Context, token string) (*entity.Token, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.GetTokenById")
q := `
SELECT token, app_id, expire_time, created_at
FROM token
WHERE token = $1
`
`
result := entity.Token{}
err := r.db.SelectRow(ctx, &result, q, token)
switch {
@@ -57,6 +63,8 @@ func (r Token) GetTokenById(ctx context.Context, token string) (*entity.Token, e
}
func (r Token) GetTokenByAppIdList(ctx context.Context, appIdList []int) ([]entity.Token, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.GetTokenByAppIdList")
q, args, err := query.New().
Select("token", "app_id", "expire_time", "created_at").
From("token").
@@ -77,6 +85,8 @@ func (r Token) GetTokenByAppIdList(ctx context.Context, appIdList []int) ([]enti
}
func (r Token) DeleteToken(ctx context.Context, tokens []string) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.DeleteToken")
q, args, err := query.New().
Delete("token").
Where(squirrel.Eq{"token": tokens}).
@@ -99,8 +109,10 @@ func (r Token) DeleteToken(ctx context.Context, tokens []string) (int, error) {
}
func (r Token) AuthDataByToken(ctx context.Context, token string) (*entity.AuthData, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.AuthDataByToken")
q := `
SELECT system_id, domain_id, application_group_id, app_id, token.expire_time, token.created_at
SELECT system_id, domain_id, application_group_id, app_id, application.name AS app_name , token.expire_time, token.created_at
FROM token
LEFT JOIN application
ON token.app_id = application.id
+27 -1
View File
@@ -1,10 +1,13 @@
package routes
import (
"isp-system-service/controller"
"isp-system-service/docs"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/common_endpoints"
"github.com/txix-open/isp-kit/grpc"
"github.com/txix-open/isp-kit/grpc/endpoint"
"isp-system-service/controller"
)
type Controllers struct {
@@ -38,6 +41,7 @@ func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor {
applicationCluster(c),
tokenCluster(c),
applicationGroupCluster(c),
commonEndpoints(),
)
}
@@ -73,6 +77,16 @@ func accessListCluster(c Controllers) []cluster.EndpointDescriptor {
Inner: true,
Handler: c.AccessList.SetList,
},
{
Path: "system/access_list/delete_list",
Inner: true,
Handler: c.AccessList.DeleteList,
},
{
Path: "system/access_list/delete_list_with_methods",
Inner: true,
Handler: c.AccessList.DeleteListWithMethods,
},
}
}
@@ -154,6 +168,11 @@ func applicationCluster(c Controllers) []cluster.EndpointDescriptor {
Inner: true,
Handler: c.Application.GetById,
},
{
Path: "system/application/get_application_by_token",
Inner: true,
Handler: c.Application.GetByToken,
},
{
Path: "system/application/delete_applications",
Inner: true,
@@ -237,6 +256,13 @@ func applicationGroupCluster(c Controllers) []cluster.EndpointDescriptor {
}
}
func commonEndpoints() []cluster.EndpointDescriptor {
return common_endpoints.CommonEndpoints(
"system",
common_endpoints.WithSwaggerEndpoint(docs.SwaggerJson),
)
}
func concatCluster(clusters ...[]cluster.EndpointDescriptor) []cluster.EndpointDescriptor {
var result []cluster.EndpointDescriptor
for _, c := range clusters {
+43 -9
View File
@@ -11,6 +11,7 @@ import (
type AccessListRepo interface {
GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error)
DeleteAccessList(ctx context.Context, appId int, methods []entity.Method) error
}
type AccessListSetOneTx interface {
@@ -20,7 +21,7 @@ type AccessListSetOneTx interface {
type AccessListSetListTx interface {
GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error)
InsertArrayAccessList(ctx context.Context, entity []entity.AccessList) error
DeleteAccessList(ctx context.Context, appId int, methods []string) error
DeleteAccessList(ctx context.Context, appId int, methods []entity.Method) error
DeleteAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error)
}
@@ -78,9 +79,10 @@ func (s AccessList) SetOne(ctx context.Context, request domain.AccessListSetOneR
var resp int
err = s.tx.AccessListSetOneTx(ctx, func(ctx context.Context, tx AccessListSetOneTx) error {
resp, err = tx.UpsertAccessList(ctx, entity.AccessList{
AppId: request.AppId,
Method: request.Method,
Value: request.Value,
AppId: request.AppId,
HttpMethod: request.HttpMethod,
Method: request.Method,
Value: request.Value,
})
if err != nil {
return errors.WithMessage(err, "upsert access list")
@@ -112,13 +114,17 @@ func (s AccessList) SetList(ctx context.Context, req domain.AccessListSetListReq
}
newAccessList := make([]entity.AccessList, len(req.Methods))
updateMethods := make([]string, len(req.Methods))
updateMethods := make([]entity.Method, len(req.Methods))
for i, m := range req.Methods {
updateMethods[i] = m.Method
updateMethods[i] = entity.Method{
HttpMethod: m.HttpMethod,
Method: m.Method,
}
newAccessList[i] = entity.AccessList{
AppId: req.AppId,
Method: m.Method,
Value: m.Value,
AppId: req.AppId,
HttpMethod: m.HttpMethod,
Method: m.Method,
Value: m.Value,
}
}
@@ -155,3 +161,31 @@ func (s AccessList) SetList(ctx context.Context, req domain.AccessListSetListReq
return methodInfos, nil
}
func (s AccessList) DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error {
methods := make([]domain.Method, 0, len(req.Methods))
for _, method := range req.Methods {
methods = append(methods, domain.Method{Method: method})
}
return s.DeleteListWithMethods(ctx, domain.AccessListDeleteV2ListRequest{
AppId: req.AppId,
Methods: methods,
})
}
func (s AccessList) DeleteListWithMethods(ctx context.Context, req domain.AccessListDeleteV2ListRequest) error {
_, err := s.appRepo.GetApplicationById(ctx, req.AppId)
if err != nil {
return errors.WithMessage(err, "get application by id")
}
methods := make([]entity.Method, 0, len(req.Methods))
for _, method := range req.Methods {
methods = append(methods, entity.Method{Method: method.Method, HttpMethod: method.HttpMethod})
}
err = s.accessListRepo.DeleteAccessList(ctx, req.AppId, methods)
if err != nil {
return errors.WithMessage(err, "delete access_list")
}
return nil
}
+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 {
+2 -1
View File
@@ -3,9 +3,10 @@ package service
import (
"context"
"github.com/pkg/errors"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/pkg/errors"
)
type Domain struct {
+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 {
+9 -3
View File
@@ -15,7 +15,7 @@ type TokenRep interface {
}
type AccessListRep interface {
GetAccessListByAppIdAndMethod(ctx context.Context, appId int, method string) (*entity.AccessList, error)
GetAccessListByAppIdAndMethod(ctx context.Context, appId int, httpMethod string, method string) (*entity.AccessList, error)
}
type Service struct {
@@ -45,6 +45,7 @@ func (s Service) Authenticate(ctx context.Context, token string) (*domain.AuthDa
}
return &domain.AuthData{
AppName: authData.AppName,
SystemId: authData.SystemId,
DomainId: authData.DomainId,
ServiceId: authData.ApplicationGroupId,
@@ -52,8 +53,13 @@ func (s Service) Authenticate(ctx context.Context, token string) (*domain.AuthDa
}, nil
}
func (s Service) Authorize(ctx context.Context, appId int, endpoint string) (bool, error) {
accessList, err := s.accessListRep.GetAccessListByAppIdAndMethod(ctx, appId, endpoint)
func (s Service) Authorize(ctx context.Context, req domain.AuthorizeRequest) (bool, error) {
accessList, err := s.accessListRep.GetAccessListByAppIdAndMethod(
ctx,
req.ApplicationId,
req.HttpMethod,
req.Endpoint,
)
if err != nil {
return false, errors.WithMessage(err, "get access list by app_id and method")
}
+232
View File
@@ -0,0 +1,232 @@
package tests_test
import (
"testing"
"github.com/txix-open/isp-kit/dbx"
"isp-system-service/assembly"
"isp-system-service/conf"
"isp-system-service/domain"
"isp-system-service/entity"
"isp-system-service/repository"
"github.com/stretchr/testify/suite"
"github.com/txix-open/isp-kit/grpc/client"
"github.com/txix-open/isp-kit/test"
"github.com/txix-open/isp-kit/test/dbt"
"github.com/txix-open/isp-kit/test/fake"
"github.com/txix-open/isp-kit/test/grpct"
)
func TestAccessListSuite(t *testing.T) {
t.Parallel()
suite.Run(t, &AccessListSuite{})
}
type AccessListSuite struct {
suite.Suite
test *test.Test
testDb *dbt.TestDb
api *client.Client
accessListRepo repository.AccessList
appId int
}
func (s *AccessListSuite) SetupTest() {
s.test, _ = test.New(s.T())
s.testDb = dbt.New(s.test, dbx.WithMigrationRunner("../migrations", s.test.Logger()))
locator := assembly.NewLocator(s.testDb, s.test.Logger())
config := locator.Config(conf.Remote{})
_, s.api = grpct.TestServer(s.test, config.Handler)
s.accessListRepo = repository.NewAccessList(s.testDb)
createdDomain, err := repository.NewDomain(s.testDb).CreateDomain(
s.T().Context(),
fake.It[string](),
fake.It[string](),
1,
)
s.Require().NoError(err)
appGroup, err := repository.NewAppGroup(s.testDb).CreateAppGroup(
s.T().Context(),
fake.It[string](),
fake.It[string](),
createdDomain.Id,
)
s.Require().NoError(err)
s.appId = fake.It[int]()
_, err = repository.NewApplication(s.testDb).CreateApplication(
s.T().Context(),
s.appId,
fake.It[string](),
fake.It[string](),
appGroup.Id,
domain.ApplicationSystemType,
)
s.Require().NoError(err)
}
func (s *AccessListSuite) TestGetById_HappyPath() {
expectedAccessList := []entity.AccessList{
{
AppId: s.appId,
Method: fake.It[string](),
Value: false,
},
{
AppId: s.appId,
Method: fake.It[string](),
Value: true,
},
{
AppId: s.appId,
Method: fake.It[string](),
Value: true,
},
}
err := s.accessListRepo.InsertArrayAccessList(s.T().Context(), expectedAccessList)
s.Require().NoError(err)
req := domain.Identity{
Id: s.appId,
}
var accessList []domain.MethodInfo
err = s.api.Invoke("system/access_list/get_by_id").
JsonRequestBody(&req).
JsonResponseBody(&accessList).
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Len(accessList, len(expectedAccessList))
actualAccessList := s.convertAccessList(accessList)
s.Require().ElementsMatch(expectedAccessList, actualAccessList)
}
func (s *AccessListSuite) TestSetOne_HappyPath() {
expectedAccessList := []entity.AccessList{
{
AppId: s.appId,
Method: fake.It[string](),
Value: false,
},
{
AppId: s.appId,
Method: fake.It[string](),
Value: true,
},
{
AppId: s.appId,
Method: fake.It[string](),
Value: true,
},
}
err := s.accessListRepo.InsertArrayAccessList(s.T().Context(), expectedAccessList)
s.Require().NoError(err)
req := domain.AccessListSetOneRequest{
AppId: s.appId,
Method: expectedAccessList[0].Method,
Value: true,
}
err = s.api.Invoke("system/access_list/set_one").
JsonRequestBody(&req).
Do(s.T().Context())
s.Require().NoError(err)
actualAccessList, err := s.accessListRepo.GetAccessListByAppId(s.T().Context(), s.appId)
s.Require().NoError(err)
for i := range expectedAccessList {
expectedAccessList[i].Value = true
}
s.Require().ElementsMatch(expectedAccessList, actualAccessList)
}
func (s *AccessListSuite) TestSetList_HappyPath() {
req := domain.AccessListSetListRequest{
AppId: s.appId,
Methods: []domain.MethodInfo{
{
Method: fake.It[string](),
Value: true,
},
{
Method: fake.It[string](),
Value: true,
},
},
}
err := s.api.Invoke("system/access_list/set_list").
JsonRequestBody(&req).
Do(s.T().Context())
s.Require().NoError(err)
actualAccessList, err := s.accessListRepo.GetAccessListByAppId(s.T().Context(), s.appId)
s.Require().NoError(err)
s.Require().Len(actualAccessList, len(req.Methods))
expectedAccessList := s.convertAccessList(req.Methods)
s.Require().ElementsMatch(expectedAccessList, actualAccessList)
}
func (s *AccessListSuite) TestDeleteList_HappyPath() {
accessList := []entity.AccessList{
{
AppId: s.appId,
Method: fake.It[string](),
Value: false,
},
{
AppId: s.appId,
Method: fake.It[string](),
Value: true,
},
{
AppId: s.appId,
Method: fake.It[string](),
Value: true,
},
}
err := s.accessListRepo.InsertArrayAccessList(s.T().Context(), accessList)
s.Require().NoError(err)
req := domain.AccessListDeleteListRequest{
AppId: s.appId,
Methods: []string{
accessList[0].Method,
accessList[1].Method,
},
}
err = s.api.Invoke("system/access_list/delete_list").
JsonRequestBody(&req).
Do(s.T().Context())
s.Require().NoError(err)
actualAccessList, err := s.accessListRepo.GetAccessListByAppId(s.T().Context(), s.appId)
s.Require().NoError(err)
s.Require().Len(actualAccessList, 1)
s.Require().Equal(accessList[2], actualAccessList[0])
}
func (s *AccessListSuite) convertAccessList(methods []domain.MethodInfo) []entity.AccessList {
converted := make([]entity.AccessList, 0, len(methods))
for _, method := range methods {
converted = append(converted, entity.AccessList{
AppId: s.appId,
Method: method.Method,
Value: method.Value,
})
}
return converted
}
+1
View File
@@ -26,6 +26,7 @@ func TestApplicationGroupSuite(t *testing.T) {
type AppGroupSuite struct {
suite.Suite
test *test.Test
testDb *dbt.TestDb
domainRepo repository.Domain
+75 -25
View File
@@ -26,11 +26,13 @@ func TestApplicationSuite(t *testing.T) {
type ApplicationSuite struct {
suite.Suite
test *test.Test
testDb *dbt.TestDb
domainRepo repository.Domain
appRepo repository.Application
appGroupRepo repository.AppGroup
tokenRepo repository.Token
api *client.Client
}
@@ -45,11 +47,11 @@ func (s *ApplicationSuite) SetupTest() {
s.domainRepo = repository.NewDomain(s.testDb)
s.appRepo = repository.NewApplication(s.testDb)
s.appGroupRepo = repository.NewAppGroup(s.testDb)
s.tokenRepo = repository.NewToken(s.testDb)
}
func (s *ApplicationSuite) TestGetAllApplications() {
toInsert := fake.It[[]domain.Application](fake.MaxSliceSize(2), fake.MinSliceSize(2))
expectedApps := s.insertApps(toInsert)
expectedApps := s.insertApps(2)
result := []domain.Application{}
err := s.api.Invoke("system/application/get_all").
@@ -68,10 +70,14 @@ func (s *ApplicationSuite) TestGetAllApplications() {
func (s *ApplicationSuite) TestCreate_HappyPath() {
result := domain.ApplicationWithTokens{}
apiReq := fake.It[domain.CreateApplicationRequest]()
apiReq.Type = domain.ApplicationSystemType
appGroup := s.createAppGroup()
apiReq.ApplicationGroupId = appGroup.Id
apiReq := domain.CreateApplicationRequest{
Id: 1,
Name: fake.It[string](),
Type: domain.ApplicationSystemType,
ApplicationGroupId: appGroup.Id,
}
err := s.api.Invoke("system/application/create_application").
JsonRequestBody(apiReq).
@@ -97,8 +103,12 @@ func (s *ApplicationSuite) TestCreate_HappyPath() {
}
func (s *ApplicationSuite) TestCreate_AppGroupNotFound() {
apiReq := fake.It[domain.CreateApplicationRequest]()
apiReq.Type = domain.ApplicationSystemType
apiReq := domain.CreateApplicationRequest{
Id: 1,
Name: fake.It[string](),
Type: domain.ApplicationSystemType,
ApplicationGroupId: 1,
}
err := s.api.Invoke("system/application/create_application").
JsonRequestBody(apiReq).
@@ -109,13 +119,14 @@ func (s *ApplicationSuite) TestCreate_AppGroupNotFound() {
}
func (s *ApplicationSuite) TestCreate_ApplicationNameNotUniqueInAppGroup() {
apiReq := fake.It[domain.CreateApplicationRequest]()
apiReq.Type = domain.ApplicationSystemType
inserted := s.insertApps(1)
inserted := s.insertApps(fake.It[[]domain.Application](fake.MinSliceSize(1), fake.MaxSliceSize(1)))
apiReq.ApplicationGroupId = inserted[0].ServiceId
apiReq.Name = inserted[0].Name
apiReq := domain.CreateApplicationRequest{
Id: inserted[0].Id + 1,
Name: inserted[0].Name,
Type: domain.ApplicationSystemType,
ApplicationGroupId: inserted[0].ServiceId,
}
err := s.api.Invoke("system/application/create_application").
JsonRequestBody(apiReq).
@@ -126,13 +137,14 @@ func (s *ApplicationSuite) TestCreate_ApplicationNameNotUniqueInAppGroup() {
}
func (s *ApplicationSuite) TestCreate_ApplicationIdNotUnique() {
apiReq := fake.It[domain.CreateApplicationRequest]()
apiReq.Type = "SYSTEM"
appGroup := s.createAppGroup()
apiReq.ApplicationGroupId = appGroup.Id
inserted := s.insertApps(1)
inserted := s.insertApps(fake.It[[]domain.Application](fake.MinSliceSize(1), fake.MaxSliceSize(1)))
apiReq.Id = inserted[0].Id
apiReq := domain.CreateApplicationRequest{
Id: inserted[0].Id,
Name: inserted[0].Name,
Type: domain.ApplicationSystemType,
ApplicationGroupId: inserted[0].ServiceId,
}
err := s.api.Invoke("system/application/create_application").
JsonRequestBody(apiReq).
@@ -143,10 +155,10 @@ func (s *ApplicationSuite) TestCreate_ApplicationIdNotUnique() {
}
func (s *ApplicationSuite) TestUpdate_HappyPath() {
inserted := s.insertApps(fake.It[[]domain.Application](fake.MinSliceSize(1), fake.MaxSliceSize(1)))
inserted := s.insertApps(2)
apiReq := domain.UpdateApplicationRequest{
OldId: inserted[0].Id,
NewId: fake.It[int](),
NewId: inserted[0].Id + inserted[1].Id,
Name: fake.It[string](),
Description: fake.It[string](),
}
@@ -194,7 +206,7 @@ func (s *ApplicationSuite) TestUpdate_HappyPath() {
}
func (s *ApplicationSuite) TestUpdate_ApplicationNameNotUniqueInAppGroup() {
inserted := s.insertApps(fake.It[[]domain.Application](fake.MinSliceSize(2), fake.MaxSliceSize(2)))
inserted := s.insertApps(2)
apiReq := domain.UpdateApplicationRequest{
NewId: inserted[0].Id,
OldId: inserted[0].Id,
@@ -211,7 +223,7 @@ func (s *ApplicationSuite) TestUpdate_ApplicationNameNotUniqueInAppGroup() {
}
func (s *ApplicationSuite) TestUpdate_AppIdNotUnique() {
inserted := s.insertApps(fake.It[[]domain.Application](fake.MinSliceSize(2), fake.MaxSliceSize(2)))
inserted := s.insertApps(2)
apiReq := domain.UpdateApplicationRequest{
OldId: inserted[0].Id,
NewId: inserted[1].Id,
@@ -243,6 +255,39 @@ func (s *ApplicationSuite) TestUpdate_AppNotFound() {
s.Require().Equal(domain.ErrCodeApplicationNotFound, apiError.ErrorCode)
}
func (s *ApplicationSuite) TestGetByToken() {
insertedApps := s.insertApps(2)
token := fake.It[string]()
expectedApp := domain.GetApplicationByTokenResponse{
ApplicationId: insertedApps[0].Id,
ApplicationGroupId: insertedApps[0].ServiceId,
}
_, err := s.tokenRepo.SaveToken(s.T().Context(), token, expectedApp.ApplicationId, fake.It[int]())
s.Require().NoError(err)
result := domain.GetApplicationByTokenResponse{}
err = s.api.Invoke("system/application/get_application_by_token").
JsonRequestBody(domain.GetApplicationByTokenRequest{Token: token}).
JsonResponseBody(&result).
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Equal(expectedApp, result)
}
func (s *ApplicationSuite) TestGetByToken_NotFound() {
s.insertApps(2)
result := domain.GetApplicationByTokenResponse{}
err := s.api.Invoke("system/application/get_application_by_token").
JsonRequestBody(domain.GetApplicationByTokenRequest{Token: fake.It[string]()}).
JsonResponseBody(&result).
Do(s.T().Context())
apiError := apierrors.FromError(err)
s.Require().NotNil(apiError)
s.Require().Equal(domain.ErrCodeApplicationNotFound, apiError.ErrorCode)
}
func (s *ApplicationSuite) createAppGroup() *entity.AppGroup {
createdDomain, err := s.domainRepo.CreateDomain(
s.T().Context(),
@@ -262,13 +307,18 @@ func (s *ApplicationSuite) createAppGroup() *entity.AppGroup {
return appGroup
}
func (s *ApplicationSuite) insertApps(toInsert []domain.Application) []domain.Application {
func (s *ApplicationSuite) insertApps(appsCount uint) []domain.Application {
toInsert := fake.It[[]domain.Application](fake.MinSliceSize(appsCount), fake.MaxSliceSize(appsCount))
appGroup := s.createAppGroup()
toExpect := make([]domain.Application, 0, len(toInsert))
for _, app := range toInsert {
appId, err := s.appRepo.NextApplicationId(s.T().Context())
s.Require().NoError(err)
createdApp, err := s.appRepo.CreateApplication(
s.T().Context(),
app.Id,
appId,
app.Name,
app.Description,
appGroup.Id,
+3 -3
View File
@@ -1,7 +1,6 @@
package tests_test
import (
"context"
"github.com/stretchr/testify/suite"
"github.com/txix-open/isp-kit/dbx"
"github.com/txix-open/isp-kit/grpc/client"
@@ -22,6 +21,7 @@ func TestBaselineSuite(t *testing.T) {
type BaselineSuite struct {
suite.Suite
test *test.Test
testDb *dbt.TestDb
baseline baseline.Service
@@ -44,9 +44,9 @@ func (s *BaselineSuite) SetupSuite() {
}
func (s *BaselineSuite) TestBaselineSuccess() {
err := s.baseline.Do(context.Background())
err := s.baseline.Do(s.T().Context())
s.Require().NoError(err)
err = s.baseline.Do(context.Background())
err = s.baseline.Do(s.T().Context())
s.Require().NoError(err)
}
+52 -28
View File
@@ -1,7 +1,7 @@
package tests_test
import (
"context"
"net/http"
"testing"
"time"
@@ -12,7 +12,6 @@ import (
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/txix-open/isp-kit/grpc/client"
"github.com/txix-open/isp-kit/test"
@@ -27,14 +26,14 @@ func TestSecureSuite(t *testing.T) {
type SecureSuite struct {
suite.Suite
test *test.Test
require *require.Assertions
testDb *dbt.TestDb
api *client.Client
test *test.Test
testDb *dbt.TestDb
api *client.Client
}
func (s *SecureSuite) SetupSuite() {
s.test, s.require = test.New(s.T())
s.test, _ = test.New(s.T())
s.testDb = dbt.New(s.test, dbx.WithMigrationRunner("../migrations", s.test.Logger()))
@@ -65,12 +64,13 @@ func (s *SecureSuite) TestAuthenticate_Success() {
Token: "test_token_success",
}).
JsonResponseBody(&result).
Do(context.Background())
s.require.NoError(err)
s.require.Equal(domain.AuthenticateResponse{
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Equal(domain.AuthenticateResponse{
Authenticated: true,
ErrorReason: "",
AuthData: &domain.AuthData{
AppName: "test_application",
SystemId: 1,
DomainId: 3,
ServiceId: 5,
@@ -86,9 +86,9 @@ func (s *SecureSuite) TestAuthenticate_NotFound() {
Token: "test_token_not_found",
}).
JsonResponseBody(&result).
Do(context.Background())
s.require.NoError(err)
s.require.Equal(domain.AuthenticateResponse{
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Equal(domain.AuthenticateResponse{
Authenticated: false,
ErrorReason: domain.ErrTokenNotFound.Error(),
AuthData: nil,
@@ -106,12 +106,13 @@ func (s *SecureSuite) TestAuthenticate_NotExpired() {
Token: "test_token_not_expired",
}).
JsonResponseBody(&result).
Do(context.Background())
s.require.NoError(err)
s.require.Equal(domain.AuthenticateResponse{
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Equal(domain.AuthenticateResponse{
Authenticated: true,
ErrorReason: "",
AuthData: &domain.AuthData{
AppName: "test_application",
SystemId: 1,
DomainId: 3,
ServiceId: 5,
@@ -131,9 +132,9 @@ func (s *SecureSuite) TestAuthenticate_Expired() {
Token: "test_token_expired",
}).
JsonResponseBody(&result).
Do(context.Background())
s.require.NoError(err)
s.require.Equal(domain.AuthenticateResponse{
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Equal(domain.AuthenticateResponse{
Authenticated: false,
ErrorReason: domain.ErrTokenExpired.Error(),
AuthData: nil,
@@ -154,9 +155,9 @@ func (s *SecureSuite) TestAuthorize_Success_True() {
Endpoint: "endpoint/available",
}).
JsonResponseBody(&result).
Do(context.Background())
s.require.NoError(err)
s.require.Equal(domain.AuthorizeResponse{
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Equal(domain.AuthorizeResponse{
Authorized: true,
}, result)
}
@@ -175,9 +176,9 @@ func (s *SecureSuite) TestAuthorize_Success_False() {
Endpoint: "endpoint/not_available",
}).
JsonResponseBody(&result).
Do(context.Background())
s.require.NoError(err)
s.require.Equal(domain.AuthorizeResponse{
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Equal(domain.AuthorizeResponse{
Authorized: false,
}, result)
}
@@ -190,9 +191,32 @@ func (s *SecureSuite) TestAuthorize_NotFound() {
Endpoint: "endpoint/not_found",
}).
JsonResponseBody(&result).
Do(context.Background())
s.require.NoError(err)
s.require.Equal(domain.AuthorizeResponse{
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Equal(domain.AuthorizeResponse{
Authorized: false,
}, result)
}
func (s *SecureSuite) TestAuthorize_WithHttpMethod_Success_True() {
InsertAccessList(s.testDb, entity.AccessList{
AppId: 7,
HttpMethod: http.MethodGet,
Method: "endpoint/available_http",
Value: true,
})
result := domain.AuthorizeResponse{}
err := s.api.Invoke("system/secure/authorize").
JsonRequestBody(domain.AuthorizeRequest{
ApplicationId: 7,
HttpMethod: http.MethodGet,
Endpoint: "endpoint/available_http",
}).
JsonResponseBody(&result).
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Equal(domain.AuthorizeResponse{
Authorized: true,
}, result)
}