From c01c7874499c4ecf76ef25ff753e3374a9878e17 Mon Sep 17 00:00:00 2001 From: Ryan SU Date: Wed, 5 Jul 2023 07:24:12 +0800 Subject: [PATCH] refactor: rename config fields --- api/etc/core.yaml | 6 +++--- api/internal/config/config.go | 6 +++--- api/internal/logic/user/register_logic.go | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/etc/core.yaml b/api/etc/core.yaml index 5838f61a..999ceca7 100644 --- a/api/etc/core.yaml +++ b/api/etc/core.yaml @@ -34,9 +34,9 @@ DatabaseConf: CacheTime: 5 ProjectConf: - DefaultRole: 1 # default role id when register - DefaultDepartment: 1 # default department id when register - DefaultPosition: 1 # default position id when register + DefaultRoleId: 1 # default role id when register + DefaultDepartmentId: 1 # default department id when register + DefaultPositionId: 1 # default position id when register Prometheus: Host: 0.0.0.0 diff --git a/api/internal/config/config.go b/api/internal/config/config.go index d9ff1ee6..2f39a0e9 100644 --- a/api/internal/config/config.go +++ b/api/internal/config/config.go @@ -25,7 +25,7 @@ type Config struct { } type ProjectConf struct { - DefaultRole uint64 `json:",default=1"` - DefaultDepartment uint64 `json:",default=1"` - DefaultPosition uint64 `json:",default=1"` + DefaultRoleId uint64 `json:",default=1"` + DefaultDepartmentId uint64 `json:",default=1"` + DefaultPositionId uint64 `json:",default=1"` } diff --git a/api/internal/logic/user/register_logic.go b/api/internal/logic/user/register_logic.go index a13428ba..1b85318f 100644 --- a/api/internal/logic/user/register_logic.go +++ b/api/internal/logic/user/register_logic.go @@ -38,9 +38,9 @@ func (l *RegisterLogic) Register(req *types.RegisterReq) (resp *types.BaseMsgRes Nickname: &req.Username, Status: pointy.GetPointer(uint32(1)), HomePath: pointy.GetPointer("/dashboard"), - RoleIds: []uint64{l.svcCtx.Config.ProjectConf.DefaultRole}, - DepartmentId: pointy.GetPointer(l.svcCtx.Config.ProjectConf.DefaultDepartment), - PositionIds: []uint64{l.svcCtx.Config.ProjectConf.DefaultPosition}, + RoleIds: []uint64{l.svcCtx.Config.ProjectConf.DefaultRoleId}, + DepartmentId: pointy.GetPointer(l.svcCtx.Config.ProjectConf.DefaultDepartmentId), + PositionIds: []uint64{l.svcCtx.Config.ProjectConf.DefaultPositionId}, }) if err != nil { return nil, err