223 Commits
Author SHA1 Message Date
Синельник Тимур Романович 482ec50c7d Merge branch 'MSP-8394' into 'main'
Resolve MSP-8394

Closes MSP-8394

See merge request isp/isp-system-service!19
2026-09-25 14:11:46 +03:00
Синельник Тимур Романович 5f71e19b15 MSP-8394 Bump version to 6.0.0 2026-09-23 20:47:07 +03:00
Синельник Тимур Романович 4e255e6ad1 MSP-8394 Fix flaky test 2026-09-23 20:47:07 +03:00
Синельник Тимур Романович 8f6af4b871 MSP-8394 Remove dead code 2026-09-23 20:47:07 +03:00
Синельник Тимур Романович 484b669438 MSP-8394 Add rollback migration 2026-09-23 20:47:07 +03:00
Синельник Тимур Романович f70a210b35 MSP-8394 Simplify AuthDataByToken sql query 2026-09-23 20:47:07 +03:00
Синельник Тимур Романович 64d2c71ca2 MSP-8394 Up deps 2026-08-27 14:26:28 +03:00
Синельник Тимур Романович f61918d23c MSP-8394 Remove unused err codes 2026-08-27 14:24:40 +03:00
Синельник Тимур Романович 7b6b50a573 MSP-8394 Drop deprecated tables and methods & up api contracts 2026-08-25 15:51:29 +03:00
Синельник Тимур Романович db95ef894b MSP-8394 Add required admin permission 2026-08-24 10:24:38 +03:00
komissarovyv ce4e04c801 Merge branch '__deps' into 'main'
Update dependencies

See merge request isp/isp-system-service!18
2026-07-27 16:26:54 +03:00
komissarovyv c1c2d4def2 Update dependencies 2026-07-27 16:26:54 +03:00
komissarovyv 172c90b0e5 Merge branch 'MSP-8007' into 'main'
Resolve MSP-8007

Closes MSP-8007

See merge request isp/isp-system-service!17
2026-07-07 10:20:38 +03:00
kochanovrv 11ea63e495 MSP-8007 update version to v5.7.2 2026-07-06 16:36:30 +03:00
kochanovrv 881543c888 MSP-8007 update isp-kit 2026-07-06 16:24:21 +03:00
Синельник Тимур Романович 43703e570d Merge branch 'MSP-7322' into 'main'
Resolve MSP-7322

Closes MSP-7322

See merge request isp/isp-system-service!16
2026-03-04 17:48:55 +03:00
Синельник Тимур Романович 2bde1ebf3d MSP-7322 Bump version to 5.7.1 2026-03-04 17:18:41 +03:00
Синельник Тимур Романович 263a6f3952 MSP-7322 Return httpMethod on get_by_id and set_list 2026-03-04 17:17:38 +03:00
Грязнов Денис Владимирович c304645d60 Merge branch 'dev' into 'main'
Dev

Closes MSP-7042

See merge request isp/isp-system-service!13
2026-02-11 13:46:19 +00:00
gr-dv 86e5cf619d up dep 2026-02-11 16:38:43 +03:00
Синельник Тимур Романович 57b0f7ed99 add swagger endpoint 2026-01-27 16:13:35 +03:00
Синельник Тимур Романович 83e7fe9152 fix test 2026-01-27 15:16:59 +03:00
Синельник Тимур Романович fe014c274c up deps 2026-01-27 15:13:13 +03:00
Синельник Тимур Романович 32e44c6c9b Merge branch 'MSP-7042_v2' into 'dev'
Resolve MSP-7042 "V2"

See merge request isp/isp-system-service!15
2026-01-27 13:22:38 +03:00
Синельник Тимур Романович 9d8982b03f MSP-7042 Bump version to 5.7.0 2026-01-21 11:20:49 +03:00
Синельник Тимур Романович e865549fdc MSP-7042 Add http_method to access_list 2026-01-21 11:20:19 +03:00
Синельник Тимур Романович 4932568c64 MSP-7042 Add sql metrics 2026-01-21 10:52:14 +03:00
Синельник Тимур Романович 0688ca082a MSP-7042 Up deps 2026-01-19 14:50:17 +03:00
Синельник Тимур Романович 924c6ad2c9 Merge branch 'dev' into 'main'
Dev

Closes MSP-6673

See merge request isp/isp-system-service!11
2025-11-26 10:02:24 +03:00
Синельник Тимур Романович 5ceecdfd40 Merge branch 'MSP-6673' into 'dev'
Resolve MSP-6673

See merge request isp/isp-system-service!12
2025-11-11 14:11:15 +03:00
Синельник Тимур Романович 3de58a0c1a MSP-6673 Bump version to 5.6.0 2025-11-06 14:50:04 +03:00
Синельник Тимур Романович cb387196d8 MSP-6673 Add app name to response system/secure/authenticate 2025-11-06 14:50:04 +03:00
Синельник Тимур Романович 8da4fcb819 MSP-6673 Fix tests 2025-11-06 14:50:03 +03:00
Синельник Тимур Романович 04b5eef606 MSP-6673 Up lint 2025-11-06 14:27:04 +03:00
Синельник Тимур Романович 12e8436da6 MSP-6673 Up deps 2025-11-06 14:21:53 +03:00
Кузьмин Игорь Александрович 7652dd1205 Delete Dockerfile.dit 2025-09-17 14:48:29 +00:00
Кузьмин Игорь Александрович e3d3ce5d57 Delete Dockerfile 2025-09-17 14:48:05 +00:00
Грязнов Денис Владимирович 135c25ca95 Merge branch 'MSP-6078' into 'main'
Resolve MSP-6078

Closes MSP-6078

See merge request isp/isp-system-service!10
2025-08-21 12:02:24 +00:00
Кузнецов Иван Александрович 4e668d3774 MSP-6078 bump version to 5.5.0 2025-08-21 14:43:03 +03:00
Кузнецов Иван Александрович 8930966075 MSP-6078 update deps 2025-08-21 14:42:03 +03:00
Рябов Кирилл Александрович f7d84c21ab Merge branch 'MSP-5494' into 'master'
MSP-5494

See merge request isp/isp-system-service!9
2025-05-27 19:01:47 +07:00
Kirill Ryabov b18d87115c MSP-5494 add Dockerfile 2025-05-27 14:09:58 +03:00
Kirill Ryabov c371b68ba7 MSP-5494 add github actions ci to build & publish docker image 2025-05-27 14:09:52 +03:00
Синельник Тимур Романович d02a58345e Fix application tests 2025-05-26 17:33:02 +03:00
Синельник Тимур Романович 4b0510d276 Merge branch 'MSP-5262' into 'master'
Resolve MSP-5262

Closes MSP-5262

See merge request isp/isp-system-service!8
2025-05-26 16:58:09 +03:00
Синельник Тимур Романович 77d8a87162 MSP-5262 Bump version to 5.4.0 2025-05-26 14:13:32 +03:00
Синельник Тимур Романович cfc7667e69 MSP-5262 Refactor secure_test 2025-05-26 14:13:32 +03:00
Синельник Тимур Романович b5a7ce5404 MSP-5262 Implement /access_list/delete_list 2025-05-26 14:13:31 +03:00
Kirill Ryabov d6f3462e87 MSP-5494 bump version to 5.3.1 2025-05-26 13:15:49 +03:00
Kirill Ryabov 2fd9ab9bac MSP-5494 update dependencies 2025-05-26 13:15:49 +03:00
Kirill Ryabov 6028b5d8ab MSP-5494 add Dockerfile 2025-05-26 13:14:36 +03:00
Kirill Ryabov ab7de42750 MSP-5494 add github actions ci to build & publish docker image 2025-05-26 13:14:28 +03:00
komissarovyv 138dde5948 Merge branch 'MSP-5372' into 'master'
Resolve MSP-5372

Closes MSP-5372

See merge request isp/isp-system-service!7
2025-05-14 11:51:13 +03:00
Синельник Тимур Романович 51db7cc86b MSP-5372 Bump version to 5.3.0 2025-05-14 11:43:01 +03:00
Синельник Тимур Романович 77b66ba0b6 MSP-5372 Up body param description 2025-05-14 11:43:01 +03:00
Синельник Тимур Романович 1d424993e1 MSP-5372 Update endpoint description 2025-05-14 11:40:46 +03:00
Синельник Тимур Романович 41dd618412 MSP-5372 Implement /application/get_application_by_token 2025-05-13 13:46:28 +03:00
Синельник Тимур Романович 42873c2f75 MSP-5372 Up lint 2025-05-13 13:28:11 +03:00
Синельник Тимур Романович 9bba9927cf MSP-5372 Up deps 2025-05-13 13:28:11 +03:00
Грязнов Денис Владимирович 08627f9069 Merge branch 'MSP-5320' into 'master'
Update dependencies

See merge request isp/isp-system-service!6
2025-04-23 09:35:40 +00:00
Парусов Павел Андреевич f230f1d640 MSP-5320 update dependencies 2025-04-22 17:31:48 +03:00
Кузьмин Игорь Александрович 11648341f1 Replace .gitlab-ci.yml 2025-04-18 12:27:18 +00:00
Кузьмин Игорь Александрович 415e298611 Replace .gitlab-ci.yml 2025-04-18 09:16:54 +00:00
komissarovyv 5a98972805 Merge branch 'MSP-5186' into 'master'
Resolve MSP-5186

Closes MSP-5186

See merge request isp/isp-system-service!5
2025-04-16 14:18:30 +00:00
Синельник Тимур Романович aaecace6df MSP-5186 Bump version to 5.2.0 2025-04-03 14:02:00 +03:00
Синельник Тимур Романович 4e85278a63 MSP-5186 Add /application_group/get_all endpoint 2025-04-03 14:01:28 +03:00
Синельник Тимур Романович 199d576956 MSP-5186 Use apierrrors.Error 2025-04-03 14:01:25 +03:00
Синельник Тимур Романович 3b43e7875d MSP-5186 Add update app id for update application endpoint 2025-04-03 13:49:48 +03:00
Синельник Тимур Романович 1d4c81c425 MSP-5186 Make application id required 2025-04-03 13:44:31 +03:00
Синельник Тимур Романович 9a1e8a7cd4 MSP-5186 Use sql.NullString for description 2025-04-03 13:44:31 +03:00
Синельник Тимур Романович a047fb23dd MSP-5186 Simplify CreateUpdate 2025-04-02 12:55:09 +03:00
Синельник Тимур Романович cb50a60156 MSP-5186 Implement AppGroup CRUD endpoints 2025-04-02 12:38:23 +03:00
Синельник Тимур Романович 59f3dc0d2f MSP-5186 Simplify constraint error checks 2025-04-02 11:55:47 +03:00
Синельник Тимур Романович 1e281280e6 MSP-5186 Fix typo 2025-04-02 11:54:34 +03:00
Синельник Тимур Романович 3a94df1eb0 MSP-5186 Swag fmt 2025-04-02 11:49:14 +03:00
Синельник Тимур Романович d469809107 MSP-5186 Move repository consts 2025-04-02 11:48:06 +03:00
Синельник Тимур Романович 1ec17938e0 MSP-5186 Update concatCluster param type 2025-04-02 10:50:32 +03:00
Синельник Тимур Романович 3b28cf7d08 MSP-5186 Simplify CreateUpdate 2025-04-02 10:45:02 +03:00
Синельник Тимур Романович aae74ef611 MSP-5186 Add /application/update_application endpoint 2025-04-02 10:41:37 +03:00
Синельник Тимур Романович e2ed71196b MSP-5186 Add /application/create_application endpoint 2025-04-02 10:41:18 +03:00
Синельник Тимур Романович fa2f88c869 MSP-5186 Add /application/get_all endpoint 2025-04-02 10:15:12 +03:00
Синельник Тимур Романович f8fa58a09c MSP-5186 Move service repo and entity to app_group 2025-04-02 09:54:25 +03:00
Синельник Тимур Романович 89f4eea280 MSP-5186 Implement application next id endpoint 2025-04-02 09:54:25 +03:00
Синельник Тимур Романович 141650417a MSP-5186 Check app duplicate name before check req.Id 2025-04-02 09:54:25 +03:00
Синельник Тимур Романович 1818bf8b45 MSP-5186 Update repository errors 2025-04-02 09:54:25 +03:00
Синельник Тимур Романович 42b0dbd0dc MSP-5186 Rename Service to AppGroup (without update controller and service names and endpoints) 2025-04-01 20:26:06 +03:00
Синельник Тимур Романович d012a022d8 MSP-5186 Add change app id type migration 2025-04-01 18:20:57 +03:00
Синельник Тимур Романович 6a66ffa70e MSP-5186 Up deps 2025-04-01 17:23:41 +03:00
Синельник Тимур Романович 6a93a316fa MSP-5186 Fix typo 2025-04-01 17:20:43 +03:00
Синельник Тимур Романович 94b435262c MSP-5186 appEnrich -> appEnricher 2025-04-01 17:20:17 +03:00
Синельник Тимур Романович 264ea2d3ae MSP-5186 Replace errors.WithMessagef 2025-04-01 17:18:02 +03:00
Синельник Тимур Романович 84ebd8b5a9 MSP-5186 Interfaces working 2025-04-01 17:18:02 +03:00
Синельник Тимур Романович f095d338cf MSP-5186 Remove redundant I prefix from interfaces 2025-04-01 16:53:24 +03:00
Синельник Тимур Романович 28cff347ab MSP-5186 Update lint 2025-04-01 15:54:50 +03:00
Грязнов Денис Владимирович ffa5e100db Merge branch 'MSP-5004' into 'master'
Update dependencies

See merge request isp/isp-system-service!4
2025-03-03 08:13:10 +00:00
Кузнецов Иван Александрович 8cc9eadeb2 MSP-5004 update dependencies 2025-02-27 19:42:49 +03:00
Кузьмин Игорь Александрович 9e2bf02f3d Replace .gitlab-ci.yml 2024-12-27 14:58:54 +00:00
Кузьмин Игорь Александрович 4a4feeac3d Replace Dockerfile.dit 2024-12-27 14:58:13 +00:00
komissarovyv 8e2cec1f11 Move all services to 1 domain (for isp-admin-ui) 2024-11-15 12:31:07 +03:00
komissarovyv 6337dbee16 Move all services to 1 domain (for isp-admin-ui) 2024-11-15 12:28:11 +03:00
komissarovyv 33b4e2d965 Reimplement baseline 2024-09-08 15:25:01 +03:00
Кузьмин Игорь Александрович f062aada42 Update README.md 2024-03-26 11:25:59 +00:00
Кузьмин Игорь Александрович 81c5af7538 Add README.md 2024-03-26 09:18:49 +00:00
Кузьмин Игорь c0b47ef9c6 Upload New File 2023-05-10 08:47:42 +00:00
Кузьмин Игорь bbec75c8a1 Upload New File 2023-05-10 08:38:55 +00:00
komissarovyv 7ca053a733 Merge branch 'MSP-634' into 'master'
Resolve MSP-634

Closes MSP-634

See merge request integration-system/isp-system-service!8
2022-08-05 09:27:33 +00:00
DeniskaRediska 24b80af7da MSP-634 up version 2022-08-04 22:13:47 +03:00
d1slike 42a2ceb9c9 MSP-634 remove defaultExpireTime 2022-08-04 22:13:28 +03:00
d1slike 231792aefa MSP-634 replace jwt to simple crypto rand 2022-08-04 22:13:28 +03:00
d1slike 2ea518d902 MSP-634 allow for appId 1 login endpoint 2022-08-04 22:13:28 +03:00
d1slike 13e8ff0ed8 MSP-634 Actualize local config 2022-08-04 22:13:28 +03:00
DeniskaRediska 66d8645f4a MSP-634 add secure controller tests 2022-08-04 22:13:28 +03:00
DeniskaRediska 53cab90a5b MSP-634 add general insert db for tests 2022-08-04 22:13:28 +03:00
DeniskaRediska dd41024768 MSP-634 add secure endpoints to routes 2022-08-04 22:13:28 +03:00
DeniskaRediska fff9ddcbf8 MSP-634 implement secure service 2022-08-04 22:13:28 +03:00
DeniskaRediska f65dd9c2aa MSP-634 update swagger 2022-08-04 22:13:28 +03:00
DeniskaRediska 0d61264e73 MSP-634 implement secure controller 2022-08-04 22:13:28 +03:00
DeniskaRediska cbc9d0643a MSP-634 implement secure domain 2022-08-04 22:13:28 +03:00
DeniskaRediska e5d73d91de MSP-634 add func get_auth_data to token repository 2022-08-04 22:13:28 +03:00
DeniskaRediska bb0d2b460a MSP-634 add func get_access_list_by_app_id to access_list repository 2022-08-04 22:13:28 +03:00
DeniskaRediska ab89a27053 MSP-634 add new domain error 2022-08-04 22:13:28 +03:00
DeniskaRediska 132830bf6f MSP-634 update dependencies 2022-08-04 22:13:28 +03:00
DeniskaRediska c3e71c0c7e MSP-634 fix migration 2022-08-01 17:59:25 +03:00
DeniskaRediska b0d60603bb MSP-634 remove instanceUuid from local config 2022-08-01 14:07:31 +03:00
DeniskaRediska 894781c727 MSP-634 remove redis 2022-08-01 14:07:31 +03:00
Грязнов Денис Владимирович 82a2d8d98f Merge branch 'MSP-841' into 'master'
Resolve MSP-841

Closes MSP-841

See merge request integration-system/isp-system-service!7
2022-07-25 08:58:04 +00:00
DeniskaRediska ab07db354b MSP-841 up version 2022-07-22 14:22:03 +03:00
DeniskaRediska e1f081bf63 MSP-841 fix panic when update application 2022-07-22 14:21:46 +03:00
DeniskaRediska bcd4083dd9 MSP-841 update dependencies 2022-07-22 14:20:46 +03:00
Комиссаров Ян Вадимович 74aba7fcfe Update default_remote_config.json 2022-07-07 12:32:32 +00:00
Комиссаров Ян Вадимович 29348a3c39 Update config.yml 2022-07-07 12:26:02 +00:00
Комиссаров Ян Вадимович ea83597b19 Update default_remote_config.json 2022-07-07 12:20:27 +00:00
Комиссаров Ян Вадимович 4c88184112 Fix schema name 2022-07-07 12:17:27 +00:00
d1slike 8efe886a84 Mark InstanceUuid as required 2022-06-21 13:22:34 +03:00
Грязнов Денис Владимирович 636a901c66 Merge branch 'MSP-623' into 'master'
Resolve MSP-623

Closes MSP-623

See merge request integration-system/isp-system-service!6
2022-06-07 09:49:58 +00:00
DeniskaRediska b139590408 MSP-623 up version 2022-06-07 10:33:07 +03:00
DeniskaRediska ceeb2f03be MSP-623 update swagger 2022-06-07 10:33:07 +03:00
DeniskaRediska 1a90f50218 MSP-623 remove log code 2022-06-07 10:33:07 +03:00
DeniskaRediska ce75f8933c MSP-623 update main 2022-06-07 10:33:07 +03:00
DeniskaRediska f40b91a431 MSP-623 update linter 2022-06-07 10:33:07 +03:00
DeniskaRediska 9c1fc87430 MSP-623 update gitignore 2022-06-07 10:33:07 +03:00
DeniskaRediska 9b8432bb4c MSP-623 update go mod 2022-06-07 10:33:07 +03:00
DeniskaRediska 8deb2a2e38 MSP-623 add assembly 2022-06-06 15:44:28 +03:00
DeniskaRediska 2863f95a97 MSP-623 update config 2022-06-06 15:44:28 +03:00
DeniskaRediska a7feb4e234 MSP-623 refactoring initialize migration 2022-06-06 15:44:28 +03:00
DeniskaRediska 7b5ca9d12c MSP-623 reimplement routes 2022-06-06 15:44:28 +03:00
DeniskaRediska 9db858b0e2 MSP-623 reimplement domain controller 2022-06-06 15:44:28 +03:00
DeniskaRediska b429c0b6fc MSP-623 reimplement access_list controller 2022-06-06 15:44:28 +03:00
DeniskaRediska 82fd46b056 MSP-623 reimplement application controller 2022-06-06 15:44:28 +03:00
DeniskaRediska da4156afde MSP-623 reimplement service controller 2022-06-06 15:44:28 +03:00
DeniskaRediska ed5cb04ed3 MSP-623 reimplement token controller 2022-06-06 15:44:28 +03:00
DeniskaRediska e0fc90e4d4 MSP-623 remove system controller 2022-06-06 15:44:28 +03:00
DeniskaRediska 97fcc21fc6 MSP-623 reimplement redis cli 2022-06-06 15:44:28 +03:00
DeniskaRediska 3d9c516cfb MSP-623 implement transaction manager 2022-06-06 15:44:28 +03:00
DeniskaRediska 1ba15f4532 MSP-623 implement access_list service 2022-06-06 15:44:28 +03:00
DeniskaRediska 27d727823f MSP-623 implement application service 2022-06-06 15:44:28 +03:00
DeniskaRediska 6a120d6caa MSP-623 implement domain service 2022-06-06 15:44:28 +03:00
DeniskaRediska 0e22b988b2 MSP-623 implement token service 2022-06-06 15:44:28 +03:00
DeniskaRediska c0994fa5f1 MSP-623 implement service service 2022-06-06 15:44:28 +03:00
DeniskaRediska 1512fe33ce MSP-623 update jwt service 2022-06-06 15:44:27 +03:00
DeniskaRediska 0934f8136f MSP-623 split entity 2022-06-06 15:44:27 +03:00
DeniskaRediska 4b5412e21b MSP-623 add migration to set value access_list to not null 2022-06-06 15:44:27 +03:00
DeniskaRediska bb36c55746 MSP-623 remove global db client 2022-06-06 15:44:27 +03:00
DeniskaRediska 203c802071 MSP-623 reimplement domain repository 2022-06-06 15:44:27 +03:00
DeniskaRediska cc94ca71a4 MSP-623 reimplement access_list repository 2022-06-06 15:44:27 +03:00
DeniskaRediska a7c58f86ec MSP-623 reimplement application repository 2022-06-06 15:44:27 +03:00
DeniskaRediska 0f4c57cb67 MSP-623 reimplement token repository 2022-06-06 15:44:27 +03:00
DeniskaRediska bd7a06f8f0 MSP-623 reimplement service repository 2022-06-06 15:44:27 +03:00
DeniskaRediska 8c4393b861 MSP-623 remove system repository 2022-06-06 15:44:27 +03:00
DeniskaRediska 228b04e01d MSP-623 add domain structs 2022-06-06 15:44:27 +03:00
Мержанов Максим Владимирович bbfb435c46 Merge branch 'local_config_migrate' into 'master'
migrate local config to config.CommonLocalConfig, update dependencies

