fix: repair healthz mysql check and im tenant creation
- healthz: Scan(new(int)) is not supported by GoFrame, use .One() so the mysql check no longer reports a false failure - im_tenant: set updated_by on insert for both im_tenant and im_tenant_config, otherwise new tenant creation fails with "Field 'updated_by' doesn't have a default value" - gitignore: exclude .trae/ local debugging artifacts
This commit is contained in:
@@ -163,3 +163,6 @@ dist
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
# Trae local debugging artifacts
|
||||
.trae/
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ func Serve(r *ghttp.Request) {
|
||||
checks := map[string]string{}
|
||||
statusCode := http.StatusOK
|
||||
|
||||
if err := g.DB().Ctx(ctx).Raw("SELECT 1").Scan(new(int)); err != nil {
|
||||
if _, err := g.DB().Ctx(ctx).Raw("SELECT 1").One(); err != nil {
|
||||
checks["mysql"] = err.Error()
|
||||
statusCode = http.StatusServiceUnavailable
|
||||
} else {
|
||||
|
||||
@@ -161,6 +161,7 @@ func (s *sSysImTenant) Edit(ctx context.Context, in *sysin.ImTenantEditInp) (err
|
||||
}
|
||||
|
||||
in.CreatedBy = userId
|
||||
in.UpdatedBy = userId
|
||||
id, err := s.Model(ctx, &handler.Option{FilterAuth: false}).
|
||||
Fields(sysin.ImTenantInsertFields{}).
|
||||
Data(in).InsertAndGetId()
|
||||
@@ -216,6 +217,7 @@ func (s *sSysImTenant) saveConfig(ctx context.Context, tenantId int64, maxUsers
|
||||
|
||||
data[dao.ImTenantConfig.Columns().TenantId] = tenantId
|
||||
data[dao.ImTenantConfig.Columns().CreatedBy] = userId
|
||||
data[dao.ImTenantConfig.Columns().UpdatedBy] = userId
|
||||
if _, err = s.configModel(ctx).
|
||||
Fields(
|
||||
dao.ImTenantConfig.Columns().TenantId,
|
||||
@@ -223,6 +225,7 @@ func (s *sSysImTenant) saveConfig(ctx context.Context, tenantId int64, maxUsers
|
||||
dao.ImTenantConfig.Columns().MaxGroups,
|
||||
dao.ImTenantConfig.Columns().MaxGroupMembers,
|
||||
dao.ImTenantConfig.Columns().CreatedBy,
|
||||
dao.ImTenantConfig.Columns().UpdatedBy,
|
||||
).
|
||||
Data(data).Insert(); err != nil {
|
||||
return gerror.Wrap(err, "新增IM租户配置失败,请稍后重试!")
|
||||
|
||||
@@ -38,6 +38,7 @@ type ImTenantInsertFields struct {
|
||||
DbDsn string `json:"dbDsn" dc:"独立连接串"`
|
||||
State int `json:"state" dc:"状态"`
|
||||
CreatedBy int64 `json:"createdBy" dc:"创建者"`
|
||||
UpdatedBy int64 `json:"updatedBy" dc:"更新者"`
|
||||
}
|
||||
|
||||
// ImTenantConfigUpdateFields 修改IM租户配置字段过滤
|
||||
|
||||
Reference in New Issue
Block a user