From b2d753e832ffc7ad76ffdb9b8cdc55adc9733f0c Mon Sep 17 00:00:00 2001 From: landaiqing <3517283258@qq.com> Date: Thu, 14 Nov 2024 16:02:11 +0800 Subject: [PATCH] :sparkles: add casbin ent adapter & code migration --- .idea/GOHCache.xml | 3401 ++--------------- .idea/JavaSceneConfigState.xml | 2 +- app/core/api/common/constant/deleted.go | 6 + app/core/api/common/constant/gender.go | 6 + app/core/api/common/constant/redis_prefix.go | 9 +- app/core/api/common/constant/user_role.go | 7 + app/core/api/common/jwt/access_token.go | 14 +- app/core/api/common/jwt/refresh_token.go | 14 +- .../api/common/random_name/actsomething.go | 8 + app/core/api/common/random_name/adjective.go | 31 + app/core/api/common/random_name/person.go | 11 + app/core/api/common/random_name/randomname.go | 20 + app/core/api/common/random_name/randomtype.go | 8 + app/core/api/common/response/response.go | 41 +- app/core/api/core.api | 3 + app/core/api/core.go | 10 +- app/core/api/etc/rbac_model.conf | 14 + app/core/api/internal/handler/routes.go | 5 + .../handler/user/phone_login_handler.go | 2 +- .../handler/user/refresh_token_handler.go | 22 + .../logic/client/generate_client_id_logic.go | 4 +- .../logic/user/account_login_logic.go | 56 +- .../internal/logic/user/phone_login_logic.go | 67 +- .../logic/user/refresh_token_logic.go | 66 + .../logic/user/reset_password_logic.go | 41 +- app/core/api/internal/svc/service_context.go | 4 + app/core/api/internal/types/redis_token.go | 16 + app/core/api/internal/types/session.go | 17 + .../api/repository/casbinx/adapter/adapter.go | 515 +++ app/core/api/repository/casbinx/init.go | 39 + app/core/api/repository/idgenerator/init.go | 10 + app/core/api/repository/mysql/ent/client.go | 105 +- app/core/api/repository/mysql/ent/entql.go | 169 +- .../repository/mysql/ent/migrate/schema.go | 40 +- app/core/api/repository/mysql/ent/mutation.go | 809 ++-- app/core/api/repository/mysql/ent/runtime.go | 4 - .../mysql/ent/scaauthpermissionrule.go | 122 +- .../scaauthpermissionrule.go | 35 - .../mysql/ent/scaauthpermissionrule/where.go | 72 +- .../mysql/ent/scaauthpermissionrule_create.go | 93 +- .../mysql/ent/scaauthpermissionrule_delete.go | 2 +- .../mysql/ent/scaauthpermissionrule_query.go | 127 +- .../mysql/ent/scaauthpermissionrule_update.go | 167 +- .../api/repository/mysql/ent/scaauthrole.go | 28 +- .../mysql/ent/scaauthrole/scaauthrole.go | 31 - .../repository/mysql/ent/scaauthrole/where.go | 24 - .../mysql/ent/scaauthrole_create.go | 32 - .../repository/mysql/ent/scaauthrole_query.go | 104 +- .../mysql/ent/scaauthrole_update.go | 163 - .../api/repository/mysql/ent/scaauthuser.go | 56 +- .../mysql/ent/scaauthuser/scaauthuser.go | 63 - .../repository/mysql/ent/scaauthuser/where.go | 90 +- .../mysql/ent/scaauthuser_create.go | 81 +- .../repository/mysql/ent/scaauthuser_query.go | 181 +- .../mysql/ent/scaauthuser_update.go | 384 +- .../repository/mysql/ent/scaauthuserdevice.go | 41 +- .../scaauthuserdevice/scaauthuserdevice.go | 35 - .../mysql/ent/scaauthuserdevice/where.go | 24 - .../mysql/ent/scaauthuserdevice_create.go | 37 - .../mysql/ent/scaauthuserdevice_query.go | 109 +- .../mysql/ent/scaauthuserdevice_update.go | 109 - .../repository/mysql/ent/scaauthusersocial.go | 43 +- .../scaauthusersocial/scaauthusersocial.go | 35 - .../mysql/ent/scaauthusersocial/where.go | 24 - .../mysql/ent/scaauthusersocial_create.go | 37 - .../mysql/ent/scaauthusersocial_query.go | 109 +- .../mysql/ent/scaauthusersocial_update.go | 109 - .../mysql/model/sca_auth_permission_rule.go | 31 +- .../repository/mysql/model/sca_auth_role.go | 5 +- .../repository/mysql/model/sca_auth_user.go | 9 +- .../mysql/model/sca_auth_user_device.go | 7 +- .../mysql/model/sca_auth_user_social.go | 7 +- app/core/api/repository/redis_session/init.go | 2 +- .../repository/redis_session/types/session.go | 7 - .../repository/redisx/types/redis_token.go | 6 - .../api/resources/language/active.en.toml | 10 +- .../api/resources/language/active.zh.toml | 8 + go.mod | 23 +- go.sum | 40 +- 79 files changed, 1856 insertions(+), 6462 deletions(-) create mode 100644 app/core/api/common/constant/deleted.go create mode 100644 app/core/api/common/constant/gender.go create mode 100644 app/core/api/common/constant/user_role.go create mode 100644 app/core/api/common/random_name/actsomething.go create mode 100644 app/core/api/common/random_name/adjective.go create mode 100644 app/core/api/common/random_name/person.go create mode 100644 app/core/api/common/random_name/randomname.go create mode 100644 app/core/api/common/random_name/randomtype.go create mode 100644 app/core/api/etc/rbac_model.conf create mode 100644 app/core/api/internal/handler/user/refresh_token_handler.go create mode 100644 app/core/api/internal/logic/user/refresh_token_logic.go create mode 100644 app/core/api/internal/types/redis_token.go create mode 100644 app/core/api/internal/types/session.go create mode 100644 app/core/api/repository/casbinx/adapter/adapter.go create mode 100644 app/core/api/repository/casbinx/init.go create mode 100644 app/core/api/repository/idgenerator/init.go delete mode 100644 app/core/api/repository/redis_session/types/session.go delete mode 100644 app/core/api/repository/redisx/types/redis_token.go diff --git a/.idea/GOHCache.xml b/.idea/GOHCache.xml index c6c4438..3e954df 100644 --- a/.idea/GOHCache.xml +++ b/.idea/GOHCache.xml @@ -7,7 +7,6 @@ @@ -15,26 +14,28 @@ - - + + + + + + @@ -42,9 +43,6 @@ @@ -52,38 +50,20 @@ - - - - - - - - @@ -91,18 +71,21 @@ - + + + + + + @@ -117,24 +100,20 @@ - - @@ -142,9 +121,6 @@ @@ -152,9 +128,6 @@ @@ -162,9 +135,6 @@ @@ -172,33 +142,28 @@ - - - @@ -206,7 +171,6 @@ @@ -214,26 +178,27 @@ + + + + + + - - @@ -249,12 +214,6 @@ @@ -262,9 +221,6 @@ @@ -272,9 +228,6 @@ @@ -282,9 +235,6 @@ @@ -292,9 +242,6 @@ @@ -302,9 +249,6 @@ @@ -312,9 +256,6 @@ @@ -322,9 +263,6 @@ @@ -332,9 +270,6 @@ @@ -342,9 +277,6 @@ @@ -352,9 +284,6 @@ @@ -362,9 +291,6 @@ @@ -372,9 +298,6 @@ @@ -382,9 +305,6 @@ @@ -393,15 +313,6 @@ @@ -409,9 +320,6 @@ @@ -419,9 +327,6 @@ @@ -429,9 +334,6 @@ @@ -439,9 +341,6 @@ @@ -449,9 +348,6 @@ @@ -459,9 +355,6 @@ @@ -469,9 +362,6 @@ @@ -479,9 +369,6 @@ @@ -489,9 +376,6 @@ @@ -499,9 +383,6 @@ @@ -509,9 +390,6 @@ @@ -519,9 +397,6 @@ @@ -529,9 +404,6 @@ @@ -540,15 +412,6 @@ @@ -556,9 +419,6 @@ @@ -566,9 +426,6 @@ @@ -576,9 +433,6 @@ @@ -586,9 +440,6 @@ @@ -596,9 +447,6 @@ @@ -607,15 +455,6 @@ @@ -623,9 +462,6 @@ @@ -633,9 +469,6 @@ @@ -643,9 +476,6 @@ @@ -653,9 +483,6 @@ @@ -663,9 +490,6 @@ @@ -673,9 +497,6 @@ @@ -683,9 +504,6 @@ @@ -693,9 +511,6 @@ @@ -703,9 +518,6 @@ @@ -713,9 +525,6 @@ @@ -723,9 +532,6 @@ @@ -733,9 +539,6 @@ @@ -743,9 +546,6 @@ @@ -753,9 +553,6 @@ @@ -763,9 +560,6 @@ @@ -773,9 +567,6 @@ @@ -783,9 +574,6 @@ @@ -793,9 +581,6 @@ @@ -803,9 +588,6 @@ @@ -814,15 +596,6 @@ @@ -830,9 +603,6 @@ @@ -840,9 +610,6 @@ @@ -850,9 +617,6 @@ @@ -860,9 +624,6 @@ @@ -870,9 +631,6 @@ @@ -880,9 +638,6 @@ @@ -890,9 +645,6 @@ @@ -900,9 +652,6 @@ @@ -910,9 +659,6 @@ @@ -920,9 +666,6 @@ @@ -930,9 +673,6 @@ @@ -940,9 +680,6 @@ @@ -950,9 +687,6 @@ @@ -960,9 +694,6 @@ @@ -970,9 +701,6 @@ @@ -980,35 +708,27 @@ - - - @@ -1017,8 +737,6 @@ @@ -1026,9 +744,6 @@ @@ -1036,9 +751,6 @@ @@ -1046,9 +758,6 @@ @@ -1056,9 +765,6 @@ @@ -1066,9 +772,6 @@ @@ -1076,9 +779,6 @@ @@ -1086,9 +786,6 @@ @@ -1096,9 +793,6 @@ @@ -1106,8 +800,6 @@ @@ -1115,144 +807,10 @@ -