See merge request integration-system/isp-system-service!5
2021-08-09 13:43:20 +00:00
Maxim Merzhanov 379102a1ac migrate local config to config.CommonLocalConfig, update dependencies 2021-08-09 15:43:23 +03:00
Мержанов Максим Владимирович d9f8ae19f8 Merge branch 'fix_migrations' into 'master'
fix migrations

See merge request integration-system/isp-system-service!4
2021-05-18 14:18:35 +00:00
Maxim Merzhanov 2d9efe3454 fix migrations 2021-05-18 14:47:10 +03:00
Мержанов Максим Владимирович 220706c876 Merge branch '__deps' into 'master'
Update dependencies

See merge request integration-system/isp-system-service!3
2021-05-17 15:40:06 +00:00
Egor Kiryushchenko c88a15c392 Update dependencies 2021-05-17 16:12:00 +03:00
Мержанов Максим Владимирович 9f8efb6712 Merge branch '__deps' into 'master'
Update dependencies

See merge request integration-system/isp-system-service!2
2021-01-26 18:45:01 +03:00
Egor Kiryushchenko 3bd6fe820d Update dependencies 2021-01-26 14:05:10 +03:00
Мержанов Максим Владимирович 540e18743a Merge branch '__deps' into 'master'
Update dependencies

See merge request integration-system/isp-system-service!1
2021-01-25 14:22:38 +03:00
Egor Kiryushchenko 8440633967 Update dependencies 2021-01-25 12:28:34 +03:00
Максим Мержанов 9f4a0b5fe1 Merge branch '__deps' into 'master'
Update dependencies

See merge request integration-system/isp-system-service!10
2020-11-24 14:31:24 +03:00
Егор Кирющенко ffab32fcff Update dependencies 2020-11-24 14:31:24 +03:00
Максим Мержанов 23013ef033 Merge branch 'linter_swagger' into 'master'
add linter, update swagger doc

See merge request integration-system/isp-system-service!3
2020-09-22 16:47:24 +03:00
Дмитрий Гуляченков 091f3ed06e add linter, update swagger doc 2020-09-22 16:47:24 +03:00
yan komissarov c4a34c6cd2 Merge branch 'up_lib' into 'master'
up libs

See merge request integration-system/isp-system-service!2
2020-06-15 12:10:55 +03:00
DeniskaRediska e07527855f add restart event 2020-06-03 14:48:13 +03:00
DeniskaRediska 85012da9b0 up libs 2020-06-03 14:45:54 +03:00
DeniskaRediska f5139e46ed up libs 2020-06-03 14:44:16 +03:00
yan komissarov 9f69df64e6 Merge branch 'modules' into 'master'
migrate to go mod, up deps

See merge request integration-system/isp-system-service!1
2020-04-14 11:16:20 +03:00
Maxim Merzhanov 1c048520f8 migrate to go mod, up deps 2020-04-10 13:57:59 +03:00
Jenkins Automation Server e5bf25d2a4 Update dependencies 2020-01-09 19:17:49 +03:00
Yan 1f633a417d Merge pull request #5 from integration-system/dev
Update dependencies
2019-11-21 11:41:19 +03:00
ykomissarov d92df57ff7 update version 2019-11-20 10:52:03 +03:00
ykomissarov b3905d7ceb Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	Gopkg.lock
2019-11-20 10:48:05 +03:00
ykomissarov 15c18b1452 fix go vet 2019-11-15 13:40:56 +03:00
Yan bf366f7824 Merge pull request #6 from integration-system/access-list
Add access list
2019-11-14 14:01:07 +03:00
DeniskaRediska 293a9def27 update(application method delete_applications) 2019-11-14 13:52:52 +03:00
DeniskaRediska c9334e651b update access_list method set_list 2019-11-13 18:56:26 +03:00
DeniskaRediska 05d645d5f4 rename configs element 2019-11-12 17:23:52 +03:00
DeniskaRediska 5a811a9203 fix handler error 2019-11-12 16:23:22 +03:00
DeniskaRediska 0aa1dc40fd fix(token revoke) 2019-11-12 16:17:37 +03:00
Maxim 9c13075f79 Update dependencies 2019-11-12 13:04:27 +03:00
DeniskaRediska 0aec014161 refactoring 2019-11-12 12:48:03 +03:00
DeniskaRediska f215008349 add access_list methods 2019-11-11 19:21:55 +03:00
Maxim Merzhanov 8a0ebe803a up 2019-11-01 15:08:37 +03:00
Maxim c1da3c89ad Update dependencies 2019-11-01 14:03:44 +03:00
Yan 9fb2e48c8c Merge pull request #4 from integration-system/new_log
update
2019-10-18 14:56:32 +03:00
DeniskaRediska 6b8f3c8b1d fix shutdown 2019-10-18 14:12:48 +03:00
DeniskaRediska d5289efddc update(new log, new db client) 2019-10-18 12:47:25 +03:00
Yan 25b61e7d1d Merge pull request #3 from integration-system/api-doc
add(document generation)
2019-09-09 13:36:32 +03:00
Yan 493f0f1190 Update main.go 2019-09-09 13:36:09 +03:00
DeniskaRediska 9f76e76e55 add(document generation) 2019-09-06 15:13:11 +03:00
DeniskaRediska ff84d68b72 update(lib) 2019-08-26 13:24:45 +03:00
DeniskaRediska 0885d3e331 update(config description) 2019-08-26 13:22:50 +03:00
DeniskaRediska a6e50b6096 change(schema_name) 2019-06-03 16:18:42 +03:00
DeniskaRediska fa4221d4a4 add(default remote config) 2019-06-03 16:04:59 +03:00
ykomissarov 555e253da1 package refactoring 2019-03-20 11:16:23 +03:00
ykomissarov 3b56724d8e package refactoring 2019-03-20 11:16:07 +03:00
ykomissarov 5af4c6a254 update libs 2019-03-18 14:01:52 +03:00
ykomissarov 12a2a86ac4 update libs 2019-03-18 11:26:30 +03:00
ykomissarov f4a7463eec fix nilled slices 2019-03-12 11:13:00 +03:00
Andrey Savchuk cfac1dd58e Merge branch 'master' of work.github.com:integration-system/isp-system-service 2019-01-29 16:42:57 +03:00
logicalslice c420a98f70 Initial commit 2019-01-29 16:30:17 +03:00
57 changed files with 2545 additions and 2965 deletions

No files matched your search

