From 0688ca082aace3c1dc54d24546daf4f99268d13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=20?= =?UTF-8?q?=D0=A2=D0=B8=D0=BC=D1=83=D1=80=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 19 Jan 2026 14:46:48 +0300 Subject: [PATCH 1/8] MSP-7042 Up deps --- go.mod | 12 ++++++------ go.sum | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index 830b941..cdce8f6 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/jackc/pgx/v5 v5.7.6 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.11.1 - github.com/txix-open/isp-kit v1.62.0 + github.com/txix-open/isp-kit v1.64.6 github.com/txix-open/jsonschema v1.3.0 google.golang.org/grpc v1.75.1 ) @@ -69,11 +69,11 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect - golang.org/x/crypto v0.42.0 // indirect - golang.org/x/net v0.44.0 // indirect - golang.org/x/sync v0.17.0 // indirect - golang.org/x/sys v0.36.0 // indirect - golang.org/x/text v0.29.0 // indirect + golang.org/x/crypto v0.45.0 // indirect + golang.org/x/net v0.47.0 // indirect + golang.org/x/sync v0.18.0 // indirect + golang.org/x/sys v0.38.0 // indirect + golang.org/x/text v0.31.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 // indirect google.golang.org/protobuf v1.36.9 // indirect diff --git a/go.sum b/go.sum index f8571b6..8a35b7b 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -146,8 +146,8 @@ github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIg github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8= 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.62.0 h1:SfY8x5/3yYEicr5phGTJBaUwFvgktSIsD/NubrKYbg4= -github.com/txix-open/isp-kit v1.62.0/go.mod h1:hyCFmWF0qoVY2loTLyHJx8QPZJuULntG0JfthqFCdsA= +github.com/txix-open/isp-kit v1.64.6 h1:AXQ8/HQGG1VoJyiFvPqgPimPp5WJ4MrlWzPBxuxqhRs= +github.com/txix-open/isp-kit v1.64.6/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= @@ -189,18 +189,18 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/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.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= -golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= 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.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= -golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= -golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= -golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= +golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= +golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= +golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= 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-20250908214217-97024824d090 h1:d8Nakh1G+ur7+P3GcMjpRDEkoLUcLW2iU92XVqR+XMQ= From 4932568c6448c770122f5db40b835fdff9e9d96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=20?= =?UTF-8?q?=D0=A2=D0=B8=D0=BC=D1=83=D1=80=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 19 Jan 2026 15:10:20 +0300 Subject: [PATCH 2/8] MSP-7042 Add sql metrics --- repository/access_list.go | 23 ++++++++++++++++++---- repository/app_group.go | 25 ++++++++++++++++++++---- repository/application.go | 41 ++++++++++++++++++++++++++++++++------- repository/domain.go | 23 ++++++++++++++++++---- repository/token.go | 15 ++++++++++++-- 5 files changed, 106 insertions(+), 21 deletions(-) diff --git a/repository/access_list.go b/repository/access_list.go index 6a33af1..09c31d0 100644 --- a/repository/access_list.go +++ b/repository/access_list.go @@ -11,6 +11,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 AccessList struct { @@ -24,11 +25,13 @@ func NewAccessList(db db.DB) AccessList { } func (r AccessList) GetAccessListByAppIdAndMethod(ctx context.Context, appId int, 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 -` + ` result := entity.AccessList{} err := r.db.SelectRow(ctx, &result, q, appId, method) switch { @@ -42,11 +45,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 FROM access_list WHERE app_id = $1 -` + ` result := make([]entity.AccessList, 0) err := r.db.Select(ctx, &result, q, appId) if err != nil { @@ -57,6 +62,8 @@ 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"). From("access_list"). @@ -76,6 +83,8 @@ 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") @@ -96,6 +105,8 @@ 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) @@ -103,7 +114,7 @@ func (r AccessList) UpsertAccessList(ctx context.Context, e entity.AccessList) ( ON CONFLICT (app_id, method) DO UPDATE SET (value) = (SELECT EXCLUDED.value) -` + ` result, err := r.db.Exec(ctx, q, e.AppId, e.Method, e.Value) if err != nil { return 0, errors.WithMessagef(err, "exec query %s", q) @@ -118,6 +129,8 @@ func (r AccessList) UpsertAccessList(ctx context.Context, e entity.AccessList) ( } func (r AccessList) DeleteAccessList(ctx context.Context, appId int, methods []string) error { + ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.DeleteAccessList") + q, args, err := query.New(). Delete("access_list"). Where(squirrel.Eq{ @@ -139,11 +152,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 -` + ` result := make([]entity.AccessList, 0) err := r.db.Select(ctx, &result, q, appId) if err != nil { diff --git a/repository/app_group.go b/repository/app_group.go index 5ce5e30..1248ce1 100644 --- a/repository/app_group.go +++ b/repository/app_group.go @@ -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"). diff --git a/repository/application.go b/repository/application.go index 32c94f7..dd3c4b2 100644 --- a/repository/application.go +++ b/repository/application.go @@ -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"). diff --git a/repository/domain.go b/repository/domain.go index 404543e..860f49a 100644 --- a/repository/domain.go +++ b/repository/domain.go @@ -11,6 +11,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 Domain struct { @@ -24,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 { @@ -42,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"). @@ -61,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 { @@ -77,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 { @@ -95,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 { @@ -110,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 @@ -129,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}). diff --git a/repository/token.go b/repository/token.go index 95f58fc..413d594 100644 --- a/repository/token.go +++ b/repository/token.go @@ -11,6 +11,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 Token struct { @@ -24,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 { @@ -40,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 { @@ -58,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"). @@ -78,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}). @@ -100,6 +109,8 @@ 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, application.name AS app_name , token.expire_time, token.created_at FROM token From e865549fdcd191cdde7456622dcd864e9947f22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=20?= =?UTF-8?q?=D0=A2=D0=B8=D0=BC=D1=83=D1=80=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 19 Jan 2026 14:45:43 +0300 Subject: [PATCH 3/8] MSP-7042 Add http_method to access_list --- controller/access_list.go | 28 ++++++++++ controller/secure.go | 4 +- docs/swagger.yaml | 56 +++++++++++++++++++ domain/access_list.go | 22 ++++++-- domain/secure.go | 3 +- entity/access_list.go | 12 +++- .../20260121072119_recreate_access_list.sql | 36 ++++++++++++ repository/access_list.go | 51 ++++++++++------- routes/routes.go | 5 ++ service/access_list.go | 43 ++++++++++---- service/secure/service.go | 11 +++- tests/secure_test.go | 24 ++++++++ 12 files changed, 251 insertions(+), 44 deletions(-) create mode 100644 migrations/20260121072119_recreate_access_list.sql diff --git a/controller/access_list.go b/controller/access_list.go index 1cdaa16..cbdb7b0 100644 --- a/controller/access_list.go +++ b/controller/access_list.go @@ -16,6 +16,7 @@ type AccessListService interface { 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 { @@ -141,3 +142,30 @@ func (c AccessList) DeleteList(ctx context.Context, req domain.AccessListDeleteL 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 + } +} diff --git a/controller/secure.go b/controller/secure.go index 5b5c0f0..aed11f8 100644 --- a/controller/secure.go +++ b/controller/secure.go @@ -10,7 +10,7 @@ import ( 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 { @@ -69,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{ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index ba2525c..15d7e3b 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -23,6 +23,19 @@ definitions: - appId - methods type: object + domain.AccessListDeleteV2ListRequest: + properties: + appId: + type: integer + methods: + items: + $ref: '#/definitions/domain.Method' + minItems: 1 + type: array + required: + - appId + - methods + type: object domain.AccessListSetListRequest: properties: appId: @@ -40,6 +53,8 @@ definitions: properties: appId: type: integer + httpMethod: + type: string method: type: string value: @@ -162,6 +177,8 @@ definitions: type: integer endpoint: type: string + httpMethod: + type: string required: - applicationId - endpoint @@ -276,8 +293,19 @@ definitions: required: - id type: object + domain.Method: + properties: + httpMethod: + type: string + method: + type: string + required: + - method + type: object domain.MethodInfo: properties: + httpMethod: + type: string method: type: string value: @@ -432,6 +460,34 @@ paths: summary: Удалить список доступных методов для приложения tags: - accessList + /access_list/delete_list_with_methods: + post: + consumes: + - application/json + description: Удаляет заданный список методов для приложения + parameters: + - description: тело запроса + in: body + name: body + schema: + $ref: '#/definitions/domain.AccessListDeleteV2ListRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: {} + "404": + description: Not Found + schema: + $ref: '#/definitions/apierrors.Error' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/apierrors.Error' + summary: Удалить список доступных методов для приложения + tags: + - accessList /access_list/get_by_id: post: consumes: diff --git a/domain/access_list.go b/domain/access_list.go index d822181..1610da9 100644 --- a/domain/access_list.go +++ b/domain/access_list.go @@ -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,11 +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"` +} diff --git a/domain/secure.go b/domain/secure.go index a273bbf..18d1b47 100644 --- a/domain/secure.go +++ b/domain/secure.go @@ -19,7 +19,8 @@ type AuthData struct { } type AuthorizeRequest struct { - ApplicationId int `validate:"required"` + ApplicationId int `validate:"required"` + HttpMethod string Endpoint string `validate:"required"` } diff --git a/entity/access_list.go b/entity/access_list.go index c0fc80a..92af2c5 100644 --- a/entity/access_list.go +++ b/entity/access_list.go @@ -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 } diff --git a/migrations/20260121072119_recreate_access_list.sql b/migrations/20260121072119_recreate_access_list.sql new file mode 100644 index 0000000..4a89768 --- /dev/null +++ b/migrations/20260121072119_recreate_access_list.sql @@ -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; \ No newline at end of file diff --git a/repository/access_list.go b/repository/access_list.go index 09c31d0..14a5c22 100644 --- a/repository/access_list.go +++ b/repository/access_list.go @@ -24,16 +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 @@ -48,7 +52,7 @@ func (r AccessList) GetAccessListByAppId(ctx context.Context, appId int) ([]enti 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 ` @@ -65,7 +69,7 @@ func (r AccessList) GetAccessListByAppIdList(ctx context.Context, appIdList []in 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() @@ -87,9 +91,9 @@ func (r AccessList) InsertArrayAccessList(ctx context.Context, entity []entity.A 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 { @@ -109,13 +113,13 @@ func (r AccessList) UpsertAccessList(ctx context.Context, e entity.AccessList) ( 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) } @@ -128,16 +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") @@ -157,7 +170,7 @@ func (r AccessList) DeleteAccessListByAppId(ctx context.Context, appId int) ([]e 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) diff --git a/routes/routes.go b/routes/routes.go index 2fb439a..e1eaf78 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -79,6 +79,11 @@ func accessListCluster(c Controllers) []cluster.EndpointDescriptor { Inner: true, Handler: c.AccessList.DeleteList, }, + { + Path: "system/access_list/delete_list_with_methods", + Inner: true, + Handler: c.AccessList.DeleteListWithMethods, + }, } } diff --git a/service/access_list.go b/service/access_list.go index c1157ca..765c8b3 100644 --- a/service/access_list.go +++ b/service/access_list.go @@ -11,7 +11,7 @@ import ( type AccessListRepo interface { GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) - DeleteAccessList(ctx context.Context, appId int, methods []string) error + DeleteAccessList(ctx context.Context, appId int, methods []entity.Method) error } type AccessListSetOneTx interface { @@ -21,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) } @@ -79,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") @@ -113,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, } } @@ -158,11 +163,27 @@ func (s AccessList) SetList(ctx context.Context, req domain.AccessListSetListReq } 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") } - err = s.accessListRepo.DeleteAccessList(ctx, req.AppId, req.Methods) + + 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") } diff --git a/service/secure/service.go b/service/secure/service.go index 1be0219..e5c51a1 100644 --- a/service/secure/service.go +++ b/service/secure/service.go @@ -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 { @@ -53,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") } diff --git a/tests/secure_test.go b/tests/secure_test.go index d3a4afc..38b7353 100644 --- a/tests/secure_test.go +++ b/tests/secure_test.go @@ -1,6 +1,7 @@ package tests_test import ( + "net/http" "testing" "time" @@ -196,3 +197,26 @@ func (s *SecureSuite) TestAuthorize_NotFound() { 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) +} From 9d8982b03f68f717dcdef9b257cdad8c11f58749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=20?= =?UTF-8?q?=D0=A2=D0=B8=D0=BC=D1=83=D1=80=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 19 Jan 2026 14:47:02 +0300 Subject: [PATCH 4/8] MSP-7042 Bump version to 5.7.0 --- .version | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.version b/.version index 4cc0e35..3b867cc 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -5.6.0 \ No newline at end of file +5.7.0 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d37c043..027865d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### v5.7.0 +* Обновлены зависимости +* Добавлено поле `http_method` в `access_list` ### v5.6.0 * Для endpoint'а `system/secure/authenticate` в ответ добавлено поле `appName` (название приложения) * Обновлена версия `go` до `1.25` From fe014c274c22a3af5634333946c07dcf681c5bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=20?= =?UTF-8?q?=D0=A2=D0=B8=D0=BC=D1=83=D1=80=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 27 Jan 2026 15:13:13 +0300 Subject: [PATCH 5/8] up deps --- go.mod | 2 +- go.sum | 4 ++-- main.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index cdce8f6..d337e7e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/jackc/pgx/v5 v5.7.6 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.11.1 - github.com/txix-open/isp-kit v1.64.6 + github.com/txix-open/isp-kit v1.64.8 github.com/txix-open/jsonschema v1.3.0 google.golang.org/grpc v1.75.1 ) diff --git a/go.sum b/go.sum index 8a35b7b..12beb13 100644 --- a/go.sum +++ b/go.sum @@ -146,8 +146,8 @@ github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIg github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8= 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.6 h1:AXQ8/HQGG1VoJyiFvPqgPimPp5WJ4MrlWzPBxuxqhRs= -github.com/txix-open/isp-kit v1.64.6/go.mod h1:GvBsX5p2U3/ugK6PuWANYzSy/4YgawROm3eAKb35G6o= +github.com/txix-open/isp-kit v1.64.8 h1:nck8Gw5a7Jh6AVLqR2FihurrP5bTfeLUrodYB4j4+p4= +github.com/txix-open/isp-kit v1.64.8/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= diff --git a/main.go b/main.go index 09aa1e1..f7696b5 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "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" ) @@ -25,7 +26,7 @@ var ( //go:generate swag init --parseDependency //go:generate rm -f docs/swagger.json 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() From 83e7fe915237b2cc42aeeb17efa37f1e461f7237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=20?= =?UTF-8?q?=D0=A2=D0=B8=D0=BC=D1=83=D1=80=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 27 Jan 2026 15:16:59 +0300 Subject: [PATCH 6/8] fix test --- tests/application_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/application_test.go b/tests/application_test.go index 6647590..c263a0b 100644 --- a/tests/application_test.go +++ b/tests/application_test.go @@ -158,7 +158,7 @@ func (s *ApplicationSuite) TestUpdate_HappyPath() { 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](), } From 57b0f7ed9940d6a6774fa668d6dd0a1c39b07670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=20?= =?UTF-8?q?=D0=A2=D0=B8=D0=BC=D1=83=D1=80=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 27 Jan 2026 16:13:35 +0300 Subject: [PATCH 7/8] add swagger endpoint --- docs/swagger.go | 9 +++++++++ routes/routes.go | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 docs/swagger.go diff --git a/docs/swagger.go b/docs/swagger.go new file mode 100644 index 0000000..eb9cf81 --- /dev/null +++ b/docs/swagger.go @@ -0,0 +1,9 @@ +package docs + +import _ "embed" + +// Embedded swagger files. +var ( + //go:embed swagger.yaml + SwaggerYaml []byte +) diff --git a/routes/routes.go b/routes/routes.go index e1eaf78..1a38d64 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -2,8 +2,10 @@ 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" ) @@ -39,6 +41,7 @@ func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor { applicationCluster(c), tokenCluster(c), applicationGroupCluster(c), + commonEndpoints(), ) } @@ -253,6 +256,13 @@ func applicationGroupCluster(c Controllers) []cluster.EndpointDescriptor { } } +func commonEndpoints() []cluster.EndpointDescriptor { + return common_endpoints.CommonEndpoints( + "system", + common_endpoints.WithSwaggerEndpoint(docs.SwaggerYaml), + ) +} + func concatCluster(clusters ...[]cluster.EndpointDescriptor) []cluster.EndpointDescriptor { var result []cluster.EndpointDescriptor for _, c := range clusters { From 86e5cf619d87ecf73f4ca64ffc2e54ef6cb93b6c Mon Sep 17 00:00:00 2001 From: gr-dv Date: Wed, 11 Feb 2026 16:34:10 +0300 Subject: [PATCH 8/8] up dep --- docs/swagger.go | 4 +- docs/swagger.json | 2296 +++++++++++++++++++++++++++++++++++++++++++++ docs/swagger.yaml | 1510 ----------------------------- go.mod | 54 +- go.sum | 112 +-- main.go | 2 +- routes/routes.go | 2 +- 7 files changed, 2383 insertions(+), 1597 deletions(-) create mode 100644 docs/swagger.json delete mode 100644 docs/swagger.yaml diff --git a/docs/swagger.go b/docs/swagger.go index eb9cf81..7579fde 100644 --- a/docs/swagger.go +++ b/docs/swagger.go @@ -4,6 +4,6 @@ import _ "embed" // Embedded swagger files. var ( - //go:embed swagger.yaml - SwaggerYaml []byte + //go:embed swagger.json + SwaggerJson []byte ) diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 0000000..1e50ecd --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,2296 @@ +{ + "swagger": "2.0", + "info": { + "description": "Сервис управления реестром внешних приложений и токенами аутентификации", + "title": "isp-system-service", + "contact": {}, + "license": { + "name": "GNU GPL v3.0" + }, + "version": "1.0.0" + }, + "host": "localhost:9000", + "basePath": "/api/system", + "paths": { + "/access_list/delete_list": { + "post": { + "description": "Удаляет заданный список методов для приложения", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "accessList" + ], + "summary": "Удалить список доступных методов для приложения", + "parameters": [ + { + "description": "тело запроса", + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/domain.AccessListDeleteListRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/access_list/delete_list_with_methods": { + "post": { + "description": "Удаляет заданный список методов для приложения", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "accessList" + ], + "summary": "Удалить список доступных методов для приложения", + "parameters": [ + { + "description": "тело запроса", + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/domain.AccessListDeleteV2ListRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/access_list/get_by_id": { + "post": { + "description": "Возвращает список методов для приложения, для которых заданы настройки доступа", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "accessList" + ], + "summary": "Получить список доступности методов для приложения", + "parameters": [ + { + "description": "идентификатор приложения", + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/domain.Identity" + } + } + ], + "responses": { + "200": { + "description": "список доступности методов", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.MethodInfo" + } + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/access_list/set_list": { + "post": { + "description": "Возвращает список методов для приложения, для которых заданы настройки доступа", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "accessList" + ], + "summary": "Настроить доступность списка методов для приложения", + "parameters": [ + { + "description": "объект настройки доступа", + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/domain.AccessListSetListRequest" + } + } + ], + "responses": { + "200": { + "description": "список доступности методов", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.MethodInfo" + } + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/access_list/set_one": { + "post": { + "description": "Возвращает количество измененных строк", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "accessList" + ], + "summary": "Настроить доступность метода для приложения", + "parameters": [ + { + "description": "объект для настройки доступа", + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/domain.AccessListSetOneRequest" + } + } + ], + "responses": { + "200": { + "description": "количество измененных строк", + "schema": { + "$ref": "#/definitions/domain.AccessListSetOneResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/create_application": { + "post": { + "description": "Если приложение с такими идентификатором или связкой `applicationGroupId`-`name` существует, то возвращает ошибку", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Создать приложение", + "parameters": [ + { + "description": "Объект приложения", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.CreateApplicationRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ApplicationWithTokens" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/create_update_application": { + "post": { + "description": "Если приложение с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Создать/обновить приложение", + "parameters": [ + { + "description": "Объект приложения", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ApplicationCreateUpdateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ApplicationWithTokens" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/delete_applications": { + "post": { + "description": "Удаляет приложения по списку их идентификаторов, возвращает количество удаленных приложений", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Удалить приложения", + "parameters": [ + { + "description": "Массив идентификаторов приложений", + "name": "body", + "in": "body", + "schema": { + "type": "array", + "items": { + "type": "integer" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.DeleteResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/get_all": { + "post": { + "description": "Возвращает список приложений", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Получить список приложений", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.Application" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/get_application_by_id": { + "post": { + "description": "Возвращает описание приложения по его идентификатору", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Получить приложение по идентификатору", + "parameters": [ + { + "description": "Идентификатор приложения", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.Identity" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ApplicationWithTokens" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/get_application_by_token": { + "post": { + "description": "Возвращает идентификатор приложения и группы по токену", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Получить идентификатор приложения и группы по токену", + "parameters": [ + { + "description": "Тело запроса", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.GetApplicationByTokenRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.GetApplicationByTokenResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/get_applications": { + "post": { + "description": "Возвращает массив приложений с токенами по их идентификаторам", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Получить список приложений", + "parameters": [ + { + "description": "Массив идентификаторов приложений", + "name": "body", + "in": "body", + "schema": { + "type": "array", + "items": { + "type": "integer" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ApplicationWithTokens" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/get_applications_by_service_id": { + "post": { + "description": "Возвращает список приложений по запрошенному идентификатору сервиса", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Получить список приложений по идентификатору сервиса", + "parameters": [ + { + "description": "Идентификатор сервиса", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.Identity" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ApplicationWithTokens" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/get_system_tree": { + "post": { + "description": "Возвращает описание взаимосвязей сервисов и приложений", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Метод получения системного дерева", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.DomainWithService" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/next_id": { + "post": { + "description": "Возвращает следующий идентификатор приложения", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Получить следующий идентификатор приложения", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "integer" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application/update_application": { + "post": { + "description": "Если приложение с связкой `applicationGroupId`-`name` существует или приложение не найдено, то возвращает ошибку", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application" + ], + "summary": "Обновить приложение", + "parameters": [ + { + "description": "Объект приложения", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.UpdateApplicationRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ApplicationWithTokens" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application_group/create": { + "post": { + "description": "Если группа приложений таким именем существует, возвращает ошибку", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application_group" + ], + "summary": "Создать группу приложений", + "parameters": [ + { + "description": "Объект группы приложений", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.CreateAppGroupRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.AppGroup" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application_group/delete_list": { + "post": { + "description": "Удаляет группы приложений по списку их идентификаторов, возвращает количество удаленных групп приложений", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application_group" + ], + "summary": "Удалить группы приложений", + "parameters": [ + { + "description": "список идентификаторов групп приложений", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.IdListRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.DeleteResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application_group/get_all": { + "post": { + "description": "Возвращает все группы приложений", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application_group" + ], + "summary": "Получить группы приложений", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.AppGroup" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application_group/get_by_id_list": { + "post": { + "description": "Возвращает группы приложений с указанными идентификаторами", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application_group" + ], + "summary": "Получить группы приложений по списку идентификаторов", + "parameters": [ + { + "description": "список идентификаторов групп приложений", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.IdListRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.AppGroup" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/application_group/update": { + "post": { + "description": "Если группа приложений таким именем существует или группы приложений с указанным id не существует, возвращает ошибку", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "application_group" + ], + "summary": "Обновить группу приложений", + "parameters": [ + { + "description": "Объект группы приложений", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.UpdateAppGroupRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.AppGroup" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/domain/create_update_domain": { + "post": { + "description": "Если домен с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "domain" + ], + "summary": "Создать/обновить домен", + "parameters": [ + { + "description": "Объект домена", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.DomainCreateUpdateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Domain" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/domain/delete_domains": { + "post": { + "description": "Удаляет домены по списку их идентификаторов, возвращает количество удаленных доменов", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "domain" + ], + "summary": "Удаление доменов", + "parameters": [ + { + "description": "Массив идентификаторов доменов", + "name": "body", + "in": "body", + "schema": { + "type": "array", + "items": { + "type": "integer" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.DeleteResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/domain/get_domain_by_id": { + "post": { + "description": "Возвращает описание домена по его идентификатору", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "domain" + ], + "summary": "Получить домен по идентификатору", + "parameters": [ + { + "description": "Идентификатор домена", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.Identity" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Domain" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/domain/get_domains_by_system_id": { + "post": { + "description": "Возвращает список доменов по системному идентификатору", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "domain" + ], + "summary": "Получить домены по идентификатору системы", + "parameters": [ + { + "description": "Идентификатор системы", + "name": "body", + "in": "body", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.Domain" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/secure/authenticate": { + "post": { + "description": "Проверяет наличие токена в системе,", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "secure" + ], + "summary": "Метод аутентификации токена", + "parameters": [ + { + "description": "Тело запроса", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.AuthenticateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.AuthenticateResponse" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/secure/authorize": { + "post": { + "description": "Проверяет доступ приложения к запрашиваемому ендпоинту", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "secure" + ], + "summary": "Метод авторизации приложения", + "parameters": [ + { + "description": "Тело запрос", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.AuthorizeRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.AuthorizeResponse" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/service/create_update_service": { + "post": { + "description": "Если сервис с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "service" + ], + "summary": "Создать/обновить сервис", + "parameters": [ + { + "description": "Объект сервиса", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ServiceCreateUpdateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Service" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "409": { + "description": "Conflict", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/service/delete_service": { + "post": { + "description": "Удаляет сервисов по списку их идентификаторов, возвращает количество удаленных сервисов", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "service" + ], + "summary": "Удалить сервисы", + "parameters": [ + { + "description": "Массив идентификаторов сервисов", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "integer" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.DeleteResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/service/get_service": { + "post": { + "description": "Возвращает список сервисов по их идентификаторам", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "service" + ], + "summary": "Получить список сервисов", + "parameters": [ + { + "description": "Массив идентификаторов сервисов", + "name": "body", + "in": "body", + "schema": { + "type": "array", + "items": { + "type": "integer" + } + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.Service" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/service/get_service_by_id": { + "post": { + "description": "Возвращает описание сервиса по его идентификатору", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "service" + ], + "summary": "Получить сервис по идентификатору", + "parameters": [ + { + "description": "Идентификатор сервиса", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.Identity" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Service" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/service/get_services_by_domain_id": { + "post": { + "description": "Возвращает список сервисов по идентификатору домена", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "service" + ], + "summary": "Получить список сервисов по идентификатору домена", + "parameters": [ + { + "description": "Идентификатор домена", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.Identity" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.Service" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/token/create_token": { + "post": { + "description": "Создает токен и привязывает его к приложению", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "token" + ], + "summary": "Создать токен", + "parameters": [ + { + "description": "Объект создания токена", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.TokenCreateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ApplicationWithTokens" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/token/get_tokens_by_app_id": { + "post": { + "description": "Возвращает список токенов, привязанных к приложению", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "token" + ], + "summary": "Получить токены по идентификатору приложения", + "parameters": [ + { + "description": "Идентификатор приложения", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.Identity" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/entity.Token" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/token/revoke_tokens": { + "post": { + "description": "Отвязывает токены от приложений и удаляет их", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "token" + ], + "summary": "Отозвать токены", + "parameters": [ + { + "description": "Объект отзыва токенов", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.TokenRevokeRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.ApplicationWithTokens" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + }, + "/token/revoke_tokens_for_app": { + "post": { + "description": "Отвязывает токены от приложений и удаляет их по идентификатору приложения", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "token" + ], + "summary": "Отозвать токены для приложения", + "parameters": [ + { + "description": "Идентификатор приложения", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.Identity" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.DeleteResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/apierrors.Error" + } + } + } + } + } + }, + "definitions": { + "apierrors.Error": { + "type": "object", + "properties": { + "details": { + "type": "object", + "additionalProperties": {} + }, + "errorCode": { + "type": "integer" + }, + "errorMessage": { + "type": "string" + } + } + }, + "domain.AccessListDeleteListRequest": { + "type": "object", + "required": [ + "appId", + "methods" + ], + "properties": { + "appId": { + "type": "integer" + }, + "methods": { + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + } + } + }, + "domain.AccessListDeleteV2ListRequest": { + "type": "object", + "required": [ + "appId", + "methods" + ], + "properties": { + "appId": { + "type": "integer" + }, + "methods": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/domain.Method" + } + } + } + }, + "domain.AccessListSetListRequest": { + "type": "object", + "required": [ + "appId" + ], + "properties": { + "appId": { + "type": "integer" + }, + "methods": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.MethodInfo" + } + }, + "removeOld": { + "type": "boolean" + } + } + }, + "domain.AccessListSetOneRequest": { + "type": "object", + "required": [ + "appId", + "method" + ], + "properties": { + "appId": { + "type": "integer" + }, + "httpMethod": { + "type": "string" + }, + "method": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + "domain.AccessListSetOneResponse": { + "type": "object", + "properties": { + "count": { + "type": "integer" + } + } + }, + "domain.AppGroup": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "domain.Application": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "serviceId": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "domain.ApplicationCreateUpdateRequest": { + "type": "object", + "required": [ + "name", + "serviceId", + "type" + ], + "properties": { + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "serviceId": { + "type": "integer" + }, + "type": { + "type": "string", + "enum": [ + "SYSTEM", + "MOBILE" + ] + } + } + }, + "domain.ApplicationSimple": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "tokens": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.Token" + } + }, + "type": { + "type": "string" + } + } + }, + "domain.ApplicationWithTokens": { + "type": "object", + "properties": { + "app": { + "$ref": "#/definitions/domain.Application" + }, + "tokens": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.Token" + } + } + } + }, + "domain.AuthData": { + "type": "object", + "properties": { + "appName": { + "type": "string" + }, + "applicationId": { + "type": "integer" + }, + "domainId": { + "type": "integer" + }, + "serviceId": { + "type": "integer" + }, + "systemId": { + "type": "integer" + } + } + }, + "domain.AuthenticateRequest": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string" + } + } + }, + "domain.AuthenticateResponse": { + "type": "object", + "properties": { + "authData": { + "$ref": "#/definitions/domain.AuthData" + }, + "authenticated": { + "type": "boolean" + }, + "errorReason": { + "type": "string" + } + } + }, + "domain.AuthorizeRequest": { + "type": "object", + "required": [ + "applicationId", + "endpoint" + ], + "properties": { + "applicationId": { + "type": "integer" + }, + "endpoint": { + "type": "string" + }, + "httpMethod": { + "type": "string" + } + } + }, + "domain.AuthorizeResponse": { + "type": "object", + "properties": { + "authorized": { + "type": "boolean" + } + } + }, + "domain.CreateAppGroupRequest": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "description": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "domain.CreateApplicationRequest": { + "type": "object", + "required": [ + "applicationGroupId", + "id", + "name", + "type" + ], + "properties": { + "applicationGroupId": { + "type": "integer" + }, + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "SYSTEM", + "MOBILE" + ] + } + } + }, + "domain.DeleteResponse": { + "type": "object", + "properties": { + "deleted": { + "type": "integer" + } + } + }, + "domain.Domain": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "systemId": { + "type": "integer" + }, + "updatedAt": { + "type": "string" + } + } + }, + "domain.DomainCreateUpdateRequest": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "domain.DomainWithService": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ServiceWithApps" + } + } + } + }, + "domain.GetApplicationByTokenRequest": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string" + } + } + }, + "domain.GetApplicationByTokenResponse": { + "type": "object", + "properties": { + "applicationGroupId": { + "type": "integer" + }, + "applicationId": { + "type": "integer" + } + } + }, + "domain.IdListRequest": { + "type": "object", + "required": [ + "idList" + ], + "properties": { + "idList": { + "type": "array", + "minItems": 1, + "items": { + "type": "integer" + } + } + } + }, + "domain.Identity": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer" + } + } + }, + "domain.Method": { + "type": "object", + "required": [ + "method" + ], + "properties": { + "httpMethod": { + "type": "string" + }, + "method": { + "type": "string" + } + } + }, + "domain.MethodInfo": { + "type": "object", + "properties": { + "httpMethod": { + "type": "string" + }, + "method": { + "type": "string" + }, + "value": { + "type": "boolean" + } + } + }, + "domain.Service": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "domainId": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "domain.ServiceCreateUpdateRequest": { + "type": "object", + "required": [ + "domainId", + "name" + ], + "properties": { + "description": { + "type": "string" + }, + "domainId": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "domain.ServiceWithApps": { + "type": "object", + "properties": { + "apps": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ApplicationSimple" + } + }, + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "domain.Token": { + "type": "object", + "properties": { + "appId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "expireTime": { + "type": "integer" + }, + "token": { + "type": "string" + } + } + }, + "domain.TokenCreateRequest": { + "type": "object", + "required": [ + "appId", + "expireTimeMs" + ], + "properties": { + "appId": { + "type": "integer" + }, + "expireTimeMs": { + "type": "integer" + } + } + }, + "domain.TokenRevokeRequest": { + "type": "object", + "required": [ + "appId" + ], + "properties": { + "appId": { + "type": "integer" + }, + "tokens": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "domain.UpdateAppGroupRequest": { + "type": "object", + "required": [ + "id", + "name" + ], + "properties": { + "description": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "domain.UpdateApplicationRequest": { + "type": "object", + "required": [ + "name", + "newId", + "oldId" + ], + "properties": { + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "newId": { + "type": "integer" + }, + "oldId": { + "type": "integer" + } + } + }, + "entity.Token": { + "type": "object", + "properties": { + "appId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "expireTime": { + "type": "integer" + }, + "token": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml deleted file mode 100644 index 15d7e3b..0000000 --- a/docs/swagger.yaml +++ /dev/null @@ -1,1510 +0,0 @@ -basePath: /api/system -definitions: - apierrors.Error: - properties: - details: - additionalProperties: {} - type: object - errorCode: - type: integer - errorMessage: - type: string - type: object - domain.AccessListDeleteListRequest: - properties: - appId: - type: integer - methods: - items: - type: string - minItems: 1 - type: array - required: - - appId - - methods - type: object - domain.AccessListDeleteV2ListRequest: - properties: - appId: - type: integer - methods: - items: - $ref: '#/definitions/domain.Method' - minItems: 1 - type: array - required: - - appId - - methods - type: object - domain.AccessListSetListRequest: - properties: - appId: - type: integer - methods: - items: - $ref: '#/definitions/domain.MethodInfo' - type: array - removeOld: - type: boolean - required: - - appId - type: object - domain.AccessListSetOneRequest: - properties: - appId: - type: integer - httpMethod: - type: string - method: - type: string - value: - type: boolean - required: - - appId - - method - type: object - domain.AccessListSetOneResponse: - properties: - count: - type: integer - type: object - domain.AppGroup: - properties: - createdAt: - type: string - description: - type: string - id: - type: integer - name: - type: string - updatedAt: - type: string - type: object - domain.Application: - properties: - createdAt: - type: string - description: - type: string - id: - type: integer - name: - type: string - serviceId: - type: integer - type: - type: string - updatedAt: - type: string - type: object - domain.ApplicationCreateUpdateRequest: - properties: - description: - type: string - id: - type: integer - name: - type: string - serviceId: - type: integer - type: - enum: - - SYSTEM - - MOBILE - type: string - required: - - name - - serviceId - - type - type: object - domain.ApplicationSimple: - properties: - description: - type: string - id: - type: integer - name: - type: string - tokens: - items: - $ref: '#/definitions/domain.Token' - type: array - type: - type: string - type: object - domain.ApplicationWithTokens: - properties: - app: - $ref: '#/definitions/domain.Application' - tokens: - items: - $ref: '#/definitions/domain.Token' - type: array - type: object - domain.AuthData: - properties: - appName: - type: string - applicationId: - type: integer - domainId: - type: integer - serviceId: - type: integer - systemId: - type: integer - type: object - domain.AuthenticateRequest: - properties: - token: - type: string - required: - - token - type: object - domain.AuthenticateResponse: - properties: - authData: - $ref: '#/definitions/domain.AuthData' - authenticated: - type: boolean - errorReason: - type: string - type: object - domain.AuthorizeRequest: - properties: - applicationId: - type: integer - endpoint: - type: string - httpMethod: - type: string - required: - - applicationId - - endpoint - type: object - domain.AuthorizeResponse: - properties: - authorized: - type: boolean - type: object - domain.CreateAppGroupRequest: - properties: - description: - type: string - name: - type: string - required: - - name - type: object - domain.CreateApplicationRequest: - properties: - applicationGroupId: - type: integer - description: - type: string - id: - type: integer - name: - type: string - type: - enum: - - SYSTEM - - MOBILE - type: string - required: - - applicationGroupId - - id - - name - - type - type: object - domain.DeleteResponse: - properties: - deleted: - type: integer - type: object - domain.Domain: - properties: - createdAt: - type: string - description: - type: string - id: - type: integer - name: - type: string - systemId: - type: integer - updatedAt: - type: string - type: object - domain.DomainCreateUpdateRequest: - properties: - description: - type: string - id: - type: integer - name: - type: string - required: - - name - type: object - domain.DomainWithService: - properties: - description: - type: string - id: - type: integer - name: - type: string - services: - items: - $ref: '#/definitions/domain.ServiceWithApps' - type: array - type: object - domain.GetApplicationByTokenRequest: - properties: - token: - type: string - required: - - token - type: object - domain.GetApplicationByTokenResponse: - properties: - applicationGroupId: - type: integer - applicationId: - type: integer - type: object - domain.IdListRequest: - properties: - idList: - items: - type: integer - minItems: 1 - type: array - required: - - idList - type: object - domain.Identity: - properties: - id: - type: integer - required: - - id - type: object - domain.Method: - properties: - httpMethod: - type: string - method: - type: string - required: - - method - type: object - domain.MethodInfo: - properties: - httpMethod: - type: string - method: - type: string - value: - type: boolean - type: object - domain.Service: - properties: - createdAt: - type: string - description: - type: string - domainId: - type: integer - id: - type: integer - name: - type: string - updatedAt: - type: string - type: object - domain.ServiceCreateUpdateRequest: - properties: - description: - type: string - domainId: - type: integer - id: - type: integer - name: - type: string - required: - - domainId - - name - type: object - domain.ServiceWithApps: - properties: - apps: - items: - $ref: '#/definitions/domain.ApplicationSimple' - type: array - description: - type: string - id: - type: integer - name: - type: string - type: object - domain.Token: - properties: - appId: - type: integer - createdAt: - type: string - expireTime: - type: integer - token: - type: string - type: object - domain.TokenCreateRequest: - properties: - appId: - type: integer - expireTimeMs: - type: integer - required: - - appId - - expireTimeMs - type: object - domain.TokenRevokeRequest: - properties: - appId: - type: integer - tokens: - items: - type: string - type: array - required: - - appId - type: object - domain.UpdateAppGroupRequest: - properties: - description: - type: string - id: - type: integer - name: - type: string - required: - - id - - name - type: object - domain.UpdateApplicationRequest: - properties: - description: - type: string - name: - type: string - newId: - type: integer - oldId: - type: integer - required: - - name - - newId - - oldId - type: object - entity.Token: - properties: - appId: - type: integer - createdAt: - type: string - expireTime: - type: integer - token: - type: string - type: object -host: localhost:9000 -info: - contact: {} - description: Сервис управления реестром внешних приложений и токенами аутентификации - license: - name: GNU GPL v3.0 - title: isp-system-service - version: 1.0.0 -paths: - /access_list/delete_list: - post: - consumes: - - application/json - description: Удаляет заданный список методов для приложения - parameters: - - description: тело запроса - in: body - name: body - schema: - $ref: '#/definitions/domain.AccessListDeleteListRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: {} - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Удалить список доступных методов для приложения - tags: - - accessList - /access_list/delete_list_with_methods: - post: - consumes: - - application/json - description: Удаляет заданный список методов для приложения - parameters: - - description: тело запроса - in: body - name: body - schema: - $ref: '#/definitions/domain.AccessListDeleteV2ListRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: {} - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Удалить список доступных методов для приложения - tags: - - accessList - /access_list/get_by_id: - post: - consumes: - - application/json - description: Возвращает список методов для приложения, для которых заданы настройки - доступа - parameters: - - description: идентификатор приложения - in: body - name: body - schema: - $ref: '#/definitions/domain.Identity' - produces: - - application/json - responses: - "200": - description: список доступности методов - schema: - items: - $ref: '#/definitions/domain.MethodInfo' - type: array - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить список доступности методов для приложения - tags: - - accessList - /access_list/set_list: - post: - consumes: - - application/json - description: Возвращает список методов для приложения, для которых заданы настройки - доступа - parameters: - - description: объект настройки доступа - in: body - name: body - schema: - $ref: '#/definitions/domain.AccessListSetListRequest' - produces: - - application/json - responses: - "200": - description: список доступности методов - schema: - items: - $ref: '#/definitions/domain.MethodInfo' - type: array - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Настроить доступность списка методов для приложения - tags: - - accessList - /access_list/set_one: - post: - consumes: - - application/json - description: Возвращает количество измененных строк - parameters: - - description: объект для настройки доступа - in: body - name: body - schema: - $ref: '#/definitions/domain.AccessListSetOneRequest' - produces: - - application/json - responses: - "200": - description: количество измененных строк - schema: - $ref: '#/definitions/domain.AccessListSetOneResponse' - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Настроить доступность метода для приложения - tags: - - accessList - /application/create_application: - post: - consumes: - - application/json - description: Если приложение с такими идентификатором или связкой `applicationGroupId`-`name` - существует, то возвращает ошибку - parameters: - - description: Объект приложения - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.CreateApplicationRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.ApplicationWithTokens' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "409": - description: Conflict - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Создать приложение - tags: - - application - /application/create_update_application: - post: - consumes: - - application/json - description: Если приложение с такими идентификатором существует, то обновляет - данные, если нет, то добавляет данные в базу - parameters: - - description: Объект приложения - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.ApplicationCreateUpdateRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.ApplicationWithTokens' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "409": - description: Conflict - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Создать/обновить приложение - tags: - - application - /application/delete_applications: - post: - consumes: - - application/json - description: Удаляет приложения по списку их идентификаторов, возвращает количество - удаленных приложений - parameters: - - description: Массив идентификаторов приложений - in: body - name: body - schema: - items: - type: integer - type: array - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.DeleteResponse' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Удалить приложения - tags: - - application - /application/get_all: - post: - consumes: - - application/json - description: Возвращает список приложений - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.Application' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить список приложений - tags: - - application - /application/get_application_by_id: - post: - consumes: - - application/json - description: Возвращает описание приложения по его идентификатору - parameters: - - description: Идентификатор приложения - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.Identity' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.ApplicationWithTokens' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить приложение по идентификатору - tags: - - application - /application/get_application_by_token: - post: - consumes: - - application/json - description: Возвращает идентификатор приложения и группы по токену - parameters: - - description: Тело запроса - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.GetApplicationByTokenRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.GetApplicationByTokenResponse' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить идентификатор приложения и группы по токену - tags: - - application - /application/get_applications: - post: - consumes: - - application/json - description: Возвращает массив приложений с токенами по их идентификаторам - parameters: - - description: Массив идентификаторов приложений - in: body - name: body - schema: - items: - type: integer - type: array - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.ApplicationWithTokens' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить список приложений - tags: - - application - /application/get_applications_by_service_id: - post: - consumes: - - application/json - description: Возвращает список приложений по запрошенному идентификатору сервиса - parameters: - - description: Идентификатор сервиса - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.Identity' - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.ApplicationWithTokens' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить список приложений по идентификатору сервиса - tags: - - application - /application/get_system_tree: - post: - consumes: - - application/json - description: Возвращает описание взаимосвязей сервисов и приложений - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.DomainWithService' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Метод получения системного дерева - tags: - - application - /application/next_id: - post: - consumes: - - application/json - description: Возвращает следующий идентификатор приложения - produces: - - application/json - responses: - "200": - description: OK - schema: - type: integer - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить следующий идентификатор приложения - tags: - - application - /application/update_application: - post: - consumes: - - application/json - description: Если приложение с связкой `applicationGroupId`-`name` существует - или приложение не найдено, то возвращает ошибку - parameters: - - description: Объект приложения - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.UpdateApplicationRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.ApplicationWithTokens' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "409": - description: Conflict - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Обновить приложение - tags: - - application - /application_group/create: - post: - consumes: - - application/json - description: Если группа приложений таким именем существует, возвращает ошибку - parameters: - - description: Объект группы приложений - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.CreateAppGroupRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.AppGroup' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "409": - description: Conflict - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Создать группу приложений - tags: - - application_group - /application_group/delete_list: - post: - consumes: - - application/json - description: Удаляет группы приложений по списку их идентификаторов, возвращает - количество удаленных групп приложений - parameters: - - description: список идентификаторов групп приложений - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.IdListRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.DeleteResponse' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Удалить группы приложений - tags: - - application_group - /application_group/get_all: - post: - consumes: - - application/json - description: Возвращает все группы приложений - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.AppGroup' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить группы приложений - tags: - - application_group - /application_group/get_by_id_list: - post: - consumes: - - application/json - description: Возвращает группы приложений с указанными идентификаторами - parameters: - - description: список идентификаторов групп приложений - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.IdListRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.AppGroup' - type: array - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить группы приложений по списку идентификаторов - tags: - - application_group - /application_group/update: - post: - consumes: - - application/json - description: Если группа приложений таким именем существует или группы приложений - с указанным id не существует, возвращает ошибку - parameters: - - description: Объект группы приложений - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.UpdateAppGroupRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.AppGroup' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "409": - description: Conflict - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Обновить группу приложений - tags: - - application_group - /domain/create_update_domain: - post: - consumes: - - application/json - description: Если домен с такими идентификатором существует, то обновляет данные, - если нет, то добавляет данные в базу - parameters: - - description: Объект домена - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.DomainCreateUpdateRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.Domain' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Создать/обновить домен - tags: - - domain - /domain/delete_domains: - post: - consumes: - - application/json - description: Удаляет домены по списку их идентификаторов, возвращает количество - удаленных доменов - parameters: - - description: Массив идентификаторов доменов - in: body - name: body - schema: - items: - type: integer - type: array - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.DeleteResponse' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Удаление доменов - tags: - - domain - /domain/get_domain_by_id: - post: - consumes: - - application/json - description: Возвращает описание домена по его идентификатору - parameters: - - description: Идентификатор домена - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.Identity' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.Domain' - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить домен по идентификатору - tags: - - domain - /domain/get_domains_by_system_id: - post: - consumes: - - application/json - description: Возвращает список доменов по системному идентификатору - parameters: - - description: Идентификатор системы - in: body - name: body - schema: - type: integer - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.Domain' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить домены по идентификатору системы - tags: - - domain - /secure/authenticate: - post: - consumes: - - application/json - description: Проверяет наличие токена в системе, - parameters: - - description: Тело запроса - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.AuthenticateRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.AuthenticateResponse' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Метод аутентификации токена - tags: - - secure - /secure/authorize: - post: - consumes: - - application/json - description: Проверяет доступ приложения к запрашиваемому ендпоинту - parameters: - - description: Тело запрос - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.AuthorizeRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.AuthorizeResponse' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Метод авторизации приложения - tags: - - secure - /service/create_update_service: - post: - consumes: - - application/json - description: Если сервис с такими идентификатором существует, то обновляет данные, - если нет, то добавляет данные в базу - parameters: - - description: Объект сервиса - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.ServiceCreateUpdateRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.Service' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "409": - description: Conflict - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Создать/обновить сервис - tags: - - service - /service/delete_service: - post: - consumes: - - application/json - description: Удаляет сервисов по списку их идентификаторов, возвращает количество - удаленных сервисов - parameters: - - description: Массив идентификаторов сервисов - in: body - name: body - required: true - schema: - items: - type: integer - type: array - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.DeleteResponse' - "400": - description: Bad Request - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Удалить сервисы - tags: - - service - /service/get_service: - post: - consumes: - - application/json - description: Возвращает список сервисов по их идентификаторам - parameters: - - description: Массив идентификаторов сервисов - in: body - name: body - schema: - items: - type: integer - type: array - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.Service' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить список сервисов - tags: - - service - /service/get_service_by_id: - post: - consumes: - - application/json - description: Возвращает описание сервиса по его идентификатору - parameters: - - description: Идентификатор сервиса - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.Identity' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.Service' - "404": - description: Not Found - schema: - $ref: '#/definitions/apierrors.Error' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить сервис по идентификатору - tags: - - service - /service/get_services_by_domain_id: - post: - consumes: - - application/json - description: Возвращает список сервисов по идентификатору домена - parameters: - - description: Идентификатор домена - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.Identity' - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/domain.Service' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить список сервисов по идентификатору домена - tags: - - service - /token/create_token: - post: - consumes: - - application/json - description: Создает токен и привязывает его к приложению - parameters: - - description: Объект создания токена - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.TokenCreateRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.ApplicationWithTokens' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Создать токен - tags: - - token - /token/get_tokens_by_app_id: - post: - consumes: - - application/json - description: Возвращает список токенов, привязанных к приложению - parameters: - - description: Идентификатор приложения - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.Identity' - produces: - - application/json - responses: - "200": - description: OK - schema: - items: - $ref: '#/definitions/entity.Token' - type: array - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Получить токены по идентификатору приложения - tags: - - token - /token/revoke_tokens: - post: - consumes: - - application/json - description: Отвязывает токены от приложений и удаляет их - parameters: - - description: Объект отзыва токенов - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.TokenRevokeRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.ApplicationWithTokens' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Отозвать токены - tags: - - token - /token/revoke_tokens_for_app: - post: - consumes: - - application/json - description: Отвязывает токены от приложений и удаляет их по идентификатору - приложения - parameters: - - description: Идентификатор приложения - in: body - name: body - required: true - schema: - $ref: '#/definitions/domain.Identity' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/domain.DeleteResponse' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/apierrors.Error' - summary: Отозвать токены для приложения - tags: - - token -swagger: "2.0" diff --git a/go.mod b/go.mod index d337e7e..12318d8 100644 --- a/go.mod +++ b/go.mod @@ -4,12 +4,12 @@ go 1.25 require ( github.com/Masterminds/squirrel v1.5.4 - github.com/jackc/pgx/v5 v5.7.6 + github.com/jackc/pgx/v5 v5.8.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.11.1 - github.com/txix-open/isp-kit v1.64.8 + github.com/txix-open/isp-kit v1.64.10 github.com/txix-open/jsonschema v1.3.0 - google.golang.org/grpc v1.75.1 + google.golang.org/grpc v1.78.0 ) require ( @@ -20,15 +20,15 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // 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.10 // indirect - github.com/getsentry/sentry-go v0.35.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.27.2 // 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 @@ -38,18 +38,18 @@ require ( 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.25.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.66.1 // indirect - github.com/prometheus/procfs v0.17.0 // 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 @@ -58,25 +58,25 @@ require ( 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.2.0 // indirect - go.opentelemetry.io/otel v1.38.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect - go.opentelemetry.io/otel/metric v1.38.0 // indirect - go.opentelemetry.io/otel/sdk v1.38.0 // indirect - go.opentelemetry.io/otel/trace v1.38.0 // indirect - go.opentelemetry.io/proto/otlp v1.8.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 + go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect - golang.org/x/crypto v0.45.0 // indirect - golang.org/x/net v0.47.0 // indirect - golang.org/x/sync v0.18.0 // indirect - golang.org/x/sys v0.38.0 // indirect - golang.org/x/text v0.31.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 // indirect - google.golang.org/protobuf v1.36.9 // 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 ) diff --git a/go.sum b/go.sum index 12beb13..e440c17 100644 --- a/go.sum +++ b/go.sum @@ -21,10 +21,10 @@ 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.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0= -github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= -github.com/getsentry/sentry-go v0.35.2 h1:jKuujpRwa8FFRYMIwwZpu83Xh0voll9bmvyc6310WBM= -github.com/getsentry/sentry-go v0.35.2/go.mod h1:mdL49ixwT2yi57k5eh7mpnDyPybixPzlzEJFu0Z76QA= +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.1 h1:xUyVpAjEtB04l6XFY0V/29oR332rOSPWV4lU8RwDt4k= @@ -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.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= +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.6 h1:rWQc5FwZSPX58r1OQmkuaNicxdmExaEz5A2DO2hUuTk= -github.com/jackc/pgx/v5 v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M= +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= @@ -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,16 +109,16 @@ 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.25.0 h1:6WeYhMWGRCzpyd89SpODFnCBCKz41KrVbRT58nVjGng= -github.com/pressly/goose/v3 v3.25.0/go.mod h1:4hC1KrritdCxtuFsqgs1R4AU5bWtTAf+cnWvfhf2DNY= +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.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= -github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= +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= @@ -146,8 +146,8 @@ github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIg github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8= 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.8 h1:nck8Gw5a7Jh6AVLqR2FihurrP5bTfeLUrodYB4j4+p4= -github.com/txix-open/isp-kit v1.64.8/go.mod h1:GvBsX5p2U3/ugK6PuWANYzSy/4YgawROm3eAKb35G6o= +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= @@ -161,56 +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.2.0 h1:YpRtUFjvhSymycLS2T81lT6IGhcUP+LUPtv0iv1N8bM= -go.opentelemetry.io/auto/sdk v1.2.0/go.mod h1:1deq2zL7rwjwC8mR7XgY2N+tlIl6pjmEUoLDENMEzwk= +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.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= -go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4= -go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= -go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= -go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= -go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= -go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= -go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= -go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= -go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= -go.opentelemetry.io/proto/otlp v1.8.0 h1:fRAZQDcAFHySxpJ1TwlA1cJ4tvcrw7nXl9xWWC8N5CE= -go.opentelemetry.io/proto/otlp v1.8.0/go.mod h1:tIeYOeNBU4cvmPqpaji1P+KbB4Oloai8wN4rWzRrFF0= +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= +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.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= -golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= +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.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= -golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= -golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= -golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= -golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= +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-20250908214217-97024824d090 h1:d8Nakh1G+ur7+P3GcMjpRDEkoLUcLW2iU92XVqR+XMQ= -google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090/go.mod h1:U8EXRNSd8sUYyDfs/It7KVWodQr+Hf9xtxyxWudSwEw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 h1:/OQuEa4YWtDt7uQWHd3q3sUMb+QOLQUg1xa8CEsRv5w= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og= -google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= -google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= -google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= -google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +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= diff --git a/main.go b/main.go index f7696b5..358d4e1 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ var ( // @BasePath /api/system //go:generate swag init --parseDependency -//go:generate rm -f docs/swagger.json docs/docs.go +//go:generate rm -f docs/swagger.yaml docs/docs.go func main() { boot := bootstrap.New(version, conf.Remote{}, routes.EndpointDescriptors(), cluster.GrpcTransport) app := boot.App diff --git a/routes/routes.go b/routes/routes.go index 1a38d64..6ab4ba5 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -259,7 +259,7 @@ func applicationGroupCluster(c Controllers) []cluster.EndpointDescriptor { func commonEndpoints() []cluster.EndpointDescriptor { return common_endpoints.CommonEndpoints( "system", - common_endpoints.WithSwaggerEndpoint(docs.SwaggerYaml), + common_endpoints.WithSwaggerEndpoint(docs.SwaggerJson), ) }