+1
View File
@@ -17,6 +17,7 @@ linters:
- tagalign # не всегда имеет смысл - tagalign # не всегда имеет смысл
- varnamelen # очень индивидуально (db) - varnamelen # очень индивидуально (db)
- wsl # расставление пробелов очень индивидуально - wsl # расставление пробелов очень индивидуально
- wsl_v5 # расставление пробелов очень индивидуально
settings: settings:
cyclop: cyclop:
max-complexity: 15 # по умолчанию 10 мало max-complexity: 15 # по умолчанию 10 мало
+1 -1
View File
@@ -1 +1 @@
5.5.0 6.0.0
+18
View File
@@ -1,3 +1,21 @@
### v6.0.0
* Удалены таблицы `domain` и `system`
* Удалены `deprecated` endpoint'ы
* Изменены контракты для `application` endpoint'ов
* Добавлены `admin` permission к endpoint'ам
### v5.7.3
* обновлены зависимости
### v5.7.2
* Обновлен isp-kit
### v5.7.1
* Методы `/access_list/get_by_id`, `/access_list/set_list` теперь возвращают `httpMethod`
### v5.7.0
* Обновлены зависимости
* Добавлено поле `http_method` в `access_list`
### v5.6.0
* Для endpoint'а `system/secure/authenticate` в ответ добавлено поле `appName` (название приложения)
* Обновлена версия `go` до `1.25`
* Обновлены зависимости
### v5.5.0 ### v5.5.0
* Обновлены зависимости * Обновлены зависимости
### v5.4.0 ### v5.4.0
+1 -1
View File
@@ -7,12 +7,12 @@ import (
"isp-system-service/conf" "isp-system-service/conf"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/app" "github.com/txix-open/isp-kit/app"
"github.com/txix-open/isp-kit/bootstrap" "github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/cluster" "github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/dbrx" "github.com/txix-open/isp-kit/dbrx"
"github.com/txix-open/isp-kit/dbx" "github.com/txix-open/isp-kit/dbx"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/grpc" "github.com/txix-open/isp-kit/grpc"
"github.com/txix-open/isp-kit/log" "github.com/txix-open/isp-kit/log"
) )
+7 -10
View File
@@ -43,26 +43,25 @@ func (l Locator) Config(cfg conf.Remote) Config {
txManager := transaction.NewManager(l.db) txManager := transaction.NewManager(l.db)
accessListRep := repository.NewAccessList(l.db) accessListRep := repository.NewAccessList(l.db)
applicationRep := repository.NewApplication(l.db) applicationRep := repository.NewApplication(l.db)
domainRep := repository.NewDomain(l.db)
appGroupRep := repository.NewAppGroup(l.db) appGroupRep := repository.NewAppGroup(l.db)
tokenRep := repository.NewToken(l.db) tokenRep := repository.NewToken(l.db)
secureService := secure.NewService(tokenRep, accessListRep) secureService := secure.NewService(tokenRep, accessListRep)
accessListService := service.NewAccessList(txManager, accessListRep, applicationRep) accessListService := service.NewAccessList(txManager, accessListRep, applicationRep)
applicationService := service.NewApplication(txManager, applicationRep, domainRep, appGroupRep, tokenRep) applicationService := service.NewApplication(txManager, applicationRep, appGroupRep, tokenRep)
domainService := service.NewDomain(domainRep)
serviceService := service.NewService(domainRep, appGroupRep)
jwtService := service.NewTokenSource() jwtService := service.NewTokenSource()
tokenService := service.NewToken(jwtService, applicationService, txManager, tokenService := service.NewToken(
applicationRep, domainRep, appGroupRep, tokenRep, jwtService,
applicationService,
txManager,
applicationRep,
tokenRep,
) )
secureController := controller.NewSecure(secureService) secureController := controller.NewSecure(secureService)
accessListController := controller.NewAccessList(accessListService) accessListController := controller.NewAccessList(accessListService)
applicationController := controller.NewApplication(applicationService) applicationController := controller.NewApplication(applicationService)
domainController := controller.NewDomain(domainService)
serviceController := controller.NewService(serviceService)
tokenController := controller.NewToken(tokenService) tokenController := controller.NewToken(tokenService)
appGroupService := service.NewAppGroup(appGroupRep) appGroupService := service.NewAppGroup(appGroupRep)
@@ -70,8 +69,6 @@ func (l Locator) Config(cfg conf.Remote) Config {
c := routes.Controllers{ c := routes.Controllers{
Secure: secureController, Secure: secureController,
AccessList: accessListController, AccessList: accessListController,
Domain: domainController,
Service: serviceController,
Application: applicationController, Application: applicationController,
Token: tokenController, Token: tokenController,
AppGroup: appGroupController, AppGroup: appGroupController,
+1 -1
View File
@@ -13,7 +13,7 @@ import (
func init() { func init() {
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) { schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) {
t.Type = "string" t.Type = "string"
t.Enum = []interface{}{"debug", "info", "error", "fatal"} t.Enum = []any{"debug", "info", "error", "fatal"}
}) })
} }
+29 -1
View File
@@ -6,7 +6,7 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/grpc/apierrors" "github.com/txix-open/isp-kit/grpc/apierrors"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
) )
@@ -16,6 +16,7 @@ type AccessListService interface {
SetOne(ctx context.Context, request domain.AccessListSetOneRequest) (*domain.AccessListSetOneResponse, error) SetOne(ctx context.Context, request domain.AccessListSetOneRequest) (*domain.AccessListSetOneResponse, error)
SetList(ctx context.Context, req domain.AccessListSetListRequest) ([]domain.MethodInfo, error) SetList(ctx context.Context, req domain.AccessListSetListRequest) ([]domain.MethodInfo, error)
DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error
DeleteListWithMethods(ctx context.Context, req domain.AccessListDeleteV2ListRequest) error
} }
type AccessList struct { type AccessList struct {
@@ -141,3 +142,30 @@ func (c AccessList) DeleteList(ctx context.Context, req domain.AccessListDeleteL
return err 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
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"isp-system-service/domain" "isp-system-service/domain"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/grpc/apierrors" "github.com/txix-open/isp-kit/grpc/apierrors"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
) )
+29 -43
View File
@@ -6,24 +6,23 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/grpc/apierrors" "github.com/txix-open/isp-kit/grpc/apierrors"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
) )
// nolint:interfacebloat //nolint:interfacebloat
type ApplicationService interface { type ApplicationService interface {
GetById(ctx context.Context, appId int) (*domain.ApplicationWithTokens, error) GetById(ctx context.Context, appId int) (*domain.Application, error)
GetByToken(ctx context.Context, token string) (*domain.GetApplicationByTokenResponse, error) GetByToken(ctx context.Context, token string) (*domain.GetApplicationByTokenResponse, error)
GetByIdList(ctx context.Context, idList []int) ([]*domain.ApplicationWithTokens, error) GetByIdList(ctx context.Context, idList []int) ([]domain.Application, error)
GetByServiceId(ctx context.Context, id int) ([]*domain.ApplicationWithTokens, error) GetByAppGroup(ctx context.Context, appGroupId int) ([]domain.Application, error)
SystemTree(ctx context.Context, systemId int) ([]*domain.DomainWithService, error) CreateUpdate(ctx context.Context, req domain.ApplicationCreateUpdateRequest) (*domain.Application, error)
CreateUpdate(ctx context.Context, req domain.ApplicationCreateUpdateRequest) (*domain.ApplicationWithTokens, error)
Delete(ctx context.Context, idList []int) (int, error) Delete(ctx context.Context, idList []int) (int, error)
NextId(ctx context.Context) (int, error) NextId(ctx context.Context) (int, error)
GetAll(ctx context.Context) ([]domain.Application, error) GetAll(ctx context.Context) ([]domain.Application, error)
Create(ctx context.Context, req domain.CreateApplicationRequest) (*domain.ApplicationWithTokens, error) Create(ctx context.Context, req domain.CreateApplicationRequest) (*domain.Application, error)
Update(ctx context.Context, req domain.UpdateApplicationRequest) (*domain.ApplicationWithTokens, error) Update(ctx context.Context, req domain.UpdateApplicationRequest) (*domain.Application, error)
} }
type Application struct { type Application struct {
@@ -44,12 +43,12 @@ func NewApplication(service ApplicationService) Application {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.Identity true "Идентификатор приложения" // @Param body body domain.Identity true "Идентификатор приложения"
// @Success 200 {object} domain.ApplicationWithTokens // @Success 200 {object} domain.Application
// @Failure 400 {object} apierrors.Error // @Failure 400 {object} apierrors.Error
// @Failure 404 {object} apierrors.Error // @Failure 404 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error // @Failure 500 {object} apierrors.Error
// @Router /application/get_application_by_id [POST] // @Router /application/get_application_by_id [POST]
func (c Application) GetById(ctx context.Context, req domain.Identity) (*domain.ApplicationWithTokens, error) { func (c Application) GetById(ctx context.Context, req domain.Identity) (*domain.Application, error) {
result, err := c.service.GetById(ctx, req.Id) result, err := c.service.GetById(ctx, req.Id)
switch { switch {
case errors.Is(err, domain.ErrApplicationNotFound): case errors.Is(err, domain.ErrApplicationNotFound):
@@ -100,44 +99,31 @@ func (c Application) GetByToken(ctx context.Context, req domain.GetApplicationBy
// //
// @Tags application // @Tags application
// @Summary Получить список приложений // @Summary Получить список приложений
// @Description Возвращает массив приложений с токенами по их идентификаторам // @Description Возвращает массив приложений их идентификаторам
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body []integer false "Массив идентификаторов приложений" // @Param body body []integer false "Массив идентификаторов приложений"
// @Success 200 {array} domain.ApplicationWithTokens // @Success 200 {array} domain.Application
// @Failure 500 {object} apierrors.Error // @Failure 500 {object} apierrors.Error
// @Router /application/get_applications [POST] // @Router /application/get_applications [POST]
func (c Application) GetByIdList(ctx context.Context, req []int) ([]*domain.ApplicationWithTokens, error) { func (c Application) GetByIdList(ctx context.Context, req []int) ([]domain.Application, error) {
return c.service.GetByIdList(ctx, req) return c.service.GetByIdList(ctx, req)
} }
// GetByServiceId godoc // GetByAppGroup godoc
// //
// @Tags application // @Tags application
// @Summary Получить список приложений по идентификатору сервиса // @Summary Получить список приложений по идентификатору группы
// @Description Возвращает список приложений по запрошенному идентификатору сервиса // @Description Возвращает список приложений по идентификатору группы
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.Identity true "Идентификатор сервиса" // @Param body body domain.Identity true "Тело запроса"
// @Success 200 {array} domain.ApplicationWithTokens // @Success 200 {array} domain.Application
// @Failure 400 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error // @Failure 500 {object} apierrors.Error
// @Router /application/get_applications_by_service_id [POST] // @Router /application/get_by_app_group [POST]
func (c Application) GetByServiceId(ctx context.Context, req domain.Identity) ([]*domain.ApplicationWithTokens, error) { func (c Application) GetByAppGroup(ctx context.Context, req domain.Identity) ([]domain.Application, error) {
return c.service.GetByServiceId(ctx, req.Id) return c.service.GetByAppGroup(ctx, req.Id)
}
// GetSystemTree godoc
//
// @Tags application
// @Summary Метод получения системного дерева
// @Description Возвращает описание взаимосвязей сервисов и приложений
// @Accept json
// @Produce json
// @Success 200 {array} domain.DomainWithService
// @Failure 500 {object} apierrors.Error
// @Router /application/get_system_tree [POST]
func (c Application) GetSystemTree(ctx context.Context) ([]*domain.DomainWithService, error) {
return c.service.SystemTree(ctx, domain.DefaultSystemId)
} }
// CreateUpdate godoc // CreateUpdate godoc
@@ -148,19 +134,19 @@ func (c Application) GetSystemTree(ctx context.Context) ([]*domain.DomainWithSer
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.ApplicationCreateUpdateRequest true "Объект приложения" // @Param body body domain.ApplicationCreateUpdateRequest true "Объект приложения"
// @Success 200 {object} domain.ApplicationWithTokens // @Success 200 {object} domain.Application
// @Failure 400 {object} apierrors.Error // @Failure 400 {object} apierrors.Error
// @Failure 404 {object} apierrors.Error // @Failure 404 {object} apierrors.Error
// @Failure 409 {object} apierrors.Error // @Failure 409 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error // @Failure 500 {object} apierrors.Error
// @Router /application/create_update_application [POST] // @Router /application/create_update_application [POST]
func (c Application) CreateUpdate(ctx context.Context, req domain.ApplicationCreateUpdateRequest) (*domain.ApplicationWithTokens, error) { func (c Application) CreateUpdate(ctx context.Context, req domain.ApplicationCreateUpdateRequest) (*domain.Application, error) {
result, err := c.service.CreateUpdate(ctx, req) result, err := c.service.CreateUpdate(ctx, req)
switch { switch {
case errors.Is(err, domain.ErrAppGroupNotFound): case errors.Is(err, domain.ErrAppGroupNotFound):
return nil, apierrors.NewBusinessError( return nil, apierrors.NewBusinessError(
domain.ErrCodeAppGroupNotFound, domain.ErrCodeAppGroupNotFound,
fmt.Sprintf("service with id %d not found", req.ServiceId), fmt.Sprintf("service with id %d not found", req.ApplicationGroupId),
err, err,
) )
case errors.Is(err, domain.ErrApplicationDuplicateName): case errors.Is(err, domain.ErrApplicationDuplicateName):
@@ -248,12 +234,12 @@ func (c Application) GetAll(ctx context.Context) ([]domain.Application, error) {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.CreateApplicationRequest true "Объект приложения" // @Param body body domain.CreateApplicationRequest true "Объект приложения"
// @Success 200 {object} domain.ApplicationWithTokens // @Success 200 {object} domain.Application
// @Failure 400 {object} apierrors.Error // @Failure 400 {object} apierrors.Error
// @Failure 409 {object} apierrors.Error // @Failure 409 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error // @Failure 500 {object} apierrors.Error
// @Router /application/create_application [POST] // @Router /application/create_application [POST]
func (c Application) Create(ctx context.Context, req domain.CreateApplicationRequest) (*domain.ApplicationWithTokens, error) { func (c Application) Create(ctx context.Context, req domain.CreateApplicationRequest) (*domain.Application, error) {
result, err := c.service.Create(ctx, req) result, err := c.service.Create(ctx, req)
switch { switch {
case errors.Is(err, domain.ErrAppGroupNotFound): case errors.Is(err, domain.ErrAppGroupNotFound):
@@ -289,13 +275,13 @@ func (c Application) Create(ctx context.Context, req domain.CreateApplicationReq
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param body body domain.UpdateApplicationRequest true "Объект приложения" // @Param body body domain.UpdateApplicationRequest true "Объект приложения"
// @Success 200 {object} domain.ApplicationWithTokens // @Success 200 {object} domain.Application
// @Failure 400 {object} apierrors.Error // @Failure 400 {object} apierrors.Error
// @Failure 404 {object} apierrors.Error // @Failure 404 {object} apierrors.Error
// @Failure 409 {object} apierrors.Error // @Failure 409 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error // @Failure 500 {object} apierrors.Error
// @Router /application/update_application [POST] // @Router /application/update_application [POST]
func (c Application) Update(ctx context.Context, req domain.UpdateApplicationRequest) (*domain.ApplicationWithTokens, error) { func (c Application) Update(ctx context.Context, req domain.UpdateApplicationRequest) (*domain.Application, error) {
result, err := c.service.Update(ctx, req) result, err := c.service.Update(ctx, req)
switch { switch {
case errors.Is(err, domain.ErrApplicationNotFound): case errors.Is(err, domain.ErrApplicationNotFound):
-142
View File
@@ -1,142 +0,0 @@
package controller
import (
"context"
"fmt"
"isp-system-service/domain"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc/apierrors"
"google.golang.org/grpc/codes"
)
type DomainService interface {
GetById(ctx context.Context, id int) (*domain.Domain, error)
GetBySystemId(ctx context.Context, systemId int) ([]domain.Domain, error)
CreateUpdate(ctx context.Context, req domain.DomainCreateUpdateRequest, systemId int) (*domain.Domain, error)
Delete(ctx context.Context, idList []int) (int, error)
}
type Domain struct {
service DomainService
}
func NewDomain(service DomainService) Domain {
return Domain{
service: service,
}
}
// GetById godoc
//
// @Tags domain
// @Summary Получить домен по идентификатору
// @Description Возвращает описание домена по его идентификатору
// @Accept json
// @Produce json
// @Param body body domain.Identity true "Идентификатор домена"
// @Success 200 {object} domain.Domain
// @Failure 404 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error
// @Router /domain/get_domain_by_id [POST]
func (c Domain) GetById(ctx context.Context, req domain.Identity) (*domain.Domain, error) {
result, err := c.service.GetById(ctx, req.Id)
switch {
case errors.Is(err, domain.ErrDomainNotFound):
return nil, apierrors.New(
codes.NotFound,
domain.ErrCodeDomainNotFound,
fmt.Sprintf("domain with id %d not found", req.Id),
err,
)
case err != nil:
return nil, err
default:
return result, nil
}
}
// GetBySystemId godoc
//
// @Tags domain
// @Summary Получить домены по идентификатору системы
// @Description Возвращает список доменов по системному идентификатору
// @Accept json
// @Produce json
// @Param body body integer false "Идентификатор системы"
// @Success 200 {array} domain.Domain
// @Failure 500 {object} apierrors.Error
// @Router /domain/get_domains_by_system_id [POST]
func (c Domain) GetBySystemId(ctx context.Context) ([]domain.Domain, error) {
return c.service.GetBySystemId(ctx, domain.DefaultSystemId)
}
// CreateUpdate godoc
//
// @Tags domain
// @Summary Создать/обновить домен
// @Description Если домен с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу
// @Accept json
// @Produce json
// @Param body body domain.DomainCreateUpdateRequest true "Объект домена"
// @Success 200 {object} domain.Domain
// @Failure 500 {object} apierrors.Error
// @Router /domain/create_update_domain [POST]
func (c Domain) CreateUpdate(ctx context.Context, req domain.DomainCreateUpdateRequest) (*domain.Domain, error) {
result, err := c.service.CreateUpdate(ctx, req, domain.DefaultSystemId)
switch {
case errors.Is(err, domain.ErrSystemNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrCodeSystemNotFound,
fmt.Sprintf("system with id %d not found", domain.DefaultSystemId),
err,
)
case errors.Is(err, domain.ErrDomainNotFound):
return nil, apierrors.New(
codes.NotFound,
domain.ErrCodeDomainNotFound,
fmt.Sprintf("domain with id %d not found", req.Id),
err,
)
case errors.Is(err, domain.ErrDomainDuplicateName):
return nil, apierrors.New(
codes.AlreadyExists,
domain.ErrCodeDomainDuplicateName,
fmt.Sprintf("domain with name %s already exists", req.Name),
err,
)
case err != nil:
return nil, err
default:
return result, nil
}
}
// Delete godoc
//
// @Tags domain
// @Summary Удаление доменов
// @Description Удаляет домены по списку их идентификаторов, возвращает количество удаленных доменов
// @Accept json
// @Produce json
// @Param body body []integer false "Массив идентификаторов доменов"
// @Success 200 {object} domain.DeleteResponse
// @Failure 400 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error
// @Router /domain/delete_domains [POST]
func (c Domain) Delete(ctx context.Context, req []int) (*domain.DeleteResponse, error) {
if len(req) == 0 {
return nil, apierrors.NewBusinessError(domain.ErrCodeInvalidRequest,
"At least one id are required", errors.New("invalid id count"))
}
result, err := c.service.Delete(ctx, req)
if err != nil {
return nil, err
}
return &domain.DeleteResponse{
Deleted: result,
}, nil
}
+3 -3
View File
@@ -5,12 +5,12 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
) )
type SecureService interface { type SecureService interface {
Authenticate(ctx context.Context, token string) (*domain.AuthData, error) 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 { type Secure struct {
@@ -69,7 +69,7 @@ func (c Secure) Authenticate(ctx context.Context, req domain.AuthenticateRequest
// @Failure 500 {object} apierrors.Error // @Failure 500 {object} apierrors.Error
// @Router /secure/authorize [POST] // @Router /secure/authorize [POST]
func (c Secure) Authorize(ctx context.Context, req domain.AuthorizeRequest) (*domain.AuthorizeResponse, error) { 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 { switch {
case errors.Is(err, domain.ErrAccessListNotFound): case errors.Is(err, domain.ErrAccessListNotFound):
return &domain.AuthorizeResponse{ return &domain.AuthorizeResponse{
-161
View File
@@ -1,161 +0,0 @@
package controller
import (
"context"
"fmt"
"isp-system-service/domain"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc/apierrors"
"google.golang.org/grpc/codes"
)
type ServiceService interface {
GetById(ctx context.Context, id int) (*domain.Service, error)
GetByIdList(ctx context.Context, idList []int) ([]domain.Service, error)
GetByDomainId(ctx context.Context, domainId int) ([]domain.Service, error)
CreateUpdate(ctx context.Context, req domain.ServiceCreateUpdateRequest) (*domain.Service, error)
Delete(ctx context.Context, idList []int) (int, error)
}
type Service struct {
service ServiceService
}
func NewService(service ServiceService) Service {
return Service{
service: service,
}
}
// GetById godoc
//
// @Tags service
// @Summary Получить сервис по идентификатору
// @Description Возвращает описание сервиса по его идентификатору
// @Accept json
// @Produce json
// @Param body body domain.Identity true "Идентификатор сервиса"
// @Success 200 {object} domain.Service
// @Failure 404 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error
// @Router /service/get_service_by_id [POST]
func (c Service) GetById(ctx context.Context, req domain.Identity) (*domain.Service, error) {
result, err := c.service.GetById(ctx, req.Id)
switch {
case errors.Is(err, domain.ErrAppGroupNotFound):
return nil, apierrors.New(
codes.NotFound,
domain.ErrCodeAppGroupNotFound,
fmt.Sprintf("service with id %d not found", req.Id),
err,
)
case err != nil:
return nil, err
default:
return result, nil
}
}
// Get godoc
//
// @Tags service
// @Summary Получить список сервисов
// @Description Возвращает список сервисов по их идентификаторам
// @Accept json
// @Produce json
// @Param body body []integer false "Массив идентификаторов сервисов"
// @Success 200 {array} domain.Service
// @Failure 500 {object} apierrors.Error
// @Router /service/get_service [POST]
func (c Service) Get(ctx context.Context, req []int) ([]domain.Service, error) {
return c.service.GetByIdList(ctx, req)
}
// GetByDomainId godoc
//
// @Tags service
// @Summary Получить список сервисов по идентификатору домена
// @Description Возвращает список сервисов по идентификатору домена
// @Accept json
// @Produce json
// @Param body body domain.Identity true "Идентификатор домена"
// @Success 200 {array} domain.Service
// @Failure 500 {object} apierrors.Error
// @Router /service/get_services_by_domain_id [POST]
func (c Service) GetByDomainId(ctx context.Context, req domain.Identity) ([]domain.Service, error) {
return c.service.GetByDomainId(ctx, req.Id)
}
// CreateUpdate godoc
//
// @Tags service
// @Summary Создать/обновить сервис
// @Description Если сервис с такими идентификатором существует, то обновляет данные, если нет, то добавляет данные в базу
// @Accept json
// @Produce json
// @Param body body domain.ServiceCreateUpdateRequest true "Объект сервиса"
// @Success 200 {object} domain.Service
// @Failure 400 {object} apierrors.Error
// @Failure 404 {object} apierrors.Error
// @Failure 409 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error
// @Router /service/create_update_service [POST]
func (c Service) CreateUpdate(ctx context.Context, req domain.ServiceCreateUpdateRequest) (*domain.Service, error) {
result, err := c.service.CreateUpdate(ctx, req)
switch {
case errors.Is(err, domain.ErrDomainNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrCodeDomainNotFound,
fmt.Sprintf("domain with id %d not found", req.DomainId),
err,
)
case errors.Is(err, domain.ErrAppGroupNotFound):
return nil, apierrors.New(
codes.NotFound,
domain.ErrCodeAppGroupNotFound,
fmt.Sprintf("service with id %d not found", req.Id),
err,
)
case errors.Is(err, domain.ErrAppGroupDuplicateName):
return nil, apierrors.New(
codes.AlreadyExists,
domain.ErrCodeAppGroupNotFound,
fmt.Sprintf("service with name %s already exists", req.Name),
err,
)
case err != nil:
return nil, err
default:
return result, nil
}
}
// Delete godoc
//
// @Tags service
// @Summary Удалить сервисы
// @Description Удаляет сервисов по списку их идентификаторов, возвращает количество удаленных сервисов
// @Accept json
// @Produce json
// @Param body body []integer true "Массив идентификаторов сервисов"
// @Success 200 {object} domain.DeleteResponse
// @Failure 400 {object} apierrors.Error
// @Failure 500 {object} apierrors.Error
// @Router /service/delete_service [POST]
func (c Service) Delete(ctx context.Context, req []int) (*domain.DeleteResponse, error) {
if len(req) == 0 {
return nil, apierrors.NewBusinessError(domain.ErrCodeInvalidRequest,
"At least one id are required", errors.New("invalid id count"))
}
result, err := c.service.Delete(ctx, req)
if err != nil {
return nil, err
}
return &domain.DeleteResponse{
Deleted: result,
}, nil
}
+1 -15
View File
@@ -6,7 +6,7 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/grpc/apierrors" "github.com/txix-open/isp-kit/grpc/apierrors"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
) )
@@ -64,20 +64,6 @@ func (c Token) Create(ctx context.Context, req domain.TokenCreateRequest) (*doma
fmt.Sprintf("application with id %d not found", req.AppId), fmt.Sprintf("application with id %d not found", req.AppId),
err, err,
) )
case errors.Is(err, domain.ErrAppGroupNotFound):
return nil, apierrors.New(
codes.NotFound,
domain.ErrCodeAppGroupNotFound,
fmt.Sprintf("service for app_id id %d not found", req.AppId),
err,
)
case errors.Is(err, domain.ErrDomainNotFound):
return nil, apierrors.New(
codes.NotFound,
domain.ErrCodeDomainNotFound,
fmt.Sprintf("domain for app_id id %d not found", req.AppId),
err,
)
case err != nil: case err != nil:
return nil, err return nil, err
default: default:
+9
View File
@@ -0,0 +1,9 @@
package docs
import _ "embed"
// Embedded swagger files.
var (
//go:embed swagger.json
SwaggerJson []byte
)
+1693
View File
File diff suppressed because it is too large. Load diff
-1452
View File
File diff suppressed because it is too large. Load diff
+17 -5
View File
@@ -1,9 +1,10 @@
package domain package domain
type AccessListSetOneRequest struct { type AccessListSetOneRequest struct {
AppId int `validate:"required"` AppId int `validate:"required"`
Method string `validate:"required"` HttpMethod string
Value bool Method string `validate:"required"`
Value bool
} }
type AccessListSetOneResponse struct { type AccessListSetOneResponse struct {
@@ -17,11 +18,22 @@ type AccessListSetListRequest struct {
} }
type MethodInfo struct { type MethodInfo struct {
Method string HttpMethod string
Value bool Method string
Value bool
} }
type AccessListDeleteListRequest struct { type AccessListDeleteListRequest struct {
AppId int `validate:"required"` AppId int `validate:"required"`
Methods []string `validate:"required,min=1"` 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"`
}
+12 -20
View File
@@ -10,21 +10,21 @@ const (
) )
type Application struct { type Application struct {
Id int Id int
Name string Name string
Description string Description string
ServiceId int ApplicationGroupId int
Type string Type string
CreatedAt time.Time CreatedAt time.Time
UpdatedAt time.Time UpdatedAt time.Time
} }
type ApplicationCreateUpdateRequest struct { type ApplicationCreateUpdateRequest struct {
Id int Id int
Name string `validate:"required"` Name string `validate:"required"`
Description string Description string
ServiceId int `validate:"required"` ApplicationGroupId int `validate:"required"`
Type string `validate:"required,oneof=SYSTEM MOBILE"` Type string `validate:"required,oneof=SYSTEM MOBILE"`
} }
type ApplicationWithTokens struct { type ApplicationWithTokens struct {
@@ -32,14 +32,6 @@ type ApplicationWithTokens struct {
Tokens []Token Tokens []Token
} }
type ApplicationSimple struct {
Id int
Name string
Description string
Type string
Tokens []Token
}
type CreateApplicationRequest struct { type CreateApplicationRequest struct {
Id int `validate:"required"` Id int `validate:"required"`
Name string `validate:"required"` Name string `validate:"required"`
-27
View File
@@ -1,27 +0,0 @@
package domain
import (
"time"
)
type DomainCreateUpdateRequest struct {
Id int
Name string `validate:"required"`
Description string
}
type Domain struct {
Id int
Name string
Description string
SystemId int
CreatedAt time.Time
UpdatedAt time.Time
}
type DomainWithService struct {
Id int
Name string
Description string
Services []*ServiceWithApps
}
+1 -10
View File
@@ -1,7 +1,7 @@
package domain package domain
import ( import (
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
) )
const ( const (
@@ -13,21 +13,12 @@ const (
ErrCodeAppGroupNotFound = 605 ErrCodeAppGroupNotFound = 605
ErrCodeAppGroupDuplicateName = 606 ErrCodeAppGroupDuplicateName = 606
ErrCodeSystemNotFound = 607
ErrCodeDomainNotFound = 608
ErrCodeDomainDuplicateName = 609
) )
var ( var (
ErrDomainNotFound = errors.New("domain not found")
ErrDomainDuplicateName = errors.New("domain name already exist")
ErrAppGroupNotFound = errors.New("application group not found") ErrAppGroupNotFound = errors.New("application group not found")
ErrAppGroupDuplicateName = errors.New("application group name already exist") ErrAppGroupDuplicateName = errors.New("application group name already exist")
ErrSystemNotFound = errors.New("system not found")
ErrApplicationNotFound = errors.New("application not found") ErrApplicationNotFound = errors.New("application not found")
ErrApplicationDuplicateName = errors.New("application name already exist") ErrApplicationDuplicateName = errors.New("application name already exist")
ErrApplicationDuplicateId = errors.New("application id already exist") ErrApplicationDuplicateId = errors.New("application id already exist")
+3 -4
View File
@@ -11,14 +11,13 @@ type AuthenticateResponse struct {
} }
type AuthData struct { type AuthData struct {
SystemId int AppName string
DomainId int
ServiceId int
ApplicationId int ApplicationId int
} }
type AuthorizeRequest struct { type AuthorizeRequest struct {
ApplicationId int `validate:"required"` ApplicationId int `validate:"required"`
HttpMethod string
Endpoint string `validate:"required"` Endpoint string `validate:"required"`
} }
-28
View File
@@ -1,28 +0,0 @@
package domain
import (
"time"
)
type Service struct {
Id int
Name string
Description string
DomainId int
CreatedAt time.Time
UpdatedAt time.Time
}
type ServiceCreateUpdateRequest struct {
Id int
Name string `validate:"required"`
Description string
DomainId int `validate:"required"`
}
type ServiceWithApps struct {
Id int
Name string
Description string
Apps []*ApplicationSimple
}
-5
View File
@@ -1,5 +0,0 @@
package domain
const (
DefaultSystemId = 1
)
+9 -3
View File
@@ -1,7 +1,13 @@
package entity package entity
type AccessList struct { type AccessList struct {
AppId int AppId int
Method string HttpMethod string
Value bool Method string
Value bool
}
type Method struct {
HttpMethod string
Method string
} }
-1
View File
@@ -9,7 +9,6 @@ type AppGroup struct {
Id int Id int
Name string Name string
Description sql.NullString Description sql.NullString
DomainId int
CreatedAt time.Time CreatedAt time.Time
UpdatedAt time.Time UpdatedAt time.Time
} }
-14
View File
@@ -1,14 +0,0 @@
package entity
import (
"time"
)
type Domain struct {
Id int
Name string
Description *string
SystemId int
CreatedAt time.Time
UpdatedAt time.Time
}
+4 -6
View File
@@ -12,10 +12,8 @@ type Token struct {
} }
type AuthData struct { type AuthData struct {
SystemId int AppName string
DomainId int AppId int
ApplicationGroupId int ExpireTime int
AppId int CreatedAt time.Time
ExpireTime int
CreatedAt time.Time
} }
+40 -40
View File
@@ -1,81 +1,81 @@
module isp-system-service module isp-system-service
go 1.24 go 1.26.0
require ( require (
github.com/Masterminds/squirrel v1.5.4 github.com/Masterminds/squirrel v1.5.4
github.com/jackc/pgx/v5 v5.7.5 github.com/jackc/pgx/v5 v5.10.0
github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.11.1
github.com/stretchr/testify v1.10.0 github.com/txix-open/isp-kit v1.74.0
github.com/txix-open/isp-kit v1.54.1
github.com/txix-open/jsonschema v1.3.0 github.com/txix-open/jsonschema v1.3.0
google.golang.org/grpc v1.74.2 google.golang.org/grpc v1.83.0
) )
require ( require (
github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/buger/jsonparser v1.1.1 // indirect github.com/buger/jsonparser v1.6.0 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coder/websocket v1.8.13 // indirect github.com/coder/websocket v1.8.15 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect github.com/gabriel-vasile/mimetype v1.4.15 // indirect
github.com/getsentry/sentry-go v0.35.1 // indirect github.com/getsentry/sentry-go v0.48.0 // indirect
github.com/go-faker/faker/v4 v4.6.1 // indirect github.com/go-faker/faker/v4 v4.10.1 // indirect
github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/logr v1.4.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/google/uuid v1.6.0 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect github.com/iancoleman/strcase v0.3.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jmoiron/sqlx v1.4.0 // indirect github.com/jmoiron/sqlx v1.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.19.1 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.5.0 // indirect
github.com/mailru/easyjson v0.9.0 // indirect github.com/mailru/easyjson v0.9.2 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect github.com/mfridman/interpolate v0.0.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/pressly/goose/v3 v3.24.3 // indirect github.com/pressly/goose/v3 v3.27.3 // indirect
github.com/prometheus/client_golang v1.23.0 // indirect github.com/prometheus/client_golang v1.24.1 // indirect
github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.65.0 // indirect github.com/prometheus/common v0.70.1 // indirect
github.com/prometheus/procfs v0.17.0 // indirect github.com/prometheus/procfs v0.21.1 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect github.com/sethvargo/go-retry v0.4.0 // indirect
github.com/txix-open/bellows v1.2.0 // indirect github.com/txix-open/bellows v1.2.0 // indirect
github.com/txix-open/etp/v4 v4.0.1 // indirect github.com/txix-open/etp/v4 v4.1.3 // indirect
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect go.opentelemetry.io/otel v1.44.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.44.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect go.opentelemetry.io/otel/metric v1.44.0 // indirect
go.opentelemetry.io/otel/sdk v1.37.0 // indirect go.opentelemetry.io/otel/sdk v1.44.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect go.opentelemetry.io/otel/trace v1.44.0 // indirect
go.opentelemetry.io/proto/otlp v1.7.1 // indirect go.opentelemetry.io/proto/otlp v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect go.uber.org/zap v1.28.0 // indirect
golang.org/x/crypto v0.41.0 // indirect golang.org/x/crypto v0.54.0 // indirect
golang.org/x/net v0.43.0 // indirect golang.org/x/net v0.57.0 // indirect
golang.org/x/sync v0.16.0 // indirect golang.org/x/sync v0.22.0 // indirect
golang.org/x/sys v0.35.0 // indirect golang.org/x/sys v0.47.0 // indirect
golang.org/x/text v0.28.0 // indirect golang.org/x/text v0.40.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250811230008-5f3141c8851a // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260729162451-8efbd57d26e0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260729162451-8efbd57d26e0 // indirect
google.golang.org/protobuf v1.36.7 // indirect google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
+106 -99
View File
@@ -1,5 +1,6 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM= github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
@@ -8,30 +9,31 @@ github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPn
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.6.0 h1:IHTgLjkgckOjAp8p0aYfXkv+cqC+zrzALg/JywnPjxY=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/buger/jsonparser v1.6.0/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE= github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA=
github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs= github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/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 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= github.com/gabriel-vasile/mimetype v1.4.15 h1:05iP/CYtZ/w455R/KZM6rZ5ieAdh99UPtd+d3YzLmaI=
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= github.com/gabriel-vasile/mimetype v1.4.15/go.mod h1:azpTcoLcDZRNgFou5j+APrqQx9HqVPWa6ijYQIIVswQ=
github.com/getsentry/sentry-go v0.35.1 h1:iopow6UVLE2aXu46xKVIs8Z9D/YZkJrHkgozrxa+tOQ= github.com/getsentry/sentry-go v0.48.0 h1:FRZNr7Uk1C86ev1bSJmYlUkL9oyivQA6YOcdYfaaMmY=
github.com/getsentry/sentry-go v0.35.1/go.mod h1:C55omcY9ChRQIUcVcGcs+Zdy4ZpQGvNJ7JYHIoSWOtE= github.com/getsentry/sentry-go v0.48.0/go.mod h1:E5UkA5wp1qR2+MDydNYlVeUiNN2xEdjYMidkgf0Qoss=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= 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-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-faker/faker/v4 v4.6.1 h1:xUyVpAjEtB04l6XFY0V/29oR332rOSPWV4lU8RwDt4k= github.com/go-faker/faker/v4 v4.10.1 h1:mGH3y0X8AfrXsfgPsPuTkWBYIebomvdkWEN1uDLoFFg=
github.com/go-faker/faker/v4 v4.6.1/go.mod h1:arSdxNCSt7mOhdk8tEolvHeIJ7eX4OX80wXjKKvkKBY= github.com/go-faker/faker/v4 v4.10.1/go.mod h1:VFIEwWDd16EdYDLF6NJ5gAAzEp7vz5LgKgJ2iZ17Tdg=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
@@ -41,8 +43,8 @@ github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/Nu
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/go-sql-driver/mysql v1.9.2 h1:4cNKDYQ1I84SXslGddlsrMhc8k4LeDVj6Ad6WRjiHuU= github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw=
github.com/go-sql-driver/mysql v1.9.2/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
@@ -50,16 +52,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/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 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= 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 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= 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 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.7.5 h1:JHGfMnQY+IEtGM63d+NGMjoRpysB2JBwDr5fsngwmJs= github.com/jackc/pgx/v5 v5.10.0 h1:VhSvgU2jSli8o3AqIEOTJr7rZwAEUVo4E4XhR94Zfr0=
github.com/jackc/pgx/v5 v5.7.5/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M= github.com/jackc/pgx/v5 v5.10.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= 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/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
@@ -68,8 +70,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/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 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= 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.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -80,14 +82,14 @@ github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o=
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk=
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.5.0 h1:pLqT2kq1zpHW/1D18QMjMpdtX7cekxqtJJjg5ANyWw0=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/leodido/go-urn v1.5.0/go.mod h1:9BORnCDhdPBJNDEX+w1bJisa8yOKYi116VeO96s4ifE=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= 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.2 h1:dX8U45hQsZpxd80nLvDGihsQ/OxlvTkVUXH2r/8cb2M=
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mailru/easyjson v0.9.2/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.23 h1:cYwCQTQf3HB6xUC+BtyCLZNr7IzbOmoZbmssVNzSyiQ=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.23/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
@@ -101,32 +103,33 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pressly/goose/v3 v3.24.3 h1:DSWWNwwggVUsYZ0X2VitiAa9sKuqtBfe+Jr9zFGwWlM= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pressly/goose/v3 v3.24.3/go.mod h1:v9zYL4xdViLHCUUJh/mhjnm6JrK7Eul8AS93IxiZM4E= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc= github.com/pressly/goose/v3 v3.27.3 h1:pIglVHjw99r4e/hDHHwbl9vfOsDMqUokfkXo6+n/RxA=
github.com/prometheus/client_golang v1.23.0/go.mod h1:i/o0R9ByOnHX0McrTMTyhYvKE4haaf2mW08I+jGAjEE= github.com/pressly/goose/v3 v3.27.3/go.mod h1:Dag+xpV6o20HR2LFY1j0q6MDwc3f7vPUFDA77R+0yGY=
github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU=
github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE=
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= 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/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE= github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi/PY=
github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc=
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI=
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY=
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw= github.com/rabbitmq/amqp091-go v1.13.0 h1:L8NA1WtF76C6KA3LAoufjfLgbist/If1UQYcsOjtxXA=
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o= github.com/rabbitmq/amqp091-go v1.13.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE= github.com/sethvargo/go-retry v0.4.0 h1:9qy1OoIAxBL+gBYnkTnTnWle5wlfsXQlwRzIbbpdqPw=
github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas= github.com/sethvargo/go-retry v0.4.0/go.mod h1:tvsjdKG6xfiCx4LSiUZ06kcv38xvdVQwv8R6/VnnVWg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -138,16 +141,16 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY= github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o= github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA= github.com/txix-open/etp/v4 v4.1.3 h1:u9ZyU2yKGgoQ1/DSaElhazWm8xASdqGEdWjoJ2xQlfo=
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8= github.com/txix-open/etp/v4 v4.1.3/go.mod h1:9GK+Aje8BmLFq8Hk4j6Qb976LdU9WECCWAuLK1vAKgM=
github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM= github.com/txix-open/grmq v1.12.0 h1:lSPYvwLfTL0+b0xDQmuuN6RaKS3NCEJNK9ccWpOWa8Y=
github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po= github.com/txix-open/grmq v1.12.0/go.mod h1:6m9CCTQao/HAFalu5rFOZGJ5KLEP6WzzIwj80Ml3KGE=
github.com/txix-open/isp-kit v1.54.1 h1:OY4dQgvhHpRicwpemnoHxs+w2/rMkc19Jf0Nj8QPIeI= github.com/txix-open/isp-kit v1.74.0 h1:Gi1X8Jnf9ppV4TXq4kMCBgBjJjqSKh57X8038I+tQFw=
github.com/txix-open/isp-kit v1.54.1/go.mod h1:sVUjen989u4yz5SYAZ4LRCQzRfwlU/uJ5ogiU31zmks= github.com/txix-open/isp-kit v1.74.0/go.mod h1:Kob233jk1j/Js7UmopJ5b7JpVZrpWbagEAjasgfqTdk=
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4= 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/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0= github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
@@ -161,52 +164,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/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 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= 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.62.0 h1:wCeciVlAfb5DC8MQl/DlmAv/FVPNpQgFvI/71+hatuc= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.69.0 h1:MCcYL7J6Vt/X0kjqbMZkekCmwsurbQRbL69vkiye2lk=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.62.0/go.mod h1:WfEApdZDMlLUAev/0QQpr8EJ/z0VWDKYZ5tF5RH5T1U= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.69.0/go.mod h1:3jnStNwSufK+f5ktjL4EPcwtig4rtd81NS70lqHuXl8=
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU=
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 h1:Ahq7pZmv87yiyn3jeFz/LekZmPLLdKejuO3NcK9MssM= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 h1:4YsVu3B8+3qtWYYrsUYgn0OG78pN0rnNPRGX4SbokQI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0/go.mod h1:+wnlSn0mD1ADVMe3v9Z/WIaiz6q6gL2J/ejaAmdmv80=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 h1:bDMKF3RUSxshZ5OjOTi8rsHGaPKsAt76FaqgvIUySLc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.44.0 h1:lgh3PiVrRUWMLOVSkQicxzZll5NjF1r+AtsX1XRIHw0=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0/go.mod h1:dDT67G/IkA46Mr2l9Uj7HsQVwsjASyV9SjGofsiUZDA= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.44.0/go.mod h1:5Cnhth3m/AgOeTgE3ex12pPmiu/gGtZit03kSzx9X7s=
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc=
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo=
go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58=
go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0=
go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFwHX4dThiPis= go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI=
go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4= go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk=
go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= 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/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 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= 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.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
google.golang.org/genproto/googleapis/api v0.0.0-20250811230008-5f3141c8851a h1:DMCgtIAIQGZqJXMVzJF4MV8BlWoJh2ZuFiRdAleyr58= golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs=
google.golang.org/genproto/googleapis/api v0.0.0-20250811230008-5f3141c8851a/go.mod h1:y2yVLIE/CSMCPXaHnSKXxu1spLPnglFLegmgdY23uuE= golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a h1:tPE/Kp+x9dMSwUm/uM0JKK0IfdiJkwAbSMSeZBXXJXc= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250811230008-5f3141c8851a/go.mod h1:gw1tLEfykwDz2ET4a12jcXt4couGAm7IwsVaTy0Sflo= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4= google.golang.org/genproto/googleapis/api v0.0.0-20260729162451-8efbd57d26e0 h1:ybvH/ZpOcpCrjtkb7oW/fdlzbEmRVeumw19SRQmNFKU=
google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM= google.golang.org/genproto/googleapis/api v0.0.0-20260729162451-8efbd57d26e0/go.mod h1:HJ9MpJLeDSstBkx1LILTpd5f41ADSMZcTPypw02qEGw=
google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A= google.golang.org/genproto/googleapis/rpc v0.0.0-20260729162451-8efbd57d26e0 h1:mJiOtnGp0k/BcSgdu03G2NwnscCfCH+h2QKUBZr18KI=
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= google.golang.org/genproto/googleapis/rpc v0.0.0-20260729162451-8efbd57d26e0/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.83.0 h1:JeNZEKJFbQxArAMl+hiytHauacDNqJUllNfmIMmpqnQ=
google.golang.org/grpc v1.83.0/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ=
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 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 h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
@@ -215,11 +222,11 @@ gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYs
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
modernc.org/libc v1.65.0 h1:e183gLDnAp9VJh6gWKdTy0CThL9Pt7MfcR/0bgb7Y1Y= modernc.org/libc v1.74.3 h1:a4J+Z8aVaxPyjyxRAdJzw246PqpcFGvVPnfT/AuM5Ws=
modernc.org/libc v1.65.0/go.mod h1:7m9VzGq7APssBTydds2zBcxGREwvIGpuUBaKTXdm2Qs= modernc.org/libc v1.74.3/go.mod h1:4H7h/MJ8wnjL8RAbp9v3OXgnk22X7MouHIhDbvP3gj4=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.10.0 h1:fzumd51yQ1DxcOxSO+S6X7+QTuVU+n8/Aj7swYjFfC4= modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
modernc.org/memory v1.10.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
modernc.org/sqlite v1.37.0 h1:s1TMe7T3Q3ovQiK2Ouz4Jwh7dw4ZDqbebSDTlSJdfjI= modernc.org/sqlite v1.54.0 h1:JCxR4qwkJvOaqAoYcgDoO25Nc+ROg6EJ2LfBVzdrgog=
modernc.org/sqlite v1.37.0/go.mod h1:5YiWv+YviqGMuGw4V+PNplcyaJ5v+vQd7TQOgkACoJM= modernc.org/sqlite v1.54.0/go.mod h1:4ntCLuNmnH8+GNqjka1wNg7KJd5/Hi5FYp8K+XQ7GZw=
+3 -3
View File
@@ -6,6 +6,7 @@ import (
"isp-system-service/routes" "isp-system-service/routes"
"github.com/txix-open/isp-kit/bootstrap" "github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/shutdown" "github.com/txix-open/isp-kit/shutdown"
) )
@@ -22,10 +23,9 @@ var (
// @host localhost:9000 // @host localhost:9000
// @BasePath /api/system // @BasePath /api/system
//go:generate swag init --parseDependency //go:generate swag init -pd -ot json -eot json
//go:generate rm -f docs/swagger.json docs/docs.go
func main() { func main() {
boot := bootstrap.New(version, conf.Remote{}, routes.EndpointDescriptors()) boot := bootstrap.New(version, conf.Remote{}, cluster.Endpoints(routes.EndpointDescriptors()), cluster.GrpcTransport)
app := boot.App app := boot.App
logger := app.Logger() logger := app.Logger()
@@ -0,0 +1,36 @@
-- +goose Up
CREATE TABLE access_list_new
(
app_id INT,
http_method VARCHAR(255) NOT NULL DEFAULT '',
method VARCHAR(255),
value BOOLEAN NOT NULL,
PRIMARY KEY (app_id, http_method, method),
CONSTRAINT FK_app_id__application_id FOREIGN KEY (app_id) REFERENCES application (id) ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO access_list_new (app_id, method, value)
SELECT app_id, method, value
FROM access_list
WHERE value = true;
DROP TABLE access_list;
ALTER TABLE access_list_new RENAME TO access_list;
-- +goose Down
CREATE TABLE access_list_old
(
app_id INT,
method VARCHAR(255),
value BOOLEAN NOT NULL,
PRIMARY KEY (app_id, method),
CONSTRAINT FK_app_id__application_id FOREIGN KEY (app_id) REFERENCES application (id) ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO access_list_old (app_id, method, value)
SELECT app_id, method, value
FROM access_list
WHERE value = true;
DROP TABLE access_list;
ALTER TABLE access_list_old RENAME TO access_list;
@@ -0,0 +1,90 @@
-- +goose Up
ALTER TABLE application_group
DROP CONSTRAINT fk_domain_id__domain_id;
ALTER TABLE application_group
DROP CONSTRAINT uq_name_domain_name;
ALTER TABLE application_group
DROP COLUMN domain_id;
ALTER TABLE application_group
ADD CONSTRAINT uq_application_group_name UNIQUE ("name");
ALTER TABLE domain
DROP CONSTRAINT fk_system_id__system_id;
ALTER TABLE domain
DROP CONSTRAINT uq_name_system_id;
DROP TABLE domain;
DROP TABLE system;
-- +goose Down
CREATE TABLE system (
id SERIAL4 NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
created_at TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
updated_at TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
CONSTRAINT UQ_name UNIQUE (name)
);
CREATE TABLE domain (
id SERIAL4 NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
system_id INTEGER NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
updated_at TIMESTAMP NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
CONSTRAINT FK_system_id__system_id
FOREIGN KEY (system_id)
REFERENCES system (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT UQ_name_system_id UNIQUE (name, system_id)
);
-- Восстанавливаем root system/domain.
INSERT INTO system (id, name)
VALUES (1, 'rootSystem');
SELECT setval(
'system_id_seq',
GREATEST((SELECT COALESCE(MAX(id), 1) FROM system), 1)
);
INSERT INTO domain (id, name, system_id)
VALUES (1, 'root', 1);
SELECT setval(
'domain_id_seq',
GREATEST((SELECT COALESCE(MAX(id), 1) FROM domain), 1)
);
ALTER TABLE application_group
DROP CONSTRAINT uq_application_group_name;
ALTER TABLE application_group
ADD COLUMN domain_id INTEGER DEFAULT 1;
ALTER TABLE application_group
ALTER COLUMN domain_id SET NOT NULL;
ALTER TABLE application_group
ADD CONSTRAINT FK_domain_id__domain_id
FOREIGN KEY (domain_id)
REFERENCES domain (id)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE application_group
ADD CONSTRAINT UQ_name_domain_name
UNIQUE (name, domain_id);
CREATE TRIGGER modify_system
BEFORE UPDATE OR INSERT ON system
FOR EACH ROW EXECUTE PROCEDURE update_created_modified_column_date();
CREATE TRIGGER modify_domain
BEFORE UPDATE OR INSERT ON domain
FOR EACH ROW EXECUTE PROCEDURE update_created_modified_column_date();
+52 -24
View File
@@ -8,9 +8,10 @@ import (
"isp-system-service/entity" "isp-system-service/entity"
"github.com/Masterminds/squirrel" "github.com/Masterminds/squirrel"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db" "github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query" "github.com/txix-open/isp-kit/db/query"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/metrics/sql_metrics"
) )
type AccessList struct { type AccessList struct {
@@ -23,14 +24,20 @@ func NewAccessList(db db.DB) AccessList {
} }
} }
func (r AccessList) GetAccessListByAppIdAndMethod(ctx context.Context, appId int, method string) (*entity.AccessList, error) { func (r AccessList) GetAccessListByAppIdAndMethod(ctx context.Context, appId int, httpMethod string, method string) (*entity.AccessList, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.GetAccessListByAppIdAndMethod")
q := ` q := `
SELECT app_id, method, value SELECT app_id, http_method, method, value
FROM access_list FROM access_list
WHERE app_id = $1 AND method = $2 WHERE app_id = $1
` AND method = $2
AND http_method IN ($3, '')
ORDER BY (http_method = $3) DESC
LIMIT 1;
`
result := entity.AccessList{} result := entity.AccessList{}
err := r.db.SelectRow(ctx, &result, q, appId, method) err := r.db.SelectRow(ctx, &result, q, appId, method, httpMethod)
switch { switch {
case errors.Is(err, sql.ErrNoRows): case errors.Is(err, sql.ErrNoRows):
return nil, domain.ErrAccessListNotFound return nil, domain.ErrAccessListNotFound
@@ -42,11 +49,13 @@ func (r AccessList) GetAccessListByAppIdAndMethod(ctx context.Context, appId int
} }
func (r AccessList) GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) { func (r AccessList) GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.GetAccessListByAppId")
q := ` q := `
SELECT app_id, method, value SELECT app_id, http_method, method, value
FROM access_list FROM access_list
WHERE app_id = $1 WHERE app_id = $1
` `
result := make([]entity.AccessList, 0) result := make([]entity.AccessList, 0)
err := r.db.Select(ctx, &result, q, appId) err := r.db.Select(ctx, &result, q, appId)
if err != nil { if err != nil {
@@ -57,8 +66,10 @@ func (r AccessList) GetAccessListByAppId(ctx context.Context, appId int) ([]enti
} }
func (r AccessList) GetAccessListByAppIdList(ctx context.Context, appIdList []int) ([]entity.AccessList, error) { func (r AccessList) GetAccessListByAppIdList(ctx context.Context, appIdList []int) ([]entity.AccessList, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.GetAccessListByAppIdList")
q, args, err := query.New(). q, args, err := query.New().
Select("app_id", "method", "value"). Select("app_id", "http_method", "method", "value").
From("access_list"). From("access_list").
Where(squirrel.Eq{"app_id": appIdList}). Where(squirrel.Eq{"app_id": appIdList}).
ToSql() ToSql()
@@ -76,11 +87,13 @@ func (r AccessList) GetAccessListByAppIdList(ctx context.Context, appIdList []in
} }
func (r AccessList) InsertArrayAccessList(ctx context.Context, entity []entity.AccessList) error { func (r AccessList) InsertArrayAccessList(ctx context.Context, entity []entity.AccessList) error {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.InsertArrayAccessList")
qBuilder := query.New(). qBuilder := query.New().
Insert("access_list"). Insert("access_list").
Columns("app_id", "method", "value") Columns("app_id", "http_method", "method", "value")
for _, e := range entity { 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() q, args, err := qBuilder.ToSql()
if err != nil { if err != nil {
@@ -96,15 +109,17 @@ func (r AccessList) InsertArrayAccessList(ctx context.Context, entity []entity.A
} }
func (r AccessList) UpsertAccessList(ctx context.Context, e entity.AccessList) (int, error) { func (r AccessList) UpsertAccessList(ctx context.Context, e entity.AccessList) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.UpsertAccessList")
q := ` q := `
INSERT INTO access_list INSERT INTO access_list
(app_id, method, value) (app_id, http_method, method, value)
VALUES ($1, $2, $3) VALUES ($1, $2, $3, $4)
ON CONFLICT (app_id, method) ON CONFLICT (app_id, http_method, method)
DO UPDATE DO UPDATE
SET (value) = (SELECT EXCLUDED.value) 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 { if err != nil {
return 0, errors.WithMessagef(err, "exec query %s", q) return 0, errors.WithMessagef(err, "exec query %s", q)
} }
@@ -117,14 +132,25 @@ func (r AccessList) UpsertAccessList(ctx context.Context, e entity.AccessList) (
return int(rowsAffected), nil 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 := make(squirrel.Or, 0, len(methods))
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(). q, args, err := query.New().
Delete("access_list"). Delete("access_list").
Where(squirrel.Eq{ Where(squirrel.And{
"app_id": appId, squirrel.Eq{
"method": methods, "app_id": appId,
},
methodsClause,
}). }).
Suffix("RETURNING app_id, method, value").
ToSql() ToSql()
if err != nil { if err != nil {
return errors.WithMessage(err, "build query") return errors.WithMessage(err, "build query")
@@ -139,11 +165,13 @@ func (r AccessList) DeleteAccessList(ctx context.Context, appId int, methods []s
} }
func (r AccessList) DeleteAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) { func (r AccessList) DeleteAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AccessList.DeleteAccessListByAppId")
q := ` q := `
DELETE FROM access_list DELETE FROM access_list
WHERE app_id = $1 WHERE app_id = $1
RETURNING app_id, method, value RETURNING app_id, http_method, method, value
` `
result := make([]entity.AccessList, 0) result := make([]entity.AccessList, 0)
err := r.db.Select(ctx, &result, q, appId) err := r.db.Select(ctx, &result, q, appId)
if err != nil { if err != nil {
+37 -38
View File
@@ -9,9 +9,14 @@ import (
"github.com/Masterminds/squirrel" "github.com/Masterminds/squirrel"
"github.com/jackc/pgx/v5/pgconn" "github.com/jackc/pgx/v5/pgconn"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db" "github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query" "github.com/txix-open/isp-kit/db/query"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/metrics/sql_metrics"
)
const (
applicationGroupUniqueNameConstraint = "uq_application_group_name"
) )
type AppGroup struct { type AppGroup struct {
@@ -25,11 +30,13 @@ func NewAppGroup(db db.DB) AppGroup {
} }
func (r AppGroup) GetAppGroupById(ctx context.Context, id int) (*entity.AppGroup, error) { func (r AppGroup) GetAppGroupById(ctx context.Context, id int) (*entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.GetAppGroupById")
q := ` q := `
SELECT id, name, description, domain_id, created_at, updated_at SELECT id, name, description, created_at, updated_at
FROM application_group FROM application_group
WHERE id = $1 WHERE id = $1
` `
result := entity.AppGroup{} result := entity.AppGroup{}
err := r.db.SelectRow(ctx, &result, q, id) err := r.db.SelectRow(ctx, &result, q, id)
switch { switch {
@@ -43,8 +50,10 @@ func (r AppGroup) GetAppGroupById(ctx context.Context, id int) (*entity.AppGroup
} }
func (r AppGroup) GetAppGroupByIdList(ctx context.Context, idList []int) ([]entity.AppGroup, error) { func (r AppGroup) GetAppGroupByIdList(ctx context.Context, idList []int) ([]entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.GetAppGroupByIdList")
q, arg, err := query.New(). q, arg, err := query.New().
Select("id", "name", "description", "domain_id", "created_at", "updated_at"). Select("id", "name", "description", "created_at", "updated_at").
From("application_group"). From("application_group").
Where(squirrel.Eq{"id": idList}). Where(squirrel.Eq{"id": idList}).
OrderBy("created_at DESC"). OrderBy("created_at DESC").
@@ -62,34 +71,16 @@ func (r AppGroup) GetAppGroupByIdList(ctx context.Context, idList []int) ([]enti
return result, nil return result, nil
} }
func (r AppGroup) GetAppGroupByDomainId(ctx context.Context, domainIdList []int) ([]entity.AppGroup, error) { func (r AppGroup) GetAppGroupByName(ctx context.Context, name string) (*entity.AppGroup, error) {
q, arg, err := query.New(). ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.GetAppGroupByName")
Select("id", "name", "description", "domain_id", "created_at", "updated_at").
From("application_group").
Where(squirrel.Eq{"domain_id": domainIdList}).
OrderBy("created_at DESC").
ToSql()
if err != nil {
return nil, errors.WithMessage(err, "build query")
}
result := make([]entity.AppGroup, 0)
err = r.db.Select(ctx, &result, q, arg...)
if err != nil {
return nil, errors.WithMessagef(err, "exec query %s", q)
}
return result, nil
}
func (r AppGroup) GetAppGroupByNameAndDomainId(ctx context.Context, name string, domainId int) (*entity.AppGroup, error) {
q := ` q := `
SELECT id, name, description, domain_id, created_at, updated_at SELECT id, name, description, created_at, updated_at
FROM application_group FROM application_group
WHERE name = $1 AND domain_id = $2 WHERE name = $1
` `
result := entity.AppGroup{} result := entity.AppGroup{}
err := r.db.SelectRow(ctx, &result, q, name, domainId) err := r.db.SelectRow(ctx, &result, q, name)
switch { switch {
case errors.Is(err, sql.ErrNoRows): case errors.Is(err, sql.ErrNoRows):
return nil, domain.ErrAppGroupNotFound return nil, domain.ErrAppGroupNotFound
@@ -100,16 +91,18 @@ 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) { func (r AppGroup) CreateAppGroup(ctx context.Context, name string, desc string) (*entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.CreateAppGroup")
q := ` q := `
INSERT INTO application_group INSERT INTO application_group
(name, description, domain_id) (name, description)
VALUES ($1, $2, $3) VALUES ($1, $2)
ON CONFLICT (name, domain_id) DO NOTHING ON CONFLICT (name) DO NOTHING
RETURNING id, name, description, domain_id, created_at, updated_at RETURNING id, name, description, created_at, updated_at
` `
result := entity.AppGroup{} result := entity.AppGroup{}
err := r.db.SelectRow(ctx, &result, q, name, desc, domainId) err := r.db.SelectRow(ctx, &result, q, name, desc)
switch { switch {
case errors.Is(err, sql.ErrNoRows): case errors.Is(err, sql.ErrNoRows):
return nil, domain.ErrAppGroupDuplicateName return nil, domain.ErrAppGroupDuplicateName
@@ -121,12 +114,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) { func (r AppGroup) UpdateAppGroup(ctx context.Context, id int, name string, description string) (*entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.UpdateAppGroup")
q := ` q := `
UPDATE application_group UPDATE application_group
SET name = $1, description = $2 SET name = $1, description = $2
WHERE id = $3 WHERE id = $3
RETURNING id, name, description, domain_id, created_at, updated_at RETURNING id, name, description, created_at, updated_at
` `
result := entity.AppGroup{} result := entity.AppGroup{}
err := r.db.SelectRow(ctx, &result, q, name, description, id) err := r.db.SelectRow(ctx, &result, q, name, description, id)
var pgErr *pgconn.PgError var pgErr *pgconn.PgError
@@ -143,6 +138,8 @@ func (r AppGroup) UpdateAppGroup(ctx context.Context, id int, name string, descr
} }
func (r AppGroup) DeleteAppGroup(ctx context.Context, idList []int) (int, error) { func (r AppGroup) DeleteAppGroup(ctx context.Context, idList []int) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.DeleteAppGroup")
q, args, err := query.New(). q, args, err := query.New().
Delete("application_group"). Delete("application_group").
Where(squirrel.Eq{"id": idList}). Where(squirrel.Eq{"id": idList}).
@@ -165,8 +162,10 @@ func (r AppGroup) DeleteAppGroup(ctx context.Context, idList []int) (int, error)
} }
func (r AppGroup) GetAllAppGroups(ctx context.Context) ([]entity.AppGroup, error) { func (r AppGroup) GetAllAppGroups(ctx context.Context) ([]entity.AppGroup, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "AppGroup.GetAllAppGroups")
q, arg, err := query.New(). q, arg, err := query.New().
Select("id", "name", "description", "domain_id", "created_at", "updated_at"). Select("id", "name", "description", "created_at", "updated_at").
From("application_group"). From("application_group").
OrderBy("created_at DESC"). OrderBy("created_at DESC").
ToSql() ToSql()
+37 -24
View File
@@ -9,9 +9,16 @@ import (
"github.com/Masterminds/squirrel" "github.com/Masterminds/squirrel"
"github.com/jackc/pgx/v5/pgconn" "github.com/jackc/pgx/v5/pgconn"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db" "github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query" "github.com/txix-open/isp-kit/db/query"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/metrics/sql_metrics"
)
const (
applicationPkConstraintName = "application_pkey"
applicationUniqueNameConstraintName = "uq_name_application_group_id"
applicationFkAppGroupConstraintName = "fk_application_group_id"
) )
type Application struct { type Application struct {
@@ -25,11 +32,13 @@ func NewApplication(db db.DB) Application {
} }
func (r Application) GetApplicationById(ctx context.Context, id int) (*entity.Application, error) { func (r Application) GetApplicationById(ctx context.Context, id int) (*entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.GetApplicationById")
q := ` q := `
SELECT id, name, description, application_group_id, type, created_at, updated_at SELECT id, name, description, application_group_id, type, created_at, updated_at
FROM application FROM application
WHERE id = $1 WHERE id = $1
` `
result := entity.Application{} result := entity.Application{}
err := r.db.SelectRow(ctx, &result, q, id) err := r.db.SelectRow(ctx, &result, q, id)
switch { switch {
@@ -43,6 +52,8 @@ func (r Application) GetApplicationById(ctx context.Context, id int) (*entity.Ap
} }
func (r Application) GetApplicationByIdList(ctx context.Context, idList []int) ([]entity.Application, error) { func (r Application) GetApplicationByIdList(ctx context.Context, idList []int) ([]entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.GetApplicationByIdList")
q, args, err := query.New(). q, args, err := query.New().
Select("id", "name", "description", "application_group_id", "type", "created_at", "updated_at"). Select("id", "name", "description", "application_group_id", "type", "created_at", "updated_at").
From("application"). From("application").
@@ -63,6 +74,8 @@ func (r Application) GetApplicationByIdList(ctx context.Context, idList []int) (
} }
func (r Application) GetApplicationByAppGroupIdList(ctx context.Context, appGroupIdList []int) ([]entity.Application, error) { func (r Application) GetApplicationByAppGroupIdList(ctx context.Context, appGroupIdList []int) ([]entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.GetApplicationByAppGroupIdList")
q, args, err := query.New(). q, args, err := query.New().
Select("id", "name", "description", "application_group_id", "type", "created_at", "updated_at"). Select("id", "name", "description", "application_group_id", "type", "created_at", "updated_at").
From("application"). From("application").
@@ -82,32 +95,22 @@ func (r Application) GetApplicationByAppGroupIdList(ctx context.Context, appGrou
return result, nil return result, nil
} }
func (r Application) GetApplicationByNameAndAppGroupId(ctx context.Context, name string, serviceId int) (*entity.Application, error) { func (r Application) CreateApplication(
q := ` ctx context.Context,
SELECT id, name, description, application_group_id, type, created_at, updated_at id int,
FROM application name string,
WHERE name = $1 AND application_group_id = $2 desc string,
` appGroupId int,
result := entity.Application{} appType string,
err := r.db.SelectRow(ctx, &result, q, name, serviceId) ) (*entity.Application, error) {
switch { ctx = sql_metrics.OperationLabelToContext(ctx, "Application.CreateApplication")
case errors.Is(err, sql.ErrNoRows):
return nil, nil // nolint:nilnil
case err != nil:
return nil, errors.WithMessagef(err, "exec query %s", q)
default:
return &result, nil
}
}
func (r Application) CreateApplication(ctx context.Context, id int, name string, desc string, appGroupId int, appType string) (
*entity.Application, error) {
q := ` q := `
INSERT INTO application INSERT INTO application
(id, name, description, application_group_id, type) (id, name, description, application_group_id, type)
VALUES ($1, $2, $3, $4, $5) VALUES ($1, $2, $3, $4, $5)
RETURNING id, name, description, application_group_id, type, created_at, updated_at RETURNING id, name, description, application_group_id, type, created_at, updated_at
` `
result := entity.Application{} result := entity.Application{}
err := r.db.SelectRow(ctx, &result, q, id, name, desc, appGroupId, appType) err := r.db.SelectRow(ctx, &result, q, id, name, desc, appGroupId, appType)
if err != nil { if err != nil {
@@ -122,13 +125,15 @@ func (r Application) UpdateApplication(
name string, name string,
description string, description string,
) (*entity.Application, error) { ) (*entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.UpdateApplication")
q := ` q := `
UPDATE application UPDATE application
SET name = $2, SET name = $2,
description = $3 description = $3
WHERE id = $1 WHERE id = $1
RETURNING id, name, description, application_group_id, type, created_at, updated_at RETURNING id, name, description, application_group_id, type, created_at, updated_at
` `
result := entity.Application{} result := entity.Application{}
err := r.db.SelectRow(ctx, &result, q, id, name, description) err := r.db.SelectRow(ctx, &result, q, id, name, description)
if err != nil { if err != nil {
@@ -144,6 +149,8 @@ func (r Application) UpdateApplicationWithNewId(
name string, name string,
description string, description string,
) (*entity.Application, error) { ) (*entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.UpdateApplicationWithNewId")
q := ` q := `
UPDATE application UPDATE application
SET id = $2, SET id = $2,
@@ -151,7 +158,7 @@ func (r Application) UpdateApplicationWithNewId(
description = $4 description = $4
WHERE id = $1 WHERE id = $1
RETURNING id, name, description, application_group_id, type, created_at, updated_at RETURNING id, name, description, application_group_id, type, created_at, updated_at
` `
result := entity.Application{} result := entity.Application{}
err := r.db.SelectRow(ctx, &result, q, oldId, newId, name, description) err := r.db.SelectRow(ctx, &result, q, oldId, newId, name, description)
if err != nil { if err != nil {
@@ -161,6 +168,8 @@ func (r Application) UpdateApplicationWithNewId(
} }
func (r Application) DeleteApplicationByIdList(ctx context.Context, idList []int) (int, error) { func (r Application) DeleteApplicationByIdList(ctx context.Context, idList []int) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.DeleteApplicationByIdList")
q, args, err := query.New(). q, args, err := query.New().
Delete("application"). Delete("application").
Where(squirrel.Eq{"id": idList}). Where(squirrel.Eq{"id": idList}).
@@ -183,6 +192,8 @@ func (r Application) DeleteApplicationByIdList(ctx context.Context, idList []int
} }
func (r Application) NextApplicationId(ctx context.Context) (int, error) { 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;` q := `SELECT COALESCE(MAX(id)+1, 1) FROM application;`
nextAppId := 0 nextAppId := 0
err := r.db.SelectRow(ctx, &nextAppId, q) err := r.db.SelectRow(ctx, &nextAppId, q)
@@ -193,6 +204,8 @@ func (r Application) NextApplicationId(ctx context.Context) (int, error) {
} }
func (r Application) GetAllApplications(ctx context.Context) ([]entity.Application, error) { func (r Application) GetAllApplications(ctx context.Context) ([]entity.Application, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Application.GetAllApplications")
q, args, err := query.New(). q, args, err := query.New().
Select("id", "name", "description", "application_group_id", "type", "created_at", "updated_at"). Select("id", "name", "description", "application_group_id", "type", "created_at", "updated_at").
From("application"). From("application").
-9
View File
@@ -1,9 +0,0 @@
package repository
const (
applicationPkConstraintName = "application_pkey"
applicationUniqueNameConstraintName = "uq_name_application_group_id"
applicationFkAppGroupConstraintName = "fk_application_group_id"
applicationGroupUniqueNameConstraint = "uq_name_domain_name"
)
-151
View File
@@ -1,151 +0,0 @@
package repository
import (
"context"
"database/sql"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/Masterminds/squirrel"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query"
)
type Domain struct {
db db.DB
}
func NewDomain(db db.DB) Domain {
return Domain{
db: db,
}
}
func (r Domain) GetDomainById(ctx context.Context, id int) (*entity.Domain, error) {
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 {
case errors.Is(err, sql.ErrNoRows):
return nil, domain.ErrDomainNotFound
case err != nil:
return nil, errors.WithMessagef(err, "exec query %s", q)
default:
return &result, nil
}
}
func (r Domain) GetDomainByIdList(ctx context.Context, idList []int) ([]entity.Domain, error) {
q, args, err := query.New().
Select("id", "name", "description", "system_id", "created_at", "updated_at").
From("domain").
Where(squirrel.Eq{"id": idList}).
ToSql()
if err != nil {
return nil, errors.WithMessage(err, "build query")
}
result := make([]entity.Domain, 0)
err = r.db.Select(ctx, &result, q, args...)
if err != nil {
return nil, errors.WithMessage(err, "select db")
}
return result, nil
}
func (r Domain) GetDomainBySystemId(ctx context.Context, systemId int) ([]entity.Domain, error) {
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 {
return nil, errors.WithMessagef(err, "exec query %s", q)
}
return result, nil
}
func (r Domain) GetDomainByNameAndSystemId(ctx context.Context, name string, systemId int) (*entity.Domain, error) {
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 {
case errors.Is(err, sql.ErrNoRows):
return nil, domain.ErrDomainNotFound
case err != nil:
return nil, errors.WithMessagef(err, "exec query %s", q)
default:
return &result, nil
}
}
func (r Domain) CreateDomain(ctx context.Context, name string, desc string, systemId int) (*entity.Domain, error) {
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 {
return nil, errors.WithMessagef(err, "exec query %s", q)
}
return &result, nil
}
func (r Domain) UpdateDomain(ctx context.Context, id int, name string, description string) (*entity.Domain, error) {
q := `
UPDATE domain
SET name = $1, description = $2
WHERE id = $3
RETURNING id, name, description, system_id, created_at, updated_at
`
result := entity.Domain{}
err := r.db.SelectRow(ctx, &result, q, name, description, id)
switch {
case errors.Is(err, sql.ErrNoRows):
return nil, domain.ErrDomainNotFound
case err != nil:
return nil, errors.WithMessagef(err, "exec query %s", q)
default:
return &result, nil
}
}
func (r Domain) DeleteDomain(ctx context.Context, idList []int) (int, error) {
q, args, err := query.New().
Delete("domain").
Where(squirrel.Eq{"id": idList}).
ToSql()
if err != nil {
return 0, errors.WithMessagef(err, "build query")
}
result, err := r.db.Exec(ctx, q, args...)
if err != nil {
return 0, errors.WithMessagef(err, "exec query %s", q)
}
rowsAffected, err := result.RowsAffected()
if err != nil {
return 0, errors.WithMessagef(err, "get rows affected")
}
return int(rowsAffected), nil
}
+1 -1
View File
@@ -4,8 +4,8 @@ import (
"context" "context"
"hash/fnv" "hash/fnv"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db" "github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/metrics/sql_metrics" "github.com/txix-open/isp-kit/metrics/sql_metrics"
) )
+17 -10
View File
@@ -8,9 +8,10 @@ import (
"isp-system-service/entity" "isp-system-service/entity"
"github.com/Masterminds/squirrel" "github.com/Masterminds/squirrel"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/db" "github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/db/query" "github.com/txix-open/isp-kit/db/query"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/metrics/sql_metrics"
) )
type Token struct { 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) { func (r Token) SaveToken(ctx context.Context, token string, appId int, expireTime int) (*entity.Token, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.SaveToken")
q := ` q := `
INSERT INTO token INSERT INTO token
(token, app_id, expire_time) (token, app_id, expire_time)
VALUES ($1, $2, $3) VALUES ($1, $2, $3)
RETURNING token, app_id, expire_time, created_at RETURNING token, app_id, expire_time, created_at
` `
result := entity.Token{} result := entity.Token{}
err := r.db.SelectRow(ctx, &result, q, token, appId, expireTime) err := r.db.SelectRow(ctx, &result, q, token, appId, expireTime)
if err != nil { 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) { func (r Token) GetTokenById(ctx context.Context, token string) (*entity.Token, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.GetTokenById")
q := ` q := `
SELECT token, app_id, expire_time, created_at SELECT token, app_id, expire_time, created_at
FROM token FROM token
WHERE token = $1 WHERE token = $1
` `
result := entity.Token{} result := entity.Token{}
err := r.db.SelectRow(ctx, &result, q, token) err := r.db.SelectRow(ctx, &result, q, token)
switch { 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) { func (r Token) GetTokenByAppIdList(ctx context.Context, appIdList []int) ([]entity.Token, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.GetTokenByAppIdList")
q, args, err := query.New(). q, args, err := query.New().
Select("token", "app_id", "expire_time", "created_at"). Select("token", "app_id", "expire_time", "created_at").
From("token"). 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) { func (r Token) DeleteToken(ctx context.Context, tokens []string) (int, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.DeleteToken")
q, args, err := query.New(). q, args, err := query.New().
Delete("token"). Delete("token").
Where(squirrel.Eq{"token": tokens}). Where(squirrel.Eq{"token": tokens}).
@@ -100,15 +109,13 @@ func (r Token) DeleteToken(ctx context.Context, tokens []string) (int, error) {
} }
func (r Token) AuthDataByToken(ctx context.Context, token string) (*entity.AuthData, error) { func (r Token) AuthDataByToken(ctx context.Context, token string) (*entity.AuthData, error) {
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.AuthDataByToken")
q := ` q := `
SELECT system_id, domain_id, application_group_id, app_id, token.expire_time, token.created_at SELECT app_id, application.name AS app_name , token.expire_time, token.created_at
FROM token FROM token
LEFT JOIN application LEFT JOIN application
ON token.app_id = application.id ON token.app_id = application.id
LEFT JOIN application_group
ON application.application_group_id = application_group.id
LEFT JOIN domain
ON application_group.domain_id = domain.id
WHERE token = $1 WHERE token = $1
` `
result := entity.AuthData{} result := entity.AuthData{}
+40 -67
View File
@@ -2,16 +2,16 @@ package routes
import ( import (
"isp-system-service/controller" "isp-system-service/controller"
"isp-system-service/docs"
"github.com/txix-open/isp-kit/cluster" "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"
"github.com/txix-open/isp-kit/grpc/endpoint" "github.com/txix-open/isp-kit/grpc/endpoint"
) )
type Controllers struct { type Controllers struct {
AccessList controller.AccessList AccessList controller.AccessList
Domain controller.Domain
Service controller.Service
Application controller.Application Application controller.Application
AppGroup controller.AppGroup AppGroup controller.AppGroup
Token controller.Token Token controller.Token
@@ -31,14 +31,13 @@ func Handler(wrapper endpoint.Wrapper, c Controllers) *grpc.Mux {
} }
func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor { func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor {
return concatCluster( return concatEndpoints(
secureCluster(c), secureCluster(c),
accessListCluster(c), accessListCluster(c),
domainCluster(c),
serviceCluster(c),
applicationCluster(c), applicationCluster(c),
tokenCluster(c), tokenCluster(c),
applicationGroupCluster(c), applicationGroupCluster(c),
commonEndpoints(),
) )
} }
@@ -62,78 +61,32 @@ func accessListCluster(c Controllers) []cluster.EndpointDescriptor {
{ {
Path: "system/access_list/get_by_id", Path: "system/access_list/get_by_id",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("app_access_view"),
Handler: c.AccessList.GetById, Handler: c.AccessList.GetById,
}, },
{ {
Path: "system/access_list/set_one", Path: "system/access_list/set_one",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("app_access_edit"),
Handler: c.AccessList.SetOne, Handler: c.AccessList.SetOne,
}, },
{ {
Path: "system/access_list/set_list", Path: "system/access_list/set_list",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("app_access_edit"),
Handler: c.AccessList.SetList, Handler: c.AccessList.SetList,
}, },
{ {
Path: "system/access_list/delete_list", Path: "system/access_list/delete_list",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("app_access_edit"),
Handler: c.AccessList.DeleteList, Handler: c.AccessList.DeleteList,
}, },
}
}
func domainCluster(c Controllers) []cluster.EndpointDescriptor {
return []cluster.EndpointDescriptor{
{ {
Path: "system/domain/get_domains_by_system_id", Path: "system/access_list/delete_list_with_methods",
Inner: true, Inner: true,
Handler: c.Domain.GetBySystemId, Extra: cluster.RequireAdminPermission("app_access_edit"),
}, Handler: c.AccessList.DeleteListWithMethods,
{
Path: "system/domain/create_update_domain",
Inner: true,
Handler: c.Domain.CreateUpdate,
},
{
Path: "system/domain/get_domain_by_id",
Inner: true,
Handler: c.Domain.GetById,
},
{
Path: "system/domain/delete_domains",
Inner: true,
Handler: c.Domain.Delete,
},
}
}
// deprecated
func serviceCluster(c Controllers) []cluster.EndpointDescriptor {
return []cluster.EndpointDescriptor{
{
Path: "system/service/get_service",
Inner: true,
Handler: c.Service.Get,
},
{
Path: "system/service/get_services_by_domain_id",
Inner: true,
Handler: c.Service.GetByDomainId,
},
{
Path: "system/service/create_update_service",
Inner: true,
Handler: c.Service.CreateUpdate,
},
{
Path: "system/service/get_service_by_id",
Inner: true,
Handler: c.Service.GetById,
},
{
Path: "system/service/delete_service",
Inner: true,
Handler: c.Service.Delete,
}, },
} }
} }
@@ -143,38 +96,39 @@ func applicationCluster(c Controllers) []cluster.EndpointDescriptor {
{ {
Path: "system/application/get_applications", Path: "system/application/get_applications",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_view"),
Handler: c.Application.GetByIdList, Handler: c.Application.GetByIdList,
}, },
{ {
Path: "system/application/get_applications_by_service_id", Path: "system/application/get_by_app_group",
Extra: cluster.RequireAdminPermission("application_group_view"),
Inner: true, Inner: true,
Handler: c.Application.GetByServiceId, Handler: c.Application.GetByAppGroup,
}, },
{ {
Path: "system/application/create_update_application", Path: "system/application/create_update_application",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_app_edit"),
Handler: c.Application.CreateUpdate, Handler: c.Application.CreateUpdate,
}, },
{ {
Path: "system/application/get_application_by_id", Path: "system/application/get_application_by_id",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_view"),
Handler: c.Application.GetById, Handler: c.Application.GetById,
}, },
{ {
Path: "system/application/get_application_by_token", Path: "system/application/get_application_by_token",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_view"),
Handler: c.Application.GetByToken, Handler: c.Application.GetByToken,
}, },
{ {
Path: "system/application/delete_applications", Path: "system/application/delete_applications",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_app_delete"),
Handler: c.Application.Delete, Handler: c.Application.Delete,
}, },
{
Path: "system/application/get_system_tree",
Inner: true,
Handler: c.Application.GetSystemTree,
},
{ {
Path: "system/application/next_id", Path: "system/application/next_id",
Inner: true, Inner: true,
@@ -183,15 +137,18 @@ func applicationCluster(c Controllers) []cluster.EndpointDescriptor {
{ {
Path: "system/application/get_all", Path: "system/application/get_all",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_view"),
Handler: c.Application.GetAll, Handler: c.Application.GetAll,
}, },
{ {
Path: "system/application/create_application", Path: "system/application/create_application",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_app_add"),
Handler: c.Application.Create, Handler: c.Application.Create,
}, { }, {
Path: "system/application/update_application", Path: "system/application/update_application",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_app_edit"),
Handler: c.Application.Update, Handler: c.Application.Update,
}, },
} }
@@ -202,21 +159,25 @@ func tokenCluster(c Controllers) []cluster.EndpointDescriptor {
{ {
Path: "system/token/create_token", Path: "system/token/create_token",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_token_add"),
Handler: c.Token.Create, Handler: c.Token.Create,
}, },
{ {
Path: "system/token/revoke_tokens", Path: "system/token/revoke_tokens",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_token_delete"),
Handler: c.Token.Revoke, Handler: c.Token.Revoke,
}, },
{ {
Path: "system/token/revoke_tokens_for_app", Path: "system/token/revoke_tokens_for_app",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_token_delete"),
Handler: c.Token.RevokeForApp, Handler: c.Token.RevokeForApp,
}, },
{ {
Path: "system/token/get_tokens_by_app_id", Path: "system/token/get_tokens_by_app_id",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_token_view"),
Handler: c.Token.GetByAppId, Handler: c.Token.GetByAppId,
}, },
} }
@@ -227,30 +188,42 @@ func applicationGroupCluster(c Controllers) []cluster.EndpointDescriptor {
{ {
Path: "system/application_group/create", Path: "system/application_group/create",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_add"),
Handler: c.AppGroup.Create, Handler: c.AppGroup.Create,
}, { }, {
Path: "system/application_group/update", Path: "system/application_group/update",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_edit"),
Handler: c.AppGroup.Update, Handler: c.AppGroup.Update,
}, { }, {
Path: "system/application_group/delete_list", Path: "system/application_group/delete_list",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_delete"),
Handler: c.AppGroup.DeleteList, Handler: c.AppGroup.DeleteList,
}, { }, {
Path: "system/application_group/get_by_id_list", Path: "system/application_group/get_by_id_list",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_view"),
Handler: c.AppGroup.GetByIdList, Handler: c.AppGroup.GetByIdList,
}, { }, {
Path: "system/application_group/get_all", Path: "system/application_group/get_all",
Inner: true, Inner: true,
Extra: cluster.RequireAdminPermission("application_group_view"),
Handler: c.AppGroup.GetAll, Handler: c.AppGroup.GetAll,
}, },
} }
} }
func concatCluster(clusters ...[]cluster.EndpointDescriptor) []cluster.EndpointDescriptor { func commonEndpoints() []cluster.EndpointDescriptor {
return common_endpoints.CommonEndpoints(
"system",
common_endpoints.WithSwaggerEndpoint(docs.SwaggerJson),
)
}
func concatEndpoints(endpoints ...[]cluster.EndpointDescriptor) []cluster.EndpointDescriptor {
var result []cluster.EndpointDescriptor var result []cluster.EndpointDescriptor
for _, c := range clusters { for _, c := range endpoints {
result = append(result, c...) result = append(result, c...)
} }
return result return result
+39 -16
View File
@@ -6,12 +6,12 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"isp-system-service/entity" "isp-system-service/entity"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
) )
type AccessListRepo interface { type AccessListRepo interface {
GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) 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 { type AccessListSetOneTx interface {
@@ -21,7 +21,7 @@ type AccessListSetOneTx interface {
type AccessListSetListTx interface { type AccessListSetListTx interface {
GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error)
InsertArrayAccessList(ctx context.Context, entity []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) DeleteAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error)
} }
@@ -62,8 +62,9 @@ func (s AccessList) GetById(ctx context.Context, appId int) ([]domain.MethodInfo
methodInfos := make([]domain.MethodInfo, len(accessList)) methodInfos := make([]domain.MethodInfo, len(accessList))
for i, access := range accessList { for i, access := range accessList {
methodInfos[i] = domain.MethodInfo{ methodInfos[i] = domain.MethodInfo{
Method: access.Method, HttpMethod: access.HttpMethod,
Value: access.Value, Method: access.Method,
Value: access.Value,
} }
} }
@@ -79,9 +80,10 @@ func (s AccessList) SetOne(ctx context.Context, request domain.AccessListSetOneR
var resp int var resp int
err = s.tx.AccessListSetOneTx(ctx, func(ctx context.Context, tx AccessListSetOneTx) error { err = s.tx.AccessListSetOneTx(ctx, func(ctx context.Context, tx AccessListSetOneTx) error {
resp, err = tx.UpsertAccessList(ctx, entity.AccessList{ resp, err = tx.UpsertAccessList(ctx, entity.AccessList{
AppId: request.AppId, AppId: request.AppId,
Method: request.Method, HttpMethod: request.HttpMethod,
Value: request.Value, Method: request.Method,
Value: request.Value,
}) })
if err != nil { if err != nil {
return errors.WithMessage(err, "upsert access list") return errors.WithMessage(err, "upsert access list")
@@ -113,13 +115,17 @@ func (s AccessList) SetList(ctx context.Context, req domain.AccessListSetListReq
} }
newAccessList := make([]entity.AccessList, len(req.Methods)) 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 { for i, m := range req.Methods {
updateMethods[i] = m.Method updateMethods[i] = entity.Method{
HttpMethod: m.HttpMethod,
Method: m.Method,
}
newAccessList[i] = entity.AccessList{ newAccessList[i] = entity.AccessList{
AppId: req.AppId, AppId: req.AppId,
Method: m.Method, HttpMethod: m.HttpMethod,
Value: m.Value, Method: m.Method,
Value: m.Value,
} }
} }
@@ -149,8 +155,9 @@ func (s AccessList) SetList(ctx context.Context, req domain.AccessListSetListReq
methodInfos := make([]domain.MethodInfo, len(accessList)) methodInfos := make([]domain.MethodInfo, len(accessList))
for i, access := range accessList { for i, access := range accessList {
methodInfos[i] = domain.MethodInfo{ methodInfos[i] = domain.MethodInfo{
Method: access.Method, HttpMethod: access.HttpMethod,
Value: access.Value, Method: access.Method,
Value: access.Value,
} }
} }
@@ -158,11 +165,27 @@ func (s AccessList) SetList(ctx context.Context, req domain.AccessListSetListReq
} }
func (s AccessList) DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error { 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) _, err := s.appRepo.GetApplicationById(ctx, req.AppId)
if err != nil { if err != nil {
return errors.WithMessage(err, "get application by id") 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 { if err != nil {
return errors.WithMessage(err, "delete access_list") return errors.WithMessage(err, "delete access_list")
} }
+2 -2
View File
@@ -5,7 +5,7 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"isp-system-service/entity" "isp-system-service/entity"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
) )
type AppGroup struct { type AppGroup struct {
@@ -19,7 +19,7 @@ func NewAppGroup(repo AppGroupRepo) AppGroup {
} }
func (s AppGroup) Create(ctx context.Context, req domain.CreateAppGroupRequest) (*domain.AppGroup, error) { func (s AppGroup) Create(ctx context.Context, req domain.CreateAppGroupRequest) (*domain.AppGroup, error) {
appGroup, err := s.repo.CreateAppGroup(ctx, req.Name, req.Description, 1) appGroup, err := s.repo.CreateAppGroup(ctx, req.Name, req.Description)
if err != nil { if err != nil {
return nil, errors.WithMessage(err, "create appGroup") return nil, errors.WithMessage(err, "create appGroup")
} }
+48 -138
View File
@@ -6,7 +6,7 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"isp-system-service/entity" "isp-system-service/entity"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
) )
type ApplicationDeleteTx interface { type ApplicationDeleteTx interface {
@@ -20,7 +20,6 @@ type ApplicationTxRunner interface {
type Application struct { type Application struct {
txRunner ApplicationTxRunner txRunner ApplicationTxRunner
appRepo ApplicationRepo appRepo ApplicationRepo
domainRepo DomainRepo
serviceRepo AppGroupRepo serviceRepo AppGroupRepo
tokenRepo TokenRepo tokenRepo TokenRepo
} }
@@ -28,31 +27,24 @@ type Application struct {
func NewApplication( func NewApplication(
txRunner ApplicationTxRunner, txRunner ApplicationTxRunner,
applicationRepo ApplicationRepo, applicationRepo ApplicationRepo,
domainRepo DomainRepo,
appGroupRepo AppGroupRepo, appGroupRepo AppGroupRepo,
tokenRepo TokenRepo, tokenRepo TokenRepo,
) Application { ) Application {
return Application{ return Application{
txRunner: txRunner, txRunner: txRunner,
appRepo: applicationRepo, appRepo: applicationRepo,
domainRepo: domainRepo,
serviceRepo: appGroupRepo, serviceRepo: appGroupRepo,
tokenRepo: tokenRepo, tokenRepo: tokenRepo,
} }
} }
func (s Application) GetById(ctx context.Context, appId int) (*domain.ApplicationWithTokens, error) { func (s Application) GetById(ctx context.Context, appId int) (*domain.Application, error) {
application, err := s.appRepo.GetApplicationById(ctx, appId) app, err := s.appRepo.GetApplicationById(ctx, appId)
if err != nil { if err != nil {
return nil, errors.WithMessage(err, "get application by id") return nil, errors.WithMessage(err, "get application by id")
} }
arr, err := s.EnrichWithTokens(ctx, []entity.Application{*application}) return new(s.convertApplication(*app)), nil
if err != nil {
return nil, errors.WithMessage(err, "enrich application with tokens")
}
return arr[0], nil
} }
func (s Application) GetByToken(ctx context.Context, tokenStr string) (*domain.GetApplicationByTokenResponse, error) { func (s Application) GetByToken(ctx context.Context, tokenStr string) (*domain.GetApplicationByTokenResponse, error) {
@@ -74,127 +66,53 @@ func (s Application) GetByToken(ctx context.Context, tokenStr string) (*domain.G
}, nil }, nil
} }
func (s Application) GetByIdList(ctx context.Context, idList []int) ([]*domain.ApplicationWithTokens, error) { func (s Application) GetByIdList(ctx context.Context, idList []int) ([]domain.Application, error) {
res, err := s.appRepo.GetApplicationByIdList(ctx, idList) apps, err := s.appRepo.GetApplicationByIdList(ctx, idList)
if err != nil { if err != nil {
return nil, errors.WithMessage(err, "get application by id list") return nil, errors.WithMessage(err, "get application by id list")
} }
return s.EnrichWithTokens(ctx, res) result := make([]domain.Application, len(apps))
} for i, a := range apps {
result[i] = s.convertApplication(a)
func (s Application) GetByServiceId(ctx context.Context, id int) ([]*domain.ApplicationWithTokens, error) {
arr, err := s.appRepo.GetApplicationByAppGroupIdList(ctx, []int{id})
if err != nil {
return nil, errors.WithMessage(err, "get application by app_group_id")
} }
return s.EnrichWithTokens(ctx, arr)
}
func (s Application) SystemTree(ctx context.Context, systemId int) ([]*domain.DomainWithService, error) {
domainEntityList, err := s.domainRepo.GetDomainBySystemId(ctx, systemId)
if err != nil {
return nil, errors.WithMessage(err, "get domains by system_id")
}
if len(domainEntityList) == 0 {
return []*domain.DomainWithService{}, nil
}
result := make([]*domain.DomainWithService, len(domainEntityList))
resultByDomainId := make(map[int]*domain.DomainWithService, len(domainEntityList))
domainIdList := make([]int, len(domainEntityList))
for i, domainEntity := range domainEntityList {
domainIdList[i] = domainEntity.Id
description := ""
if domainEntity.Description != nil {
description = *domainEntity.Description
}
r := &domain.DomainWithService{
Id: domainEntity.Id,
Name: domainEntity.Name,
Description: description,
Services: make([]*domain.ServiceWithApps, 0),
}
resultByDomainId[domainEntity.Id] = r
result[i] = r
}
serviceEntityList, err := s.serviceRepo.GetAppGroupByDomainId(ctx, domainIdList)
if err != nil {
return nil, errors.WithMessage(err, "get service by domain_id")
}
serviceIdList := make([]int, len(serviceEntityList))
resultServiceByServiceId := make(map[int]*domain.ServiceWithApps, len(serviceEntityList))
for i, serviceEntity := range serviceEntityList {
serviceIdList[i] = serviceEntity.Id
resultService := &domain.ServiceWithApps{
Id: serviceEntity.Id,
Name: serviceEntity.Name,
Description: serviceEntity.Description.String,
Apps: make([]*domain.ApplicationSimple, 0),
}
r := resultByDomainId[serviceEntity.DomainId]
r.Services = append(r.Services, resultService)
resultServiceByServiceId[serviceEntity.Id] = resultService
}
applicationEntityList, err := s.appRepo.GetApplicationByAppGroupIdList(ctx, serviceIdList)
if err != nil {
return nil, errors.WithMessage(err, "get application by service_id")
}
for _, applicationEntity := range applicationEntityList {
resultService := resultServiceByServiceId[applicationEntity.ApplicationGroupId]
resultService.Apps = append(resultService.Apps, &domain.ApplicationSimple{
Id: applicationEntity.Id,
Name: applicationEntity.Name,
Type: applicationEntity.Type,
Description: applicationEntity.Description.String,
Tokens: make([]domain.Token, 0),
})
}
return result, nil return result, nil
} }
func (s Application) CreateUpdate(ctx context.Context, req domain.ApplicationCreateUpdateRequest) (*domain.ApplicationWithTokens, error) { func (s Application) GetByAppGroup(ctx context.Context, appGroupId int) ([]domain.Application, error) {
if req.Id == 0 { apps, err := s.appRepo.GetApplicationByAppGroupIdList(ctx, []int{appGroupId})
_, err := s.appRepo.GetApplicationByNameAndAppGroupId(ctx, req.Name, req.ServiceId)
if err != nil {
return nil, errors.WithMessage(err, "get application by name and service_id")
}
appId, err := s.appRepo.NextApplicationId(ctx)
if err != nil {
return nil, errors.WithMessage(err, "next app id")
}
app, err := s.appRepo.CreateApplication(ctx, appId, req.Name, req.Description, req.ServiceId, req.Type)
if err != nil {
return nil, errors.WithMessage(err, "create application")
}
result, err := s.EnrichWithTokens(ctx, []entity.Application{*app})
if err != nil {
return nil, errors.WithMessage(err, "enrich application with tokens")
}
return result[0], nil
}
app, err := s.appRepo.UpdateApplication(ctx, req.Id, req.Name, req.Description)
if err != nil { if err != nil {
return nil, errors.WithMessage(err, "update application") return nil, errors.WithMessage(err, "get apps by app group ids")
} }
result, err := s.EnrichWithTokens(ctx, []entity.Application{*app}) result := make([]domain.Application, len(apps))
for i, a := range apps {
result[i] = s.convertApplication(a)
}
return result, nil
}
func (s Application) CreateUpdate(ctx context.Context, req domain.ApplicationCreateUpdateRequest) (*domain.Application, error) {
if req.Id != 0 {
app, err := s.appRepo.UpdateApplication(ctx, req.Id, req.Name, req.Description)
if err != nil {
return nil, errors.WithMessage(err, "update application")
}
return new(s.convertApplication(*app)), nil
}
appId, err := s.appRepo.NextApplicationId(ctx)
if err != nil { if err != nil {
return nil, errors.WithMessage(err, "enrich application with tokens") return nil, errors.WithMessage(err, "next app id")
} }
return result[0], nil app, err := s.appRepo.CreateApplication(ctx, appId, req.Name, req.Description, req.ApplicationGroupId, req.Type)
if err != nil {
return nil, errors.WithMessage(err, "create application")
}
return new(s.convertApplication(*app)), nil
} }
func (s Application) Delete(ctx context.Context, idList []int) (int, error) { func (s Application) Delete(ctx context.Context, idList []int) (int, error) {
@@ -267,40 +185,32 @@ func (s Application) GetAll(ctx context.Context) ([]domain.Application, error) {
return result, nil return result, nil
} }
func (s Application) Create(ctx context.Context, req domain.CreateApplicationRequest) (*domain.ApplicationWithTokens, error) { func (s Application) Create(ctx context.Context, req domain.CreateApplicationRequest) (*domain.Application, error) {
app, err := s.appRepo.CreateApplication(ctx, req.Id, req.Name, req.Description, req.ApplicationGroupId, req.Type) app, err := s.appRepo.CreateApplication(ctx, req.Id, req.Name, req.Description, req.ApplicationGroupId, req.Type)
if err != nil { if err != nil {
return nil, errors.WithMessage(err, "create application") return nil, errors.WithMessage(err, "create application")
} }
return &domain.ApplicationWithTokens{ return new(s.convertApplication(*app)), nil
App: s.convertApplication(*app),
Tokens: make([]domain.Token, 0),
}, nil
} }
func (s Application) Update(ctx context.Context, req domain.UpdateApplicationRequest) (*domain.ApplicationWithTokens, error) { func (s Application) Update(ctx context.Context, req domain.UpdateApplicationRequest) (*domain.Application, error) {
app, err := s.appRepo.UpdateApplicationWithNewId(ctx, req.OldId, req.NewId, req.Name, req.Description) app, err := s.appRepo.UpdateApplicationWithNewId(ctx, req.OldId, req.NewId, req.Name, req.Description)
if err != nil { if err != nil {
return nil, errors.WithMessage(err, "update application") return nil, errors.WithMessage(err, "update application")
} }
result, err := s.EnrichWithTokens(ctx, []entity.Application{*app}) return new(s.convertApplication(*app)), nil
if err != nil {
return nil, errors.WithMessage(err, "enrich application with tokens")
}
return result[0], nil
} }
func (s Application) convertApplication(req entity.Application) domain.Application { func (s Application) convertApplication(req entity.Application) domain.Application {
return domain.Application{ return domain.Application{
Id: req.Id, Id: req.Id,
Name: req.Name, Name: req.Name,
Description: req.Description.String, Description: req.Description.String,
ServiceId: req.ApplicationGroupId, ApplicationGroupId: req.ApplicationGroupId,
Type: req.Type, Type: req.Type,
CreatedAt: req.CreatedAt, CreatedAt: req.CreatedAt,
UpdatedAt: req.UpdatedAt, UpdatedAt: req.UpdatedAt,
} }
} }
+3 -9
View File
@@ -5,15 +5,14 @@ import (
"isp-system-service/conf" "isp-system-service/conf"
"isp-system-service/entity" "isp-system-service/entity"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/log" "github.com/txix-open/isp-kit/log"
) )
const adminAppId = 1 const adminAppId = 1
type Transaction interface { type Transaction interface {
CreateDomain(ctx context.Context, name string, desc string, systemId int) (*entity.Domain, error) CreateAppGroup(ctx context.Context, name string, desc string) (*entity.AppGroup, error)
CreateAppGroup(ctx context.Context, name string, desc string, domainId int) (*entity.AppGroup, error)
CreateApplication(ctx context.Context, id int, name string, desc string, appGroupId int, appType string) (*entity.Application, error) CreateApplication(ctx context.Context, id int, name string, desc string, appGroupId int, appType string) (*entity.Application, error)
UpsertAccessList(ctx context.Context, e entity.AccessList) (int, error) UpsertAccessList(ctx context.Context, e entity.AccessList) (int, error)
SaveToken(ctx context.Context, token string, appId int, expireTime int) (*entity.Token, error) SaveToken(ctx context.Context, token string, appId int, expireTime int) (*entity.Token, error)
@@ -75,12 +74,7 @@ func (s Service) transaction(ctx context.Context, tx Transaction) error {
s.logger.Info(ctx, "initial admin ui token is empty, run baseline") s.logger.Info(ctx, "initial admin ui token is empty, run baseline")
domain, err := tx.CreateDomain(ctx, "root", "", 1) service, err := tx.CreateAppGroup(ctx, "rootService", "")
if err != nil {
return errors.WithMessage(err, "create domain")
}
service, err := tx.CreateAppGroup(ctx, "rootService", "", domain.Id)
if err != nil { if err != nil {
return errors.WithMessage(err, "create service") return errors.WithMessage(err, "create service")
} }
-109
View File
@@ -1,109 +0,0 @@
package service
import (
"context"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/pkg/errors"
)
type Domain struct {
repo DomainRepo
}
func NewDomain(repo DomainRepo) Domain {
return Domain{
repo: repo,
}
}
func (s Domain) GetById(ctx context.Context, id int) (*domain.Domain, error) {
domainEntity, err := s.repo.GetDomainById(ctx, id)
if err != nil {
return nil, errors.WithMessage(err, "get domain by id")
}
result := s.convertDomain(*domainEntity)
return &result, nil
}
func (s Domain) GetBySystemId(ctx context.Context, systemId int) ([]domain.Domain, error) {
domainEntity, err := s.repo.GetDomainBySystemId(ctx, systemId)
if err != nil {
return nil, errors.WithMessage(err, "get domain by system_id")
}
result := make([]domain.Domain, len(domainEntity))
for i := range domainEntity {
result[i] = s.convertDomain(domainEntity[i])
}
return result, nil
}
func (s Domain) CreateUpdate(ctx context.Context, req domain.DomainCreateUpdateRequest, systemId int) (*domain.Domain, error) {
existed, err := s.repo.GetDomainByNameAndSystemId(ctx, req.Name, systemId)
switch {
case errors.Is(err, domain.ErrDomainNotFound):
case err != nil:
return nil, errors.WithMessage(err, "get domain by name and system_id")
}
if req.Id == 0 {
if existed != nil {
return nil, domain.ErrDomainDuplicateName
}
domainEntity, err := s.repo.CreateDomain(ctx, req.Name, req.Description, systemId)
if err != nil {
return nil, errors.WithMessage(err, "create domain")
}
result := s.convertDomain(*domainEntity)
return &result, nil
}
if existed != nil && existed.Id != req.Id {
return nil, domain.ErrDomainDuplicateName
}
_, err = s.repo.GetDomainById(ctx, req.Id)
if err != nil {
return nil, errors.WithMessage(err, "get domain by id")
}
domainEntity, err := s.repo.UpdateDomain(ctx, req.Id, req.Name, req.Description)
if err != nil {
return nil, errors.WithMessage(err, "update domain")
}
result := s.convertDomain(*domainEntity)
return &result, nil
}
func (s Domain) Delete(ctx context.Context, idList []int) (int, error) {
result, err := s.repo.DeleteDomain(ctx, idList)
if err != nil {
return 0, errors.WithMessage(err, "delete domain")
}
return result, nil
}
func (s Domain) convertDomain(req entity.Domain) domain.Domain {
desc := ""
if req.Description != nil {
desc = *req.Description
}
result := domain.Domain{
Id: req.Id,
Name: req.Name,
Description: desc,
SystemId: req.SystemId,
CreatedAt: req.CreatedAt,
UpdatedAt: req.UpdatedAt,
}
return result
}
+2 -13
View File
@@ -10,20 +10,10 @@ type TokenRepo interface {
GetTokenById(ctx context.Context, token string) (*entity.Token, error) GetTokenById(ctx context.Context, token string) (*entity.Token, error)
} }
type DomainRepo interface {
GetDomainById(ctx context.Context, id int) (*entity.Domain, error)
GetDomainBySystemId(ctx context.Context, systemId int) ([]entity.Domain, error)
GetDomainByNameAndSystemId(ctx context.Context, name string, systemId int) (*entity.Domain, error)
CreateDomain(ctx context.Context, name string, desc string, systemId int) (*entity.Domain, error)
UpdateDomain(ctx context.Context, id int, name string, description string) (*entity.Domain, error)
DeleteDomain(ctx context.Context, idList []int) (int, error)
}
type ApplicationRepo interface { type ApplicationRepo interface {
GetApplicationById(ctx context.Context, id int) (*entity.Application, error) GetApplicationById(ctx context.Context, id int) (*entity.Application, error)
GetApplicationByIdList(ctx context.Context, idList []int) ([]entity.Application, error) GetApplicationByIdList(ctx context.Context, idList []int) ([]entity.Application, error)
GetApplicationByAppGroupIdList(ctx context.Context, appGroupIdList []int) ([]entity.Application, error) GetApplicationByAppGroupIdList(ctx context.Context, appGroupIdList []int) ([]entity.Application, error)
GetApplicationByNameAndAppGroupId(ctx context.Context, name string, appGroupId int) (*entity.Application, error)
CreateApplication(ctx context.Context, id int, name string, desc string, appGroupId int, appType string) (*entity.Application, error) CreateApplication(ctx context.Context, id int, name string, desc string, appGroupId int, appType string) (*entity.Application, error)
UpdateApplication(ctx context.Context, id int, name string, description string) (*entity.Application, error) UpdateApplication(ctx context.Context, id int, name string, description string) (*entity.Application, error)
UpdateApplicationWithNewId(ctx context.Context, oldId int, newId int, name string, description string) (*entity.Application, error) UpdateApplicationWithNewId(ctx context.Context, oldId int, newId int, name string, description string) (*entity.Application, error)
@@ -34,10 +24,9 @@ type ApplicationRepo interface {
type AppGroupRepo interface { type AppGroupRepo interface {
GetAppGroupById(ctx context.Context, id int) (*entity.AppGroup, error) GetAppGroupById(ctx context.Context, id int) (*entity.AppGroup, error)
GetAppGroupByIdList(ctx context.Context, idList []int) ([]entity.AppGroup, error) GetAppGroupByIdList(ctx context.Context, idList []int) ([]entity.AppGroup, error)
GetAppGroupByDomainId(ctx context.Context, domainIdList []int) ([]entity.AppGroup, error)
GetAllAppGroups(ctx context.Context) ([]entity.AppGroup, error) GetAllAppGroups(ctx context.Context) ([]entity.AppGroup, error)
GetAppGroupByNameAndDomainId(ctx context.Context, name string, domainId int) (*entity.AppGroup, error) GetAppGroupByName(ctx context.Context, name string) (*entity.AppGroup, error)
CreateAppGroup(ctx context.Context, name string, desc string, domainId int) (*entity.AppGroup, error) CreateAppGroup(ctx context.Context, name string, desc string) (*entity.AppGroup, error)
UpdateAppGroup(ctx context.Context, id int, name string, description string) (*entity.AppGroup, error) UpdateAppGroup(ctx context.Context, id int, name string, description string) (*entity.AppGroup, error)
DeleteAppGroup(ctx context.Context, idList []int) (int, error) DeleteAppGroup(ctx context.Context, idList []int) (int, error)
} }
+10 -7
View File
@@ -7,7 +7,7 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"isp-system-service/entity" "isp-system-service/entity"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
) )
type TokenRep interface { type TokenRep interface {
@@ -15,7 +15,7 @@ type TokenRep interface {
} }
type AccessListRep 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 { type Service struct {
@@ -45,15 +45,18 @@ func (s Service) Authenticate(ctx context.Context, token string) (*domain.AuthDa
} }
return &domain.AuthData{ return &domain.AuthData{
SystemId: authData.SystemId, AppName: authData.AppName,
DomainId: authData.DomainId,
ServiceId: authData.ApplicationGroupId,
ApplicationId: authData.AppId, ApplicationId: authData.AppId,
}, nil }, nil
} }
func (s Service) Authorize(ctx context.Context, appId int, endpoint string) (bool, error) { func (s Service) Authorize(ctx context.Context, req domain.AuthorizeRequest) (bool, error) {
accessList, err := s.accessListRep.GetAccessListByAppIdAndMethod(ctx, appId, endpoint) accessList, err := s.accessListRep.GetAccessListByAppIdAndMethod(
ctx,
req.ApplicationId,
req.HttpMethod,
req.Endpoint,
)
if err != nil { if err != nil {
return false, errors.WithMessage(err, "get access list by app_id and method") return false, errors.WithMessage(err, "get access list by app_id and method")
} }
-115
View File
@@ -1,115 +0,0 @@
package service
import (
"context"
"isp-system-service/domain"
"isp-system-service/entity"
"github.com/pkg/errors"
)
type Service struct {
domainRepo DomainRepo
serviceRepo AppGroupRepo
}
func NewService(
domainRepo DomainRepo,
serviceRepo AppGroupRepo,
) Service {
return Service{
domainRepo: domainRepo,
serviceRepo: serviceRepo,
}
}
func (s Service) GetById(ctx context.Context, id int) (*domain.Service, error) {
serviceEntity, err := s.serviceRepo.GetAppGroupById(ctx, id)
if err != nil {
return nil, errors.WithMessage(err, "get service by id")
}
result := s.convertService(*serviceEntity)
return &result, nil
}
func (s Service) GetByIdList(ctx context.Context, idList []int) ([]domain.Service, error) {
serviceEntity, err := s.serviceRepo.GetAppGroupByIdList(ctx, idList)
if err != nil {
return nil, errors.WithMessage(err, "get system by id list")
}
result := make([]domain.Service, len(serviceEntity))
for i := range serviceEntity {
result[i] = s.convertService(serviceEntity[i])
}
return result, nil
}
func (s Service) GetByDomainId(ctx context.Context, domainId int) ([]domain.Service, error) {
serviceEntity, err := s.serviceRepo.GetAppGroupByDomainId(ctx, []int{domainId})
if err != nil {
return nil, errors.WithMessage(err, "get system by id list")
}
result := make([]domain.Service, len(serviceEntity))
for i := range serviceEntity {
result[i] = s.convertService(serviceEntity[i])
}
return result, nil
}
func (s Service) CreateUpdate(ctx context.Context, req domain.ServiceCreateUpdateRequest) (*domain.Service, error) {
req.DomainId = 1 // temporary use only 1 domain, soon domain entity will be removed
_, err := s.domainRepo.GetDomainById(ctx, req.DomainId)
if err != nil {
return nil, errors.WithMessage(err, "get domain by id")
}
if req.Id == 0 {
serviceEntity, err := s.serviceRepo.CreateAppGroup(ctx, req.Name, req.Description, req.DomainId)
if err != nil {
return nil, errors.WithMessage(err, "create service")
}
result := s.convertService(*serviceEntity)
return &result, nil
}
_, err = s.serviceRepo.GetAppGroupById(ctx, req.Id)
if err != nil {
return nil, errors.WithMessage(err, "get service by id")
}
serviceEntity, err := s.serviceRepo.UpdateAppGroup(ctx, req.Id, req.Name, req.Description)
if err != nil {
return nil, errors.WithMessage(err, "update service")
}
result := s.convertService(*serviceEntity)
return &result, nil
}
func (s Service) Delete(ctx context.Context, idList []int) (int, error) {
result, err := s.serviceRepo.DeleteAppGroup(ctx, idList)
if err != nil {
return 0, errors.WithMessage(err, "delete service")
}
return result, nil
}
func (s Service) convertService(req entity.AppGroup) domain.Service {
result := domain.Service{
Id: req.Id,
Name: req.Name,
Description: req.Description.String,
DomainId: req.DomainId,
CreatedAt: req.CreatedAt,
UpdatedAt: req.UpdatedAt,
}
return result
}
+1 -17
View File
@@ -6,7 +6,7 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"isp-system-service/entity" "isp-system-service/entity"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
) )
type ApplicationTokenCreator interface { type ApplicationTokenCreator interface {
@@ -35,8 +35,6 @@ type Token struct {
appEnricher AppEnricher appEnricher AppEnricher
tx TokenTxRunner tx TokenTxRunner
appRepo ApplicationRepo appRepo ApplicationRepo
domainRepo DomainRepo
serviceRepo AppGroupRepo
tokenRepo TokenRepo tokenRepo TokenRepo
} }
@@ -45,8 +43,6 @@ func NewToken(
appEnricher AppEnricher, appEnricher AppEnricher,
tx TokenTxRunner, tx TokenTxRunner,
appRepo ApplicationRepo, appRepo ApplicationRepo,
domainRepo DomainRepo,
appGroupRepo AppGroupRepo,
tokenRepo TokenRepo, tokenRepo TokenRepo,
) Token { ) Token {
return Token{ return Token{
@@ -54,8 +50,6 @@ func NewToken(
jwt: jwtGenerate, jwt: jwtGenerate,
tx: tx, tx: tx,
appRepo: appRepo, appRepo: appRepo,
domainRepo: domainRepo,
serviceRepo: appGroupRepo,
tokenRepo: tokenRepo, tokenRepo: tokenRepo,
} }
} }
@@ -80,16 +74,6 @@ func (s Token) Create(ctx context.Context, req domain.TokenCreateRequest) (*doma
return nil, errors.WithMessage(err, "get application by id") return nil, errors.WithMessage(err, "get application by id")
} }
serviceEntity, err := s.serviceRepo.GetAppGroupById(ctx, applicationEntity.ApplicationGroupId)
if err != nil {
return nil, errors.WithMessage(err, "get service by id")
}
_, err = s.domainRepo.GetDomainById(ctx, serviceEntity.DomainId)
if err != nil {
return nil, errors.WithMessage(err, "get domain by id")
}
token, err := s.jwt.CreateApplicationToken() token, err := s.jwt.CreateApplicationToken()
if err != nil { if err != nil {
return nil, errors.WithMessage(err, "create application token") return nil, errors.WithMessage(err, "create application token")
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"crypto/rand" "crypto/rand"
"encoding/hex" "encoding/hex"
"github.com/pkg/errors" "github.com/txix-open/isp-kit/errors"
) )
type TokenSource struct{} type TokenSource struct{}
+1 -9
View File
@@ -26,6 +26,7 @@ func TestAccessListSuite(t *testing.T) {
type AccessListSuite struct { type AccessListSuite struct {
suite.Suite suite.Suite
test *test.Test test *test.Test
testDb *dbt.TestDb testDb *dbt.TestDb
api *client.Client api *client.Client
@@ -43,19 +44,10 @@ func (s *AccessListSuite) SetupTest() {
_, s.api = grpct.TestServer(s.test, config.Handler) _, s.api = grpct.TestServer(s.test, config.Handler)
s.accessListRepo = repository.NewAccessList(s.testDb) s.accessListRepo = repository.NewAccessList(s.testDb)
createdDomain, err := repository.NewDomain(s.testDb).CreateDomain(
s.T().Context(),
fake.It[string](),
fake.It[string](),
1,
)
s.Require().NoError(err)
appGroup, err := repository.NewAppGroup(s.testDb).CreateAppGroup( appGroup, err := repository.NewAppGroup(s.testDb).CreateAppGroup(
s.T().Context(), s.T().Context(),
fake.It[string](), fake.It[string](),
fake.It[string](), fake.It[string](),
createdDomain.Id,
) )
s.Require().NoError(err) s.Require().NoError(err)
+1 -13
View File
@@ -26,9 +26,9 @@ func TestApplicationGroupSuite(t *testing.T) {
type AppGroupSuite struct { type AppGroupSuite struct {
suite.Suite suite.Suite
test *test.Test test *test.Test
testDb *dbt.TestDb testDb *dbt.TestDb
domainRepo repository.Domain
appGroupRepo repository.AppGroup appGroupRepo repository.AppGroup
api *client.Client api *client.Client
} }
@@ -41,17 +41,7 @@ func (s *AppGroupSuite) SetupTest() {
locator := assembly.NewLocator(s.testDb, s.test.Logger()) locator := assembly.NewLocator(s.testDb, s.test.Logger())
config := locator.Config(conf.Remote{}) config := locator.Config(conf.Remote{})
_, s.api = grpct.TestServer(s.test, config.Handler) _, s.api = grpct.TestServer(s.test, config.Handler)
s.domainRepo = repository.NewDomain(s.testDb)
s.appGroupRepo = repository.NewAppGroup(s.testDb) s.appGroupRepo = repository.NewAppGroup(s.testDb)
q := `
INSERT INTO domain
(id, name, description, system_id)
VALUES ($1, $2, $3, $4)
RETURNING id, name, description, system_id, created_at, updated_at
`
_, err := s.testDb.Exec(s.T().Context(), q, 1, fake.It[string](), fake.It[string](), 1)
s.Require().NoError(err)
} }
func (s *AppGroupSuite) TestGetByIdList() { func (s *AppGroupSuite) TestGetByIdList() {
@@ -95,7 +85,6 @@ func (s *AppGroupSuite) TestGetByIdList_EmptyDescription() {
s.T().Context(), s.T().Context(),
fake.It[string](), fake.It[string](),
"", "",
1,
) )
s.Require().NoError(err) s.Require().NoError(err)
appGroups = append(appGroups, domain.AppGroup{ appGroups = append(appGroups, domain.AppGroup{
@@ -280,7 +269,6 @@ func (s *AppGroupSuite) createAppGroup() *entity.AppGroup {
s.T().Context(), s.T().Context(),
fake.It[string](), fake.It[string](),
fake.It[string](), fake.It[string](),
1,
) )
s.Require().NoError(err) s.Require().NoError(err)
return appGroup return appGroup
+96 -61
View File
@@ -6,6 +6,7 @@ import (
"isp-system-service/domain" "isp-system-service/domain"
"isp-system-service/entity" "isp-system-service/entity"
"isp-system-service/repository" "isp-system-service/repository"
"math"
"testing" "testing"
"time" "time"
@@ -26,9 +27,9 @@ func TestApplicationSuite(t *testing.T) {
type ApplicationSuite struct { type ApplicationSuite struct {
suite.Suite suite.Suite
test *test.Test test *test.Test
testDb *dbt.TestDb testDb *dbt.TestDb
domainRepo repository.Domain
appRepo repository.Application appRepo repository.Application
appGroupRepo repository.AppGroup appGroupRepo repository.AppGroup
tokenRepo repository.Token tokenRepo repository.Token
@@ -43,7 +44,6 @@ func (s *ApplicationSuite) SetupTest() {
locator := assembly.NewLocator(s.testDb, s.test.Logger()) locator := assembly.NewLocator(s.testDb, s.test.Logger())
config := locator.Config(conf.Remote{}) config := locator.Config(conf.Remote{})
_, s.api = grpct.TestServer(s.test, config.Handler) _, s.api = grpct.TestServer(s.test, config.Handler)
s.domainRepo = repository.NewDomain(s.testDb)
s.appRepo = repository.NewApplication(s.testDb) s.appRepo = repository.NewApplication(s.testDb)
s.appGroupRepo = repository.NewAppGroup(s.testDb) s.appGroupRepo = repository.NewAppGroup(s.testDb)
s.tokenRepo = repository.NewToken(s.testDb) s.tokenRepo = repository.NewToken(s.testDb)
@@ -67,12 +67,52 @@ func (s *ApplicationSuite) TestGetAllApplications() {
s.Require().ElementsMatch(expectedApps, result) s.Require().ElementsMatch(expectedApps, result)
} }
func (s *ApplicationSuite) Test_GetByAppId() {
expectedApps := s.insertApps(2)
result := []domain.Application{}
err := s.api.Invoke("system/application/get_by_app_group").
JsonRequestBody(domain.Identity{
Id: expectedApps[0].ApplicationGroupId,
}).
JsonResponseBody(&result).
Do(s.T().Context())
s.Require().NoError(err)
for i := range result {
s.Require().NotEmpty(result[i].CreatedAt)
result[i].CreatedAt = time.Time{}
s.Require().NotEmpty(result[i].UpdatedAt)
result[i].UpdatedAt = time.Time{}
}
s.Require().ElementsMatch(expectedApps, result)
}
func (s *ApplicationSuite) Test_GetByAppId_NotFoundAny() {
_ = s.insertApps(2)
result := []domain.Application{}
err := s.api.Invoke("system/application/get_by_app_group").
JsonRequestBody(domain.Identity{
Id: math.MaxInt32,
}).
JsonResponseBody(&result).
Do(s.T().Context())
s.Require().NoError(err)
s.Require().Empty(result)
}
func (s *ApplicationSuite) TestCreate_HappyPath() { func (s *ApplicationSuite) TestCreate_HappyPath() {
result := domain.ApplicationWithTokens{} result := domain.Application{}
apiReq := fake.It[domain.CreateApplicationRequest]()
apiReq.Type = domain.ApplicationSystemType
appGroup := s.createAppGroup() appGroup := s.createAppGroup()
apiReq.ApplicationGroupId = appGroup.Id
apiReq := domain.CreateApplicationRequest{
Id: 1,
Name: fake.It[string](),
Type: domain.ApplicationSystemType,
ApplicationGroupId: appGroup.Id,
}
err := s.api.Invoke("system/application/create_application"). err := s.api.Invoke("system/application/create_application").
JsonRequestBody(apiReq). JsonRequestBody(apiReq).
@@ -80,26 +120,29 @@ func (s *ApplicationSuite) TestCreate_HappyPath() {
Do(s.T().Context()) Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
s.Require().NotEmpty(result.App.CreatedAt) s.Require().NotEmpty(result.CreatedAt)
result.App.CreatedAt = time.Time{} result.CreatedAt = time.Time{}
s.Require().NotEmpty(result.App.UpdatedAt) s.Require().NotEmpty(result.UpdatedAt)
result.App.UpdatedAt = time.Time{} result.UpdatedAt = time.Time{}
expectedApp := domain.Application{ expectedApp := domain.Application{
Id: apiReq.Id, Id: apiReq.Id,
Name: apiReq.Name, Name: apiReq.Name,
Description: apiReq.Description, Description: apiReq.Description,
Type: apiReq.Type, Type: apiReq.Type,
ServiceId: apiReq.ApplicationGroupId, ApplicationGroupId: apiReq.ApplicationGroupId,
} }
s.Require().Equal(expectedApp, result.App) s.Require().Equal(expectedApp, result)
s.Require().Empty(result.Tokens)
} }
func (s *ApplicationSuite) TestCreate_AppGroupNotFound() { func (s *ApplicationSuite) TestCreate_AppGroupNotFound() {
apiReq := fake.It[domain.CreateApplicationRequest]() apiReq := domain.CreateApplicationRequest{
apiReq.Type = domain.ApplicationSystemType Id: 1,
Name: fake.It[string](),
Type: domain.ApplicationSystemType,
ApplicationGroupId: 1,
}
err := s.api.Invoke("system/application/create_application"). err := s.api.Invoke("system/application/create_application").
JsonRequestBody(apiReq). JsonRequestBody(apiReq).
@@ -110,13 +153,14 @@ func (s *ApplicationSuite) TestCreate_AppGroupNotFound() {
} }
func (s *ApplicationSuite) TestCreate_ApplicationNameNotUniqueInAppGroup() { func (s *ApplicationSuite) TestCreate_ApplicationNameNotUniqueInAppGroup() {
apiReq := fake.It[domain.CreateApplicationRequest]()
apiReq.Type = domain.ApplicationSystemType
inserted := s.insertApps(1) inserted := s.insertApps(1)
apiReq.ApplicationGroupId = inserted[0].ServiceId apiReq := domain.CreateApplicationRequest{
apiReq.Name = inserted[0].Name Id: inserted[0].Id + 1,
Name: inserted[0].Name,
Type: domain.ApplicationSystemType,
ApplicationGroupId: inserted[0].ApplicationGroupId,
}
err := s.api.Invoke("system/application/create_application"). err := s.api.Invoke("system/application/create_application").
JsonRequestBody(apiReq). JsonRequestBody(apiReq).
@@ -127,13 +171,14 @@ func (s *ApplicationSuite) TestCreate_ApplicationNameNotUniqueInAppGroup() {
} }
func (s *ApplicationSuite) TestCreate_ApplicationIdNotUnique() { func (s *ApplicationSuite) TestCreate_ApplicationIdNotUnique() {
apiReq := fake.It[domain.CreateApplicationRequest]()
apiReq.Type = "SYSTEM"
appGroup := s.createAppGroup()
apiReq.ApplicationGroupId = appGroup.Id
inserted := s.insertApps(1) inserted := s.insertApps(1)
apiReq.Id = inserted[0].Id
apiReq := domain.CreateApplicationRequest{
Id: inserted[0].Id,
Name: inserted[0].Name,
Type: domain.ApplicationSystemType,
ApplicationGroupId: inserted[0].ApplicationGroupId,
}
err := s.api.Invoke("system/application/create_application"). err := s.api.Invoke("system/application/create_application").
JsonRequestBody(apiReq). JsonRequestBody(apiReq).
@@ -147,33 +192,32 @@ func (s *ApplicationSuite) TestUpdate_HappyPath() {
inserted := s.insertApps(2) inserted := s.insertApps(2)
apiReq := domain.UpdateApplicationRequest{ apiReq := domain.UpdateApplicationRequest{
OldId: inserted[0].Id, OldId: inserted[0].Id,
NewId: fake.It[int](), NewId: inserted[0].Id + inserted[1].Id,
Name: fake.It[string](), Name: fake.It[string](),
Description: fake.It[string](), Description: fake.It[string](),
} }
var result domain.ApplicationWithTokens var result domain.Application
err := s.api.Invoke("system/application/update_application"). err := s.api.Invoke("system/application/update_application").
JsonRequestBody(apiReq). JsonRequestBody(apiReq).
JsonResponseBody(&result). JsonResponseBody(&result).
Do(s.T().Context()) Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
s.Require().NotEmpty(result.App.CreatedAt) s.Require().NotEmpty(result.CreatedAt)
result.App.CreatedAt = time.Time{} result.CreatedAt = time.Time{}
s.Require().NotEmpty(result.App.UpdatedAt) s.Require().NotEmpty(result.UpdatedAt)
result.App.UpdatedAt = time.Time{} result.UpdatedAt = time.Time{}
expectedApp := domain.Application{ expectedApp := domain.Application{
Id: apiReq.NewId, Id: apiReq.NewId,
Name: apiReq.Name, Name: apiReq.Name,
Description: apiReq.Description, Description: apiReq.Description,
Type: inserted[0].Type, Type: inserted[0].Type,
ServiceId: inserted[0].ServiceId, ApplicationGroupId: inserted[0].ApplicationGroupId,
} }
s.Require().Equal(expectedApp, result.App) s.Require().Equal(expectedApp, result)
s.Require().Empty(result.Tokens)
app, err := s.appRepo.GetApplicationById(s.T().Context(), apiReq.NewId) app, err := s.appRepo.GetApplicationById(s.T().Context(), apiReq.NewId)
s.Require().NoError(err) s.Require().NoError(err)
@@ -183,7 +227,7 @@ func (s *ApplicationSuite) TestUpdate_HappyPath() {
Name: apiReq.Name, Name: apiReq.Name,
Description: app.Description, Description: app.Description,
Type: inserted[0].Type, Type: inserted[0].Type,
ApplicationGroupId: inserted[0].ServiceId, ApplicationGroupId: inserted[0].ApplicationGroupId,
} }
s.Require().NotEmpty(app.CreatedAt) s.Require().NotEmpty(app.CreatedAt)
@@ -250,7 +294,7 @@ func (s *ApplicationSuite) TestGetByToken() {
token := fake.It[string]() token := fake.It[string]()
expectedApp := domain.GetApplicationByTokenResponse{ expectedApp := domain.GetApplicationByTokenResponse{
ApplicationId: insertedApps[0].Id, ApplicationId: insertedApps[0].Id,
ApplicationGroupId: insertedApps[0].ServiceId, ApplicationGroupId: insertedApps[0].ApplicationGroupId,
} }
_, err := s.tokenRepo.SaveToken(s.T().Context(), token, expectedApp.ApplicationId, fake.It[int]()) _, err := s.tokenRepo.SaveToken(s.T().Context(), token, expectedApp.ApplicationId, fake.It[int]())
s.Require().NoError(err) s.Require().NoError(err)
@@ -278,19 +322,10 @@ func (s *ApplicationSuite) TestGetByToken_NotFound() {
} }
func (s *ApplicationSuite) createAppGroup() *entity.AppGroup { func (s *ApplicationSuite) createAppGroup() *entity.AppGroup {
createdDomain, err := s.domainRepo.CreateDomain(
s.T().Context(),
fake.It[string](),
fake.It[string](),
1,
)
s.Require().NoError(err)
appGroup, err := s.appGroupRepo.CreateAppGroup( appGroup, err := s.appGroupRepo.CreateAppGroup(
s.T().Context(), s.T().Context(),
fake.It[string](), fake.It[string](),
fake.It[string](), fake.It[string](),
createdDomain.Id,
) )
s.Require().NoError(err) s.Require().NoError(err)
return appGroup return appGroup
@@ -318,13 +353,13 @@ func (s *ApplicationSuite) insertApps(appsCount uint) []domain.Application {
s.Require().NotEmpty(createdApp.UpdatedAt) s.Require().NotEmpty(createdApp.UpdatedAt)
toExpect = append(toExpect, domain.Application{ toExpect = append(toExpect, domain.Application{
Id: createdApp.Id, Id: createdApp.Id,
Name: createdApp.Name, Name: createdApp.Name,
Description: createdApp.Description.String, Description: createdApp.Description.String,
ServiceId: createdApp.ApplicationGroupId, ApplicationGroupId: createdApp.ApplicationGroupId,
Type: createdApp.Type, Type: createdApp.Type,
CreatedAt: time.Time{}, CreatedAt: time.Time{},
UpdatedAt: time.Time{}, UpdatedAt: time.Time{},
}) })
} }
return toExpect return toExpect
+3 -3
View File
@@ -1,7 +1,6 @@
package tests_test package tests_test
import ( import (
"context"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/txix-open/isp-kit/dbx" "github.com/txix-open/isp-kit/dbx"
"github.com/txix-open/isp-kit/grpc/client" "github.com/txix-open/isp-kit/grpc/client"
@@ -22,6 +21,7 @@ func TestBaselineSuite(t *testing.T) {
type BaselineSuite struct { type BaselineSuite struct {
suite.Suite suite.Suite
test *test.Test test *test.Test
testDb *dbt.TestDb testDb *dbt.TestDb
baseline baseline.Service baseline baseline.Service
@@ -44,9 +44,9 @@ func (s *BaselineSuite) SetupSuite() {
} }
func (s *BaselineSuite) TestBaselineSuccess() { func (s *BaselineSuite) TestBaselineSuccess() {
err := s.baseline.Do(context.Background()) err := s.baseline.Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
err = s.baseline.Do(context.Background()) err = s.baseline.Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
} }
+2 -12
View File
@@ -6,22 +6,12 @@ import (
"github.com/txix-open/isp-kit/test/dbt" "github.com/txix-open/isp-kit/test/dbt"
) )
func InsertDomain(db *dbt.TestDb, value entity.Domain) {
q := `
INSERT INTO domain
(id, name, description, system_id, created_at, updated_at)
VALUES
(:id, :name, :description, 1, :created_at, :updated_at)
`
db.Must().ExecNamed(q, value)
}
func InsertAppGroup(db *dbt.TestDb, value entity.AppGroup) { func InsertAppGroup(db *dbt.TestDb, value entity.AppGroup) {
q := ` q := `
INSERT INTO application_group INSERT INTO application_group
(id, name, description, domain_id, created_at, updated_at) (id, name, description, created_at, updated_at)
VALUES VALUES
(:id, :name, :description, :domain_id, :created_at, :updated_at) (:id, :name, :description, :created_at, :updated_at)
` `
db.Must().ExecNamed(q, value) db.Must().ExecNamed(q, value)
} }
+37 -18
View File
@@ -1,7 +1,7 @@
package tests_test package tests_test
import ( import (
"context" "net/http"
"testing" "testing"
"time" "time"
@@ -26,6 +26,7 @@ func TestSecureSuite(t *testing.T) {
type SecureSuite struct { type SecureSuite struct {
suite.Suite suite.Suite
test *test.Test test *test.Test
testDb *dbt.TestDb testDb *dbt.TestDb
api *client.Client api *client.Client
@@ -41,17 +42,15 @@ func (s *SecureSuite) SetupSuite() {
_, s.api = grpct.TestServer(s.test, config.Handler) _, s.api = grpct.TestServer(s.test, config.Handler)
createdTime := time.Now().UTC() createdTime := time.Now().UTC()
InsertDomain(s.testDb, entity.Domain{
Id: 3, Name: "test_domain", SystemId: 1, CreatedAt: createdTime, UpdatedAt: createdTime,
})
InsertAppGroup(s.testDb, entity.AppGroup{ InsertAppGroup(s.testDb, entity.AppGroup{
Id: 5, Name: "test_application_group", DomainId: 3, CreatedAt: createdTime, UpdatedAt: createdTime, Id: 5, Name: "test_application_group", CreatedAt: createdTime, UpdatedAt: createdTime,
}) })
InsertApplication(s.testDb, entity.Application{ InsertApplication(s.testDb, entity.Application{
Id: 7, Name: "test_application", ApplicationGroupId: 5, CreatedAt: createdTime, UpdatedAt: createdTime, Id: 7, Name: "test_application", ApplicationGroupId: 5, CreatedAt: createdTime, UpdatedAt: createdTime,
}) })
} }
// nolint: gosec
func (s *SecureSuite) TestAuthenticate_Success() { func (s *SecureSuite) TestAuthenticate_Success() {
InsertToken(s.testDb, entity.Token{ InsertToken(s.testDb, entity.Token{
Token: "test_token_success", AppId: 7, ExpireTime: -1, CreatedAt: time.Now().UTC(), Token: "test_token_success", AppId: 7, ExpireTime: -1, CreatedAt: time.Now().UTC(),
@@ -63,15 +62,13 @@ func (s *SecureSuite) TestAuthenticate_Success() {
Token: "test_token_success", Token: "test_token_success",
}). }).
JsonResponseBody(&result). JsonResponseBody(&result).
Do(context.Background()) Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Equal(domain.AuthenticateResponse{ s.Require().Equal(domain.AuthenticateResponse{
Authenticated: true, Authenticated: true,
ErrorReason: "", ErrorReason: "",
AuthData: &domain.AuthData{ AuthData: &domain.AuthData{
SystemId: 1, AppName: "test_application",
DomainId: 3,
ServiceId: 5,
ApplicationId: 7, ApplicationId: 7,
}, },
}, result) }, result)
@@ -84,7 +81,7 @@ func (s *SecureSuite) TestAuthenticate_NotFound() {
Token: "test_token_not_found", Token: "test_token_not_found",
}). }).
JsonResponseBody(&result). JsonResponseBody(&result).
Do(context.Background()) Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Equal(domain.AuthenticateResponse{ s.Require().Equal(domain.AuthenticateResponse{
Authenticated: false, Authenticated: false,
@@ -104,20 +101,19 @@ func (s *SecureSuite) TestAuthenticate_NotExpired() {
Token: "test_token_not_expired", Token: "test_token_not_expired",
}). }).
JsonResponseBody(&result). JsonResponseBody(&result).
Do(context.Background()) Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Equal(domain.AuthenticateResponse{ s.Require().Equal(domain.AuthenticateResponse{
Authenticated: true, Authenticated: true,
ErrorReason: "", ErrorReason: "",
AuthData: &domain.AuthData{ AuthData: &domain.AuthData{
SystemId: 1, AppName: "test_application",
DomainId: 3,
ServiceId: 5,
ApplicationId: 7, ApplicationId: 7,
}, },
}, result) }, result)
} }
// nolint: gosec
func (s *SecureSuite) TestAuthenticate_Expired() { func (s *SecureSuite) TestAuthenticate_Expired() {
InsertToken(s.testDb, entity.Token{ InsertToken(s.testDb, entity.Token{
Token: "test_token_expired", AppId: 7, ExpireTime: 0, CreatedAt: time.Now().UTC(), Token: "test_token_expired", AppId: 7, ExpireTime: 0, CreatedAt: time.Now().UTC(),
@@ -129,7 +125,7 @@ func (s *SecureSuite) TestAuthenticate_Expired() {
Token: "test_token_expired", Token: "test_token_expired",
}). }).
JsonResponseBody(&result). JsonResponseBody(&result).
Do(context.Background()) Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Equal(domain.AuthenticateResponse{ s.Require().Equal(domain.AuthenticateResponse{
Authenticated: false, Authenticated: false,
@@ -152,7 +148,7 @@ func (s *SecureSuite) TestAuthorize_Success_True() {
Endpoint: "endpoint/available", Endpoint: "endpoint/available",
}). }).
JsonResponseBody(&result). JsonResponseBody(&result).
Do(context.Background()) Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Equal(domain.AuthorizeResponse{ s.Require().Equal(domain.AuthorizeResponse{
Authorized: true, Authorized: true,
@@ -173,7 +169,7 @@ func (s *SecureSuite) TestAuthorize_Success_False() {
Endpoint: "endpoint/not_available", Endpoint: "endpoint/not_available",
}). }).
JsonResponseBody(&result). JsonResponseBody(&result).
Do(context.Background()) Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Equal(domain.AuthorizeResponse{ s.Require().Equal(domain.AuthorizeResponse{
Authorized: false, Authorized: false,
@@ -188,9 +184,32 @@ func (s *SecureSuite) TestAuthorize_NotFound() {
Endpoint: "endpoint/not_found", Endpoint: "endpoint/not_found",
}). }).
JsonResponseBody(&result). JsonResponseBody(&result).
Do(context.Background()) Do(s.T().Context())
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Equal(domain.AuthorizeResponse{ s.Require().Equal(domain.AuthorizeResponse{
Authorized: false, Authorized: false,
}, result) }, 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)
}
-2
View File
@@ -87,7 +87,6 @@ func (m Manager) TokenRevokeTx(ctx context.Context, msgTx func(ctx context.Conte
type baselineTx struct { type baselineTx struct {
repository.Locker repository.Locker
repository.Domain
repository.AppGroup repository.AppGroup
repository.Application repository.Application
repository.AccessList repository.AccessList
@@ -98,7 +97,6 @@ func (m Manager) BaselineTx(ctx context.Context, txTx func(ctx context.Context,
return m.db.RunInTransaction(ctx, func(ctx context.Context, tx *db.Tx) error { return m.db.RunInTransaction(ctx, func(ctx context.Context, tx *db.Tx) error {
return txTx(ctx, baselineTx{ return txTx(ctx, baselineTx{
Locker: repository.NewLocker(tx), Locker: repository.NewLocker(tx),
Domain: repository.NewDomain(tx),
AppGroup: repository.NewAppGroup(tx), AppGroup: repository.NewAppGroup(tx),
Application: repository.NewApplication(tx), Application: repository.NewApplication(tx),
AccessList: repository.NewAccessList(tx), AccessList: repository.NewAccessList(tx),