refactor(terminology): rename user-facing tenant labels to workspace

Align product copy, API docs, Swagger descriptions, and i18n strings
with workspace terminology while keeping internal tenant identifiers
and headers unchanged for API compatibility.
This commit is contained in:
wizardchen
2026-07-14 16:13:49 +08:00
committed by lyingbug
parent e1572b71b9
commit 41975abcc5
161 changed files with 1865 additions and 1770 deletions
+7 -7
View File
@@ -586,7 +586,7 @@ type updateMyPreferencesRequest struct {
EnableMemory *bool `json:"enable_memory"`
// LastActiveTenantID lets the SPA persist "after a fresh login,
// drop me back into this workspace" across devices. Send a positive
// tenant id to set / replace, or 0 to clear. Membership is validated
// workspace id to set / replace, or 0 to clear. Membership is validated
// at next login, not here. Nil = field omitted from the PATCH and
// stays untouched.
LastActiveTenantID *uint64 `json:"last_active_tenant_id"`
@@ -717,15 +717,15 @@ func (h *AuthHandler) GetAuthConfig(c *gin.Context) {
}
// SwitchTenant godoc
// @Summary 切换激活租户
// @Description 为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系
// @Summary 切换激活空间
// @Description 为当前用户在目标空间重新签发访问令牌;要求该用户在目标空间存在 active 成员关系
// @Tags 认证
// @Accept json
// @Produce json
// @Param request body object{tenant_id=integer,refresh_token=string} true "切换请求"
// @Success 200 {object} types.LoginResponse
// @Failure 400 {object} errors.AppError "参数错误"
// @Failure 403 {object} errors.AppError "无该租户成员关系"
// @Failure 403 {object} errors.AppError "无该空间成员关系"
// @Security Bearer
// @Router /auth/switch-tenant [post]
//
@@ -740,7 +740,7 @@ func (h *AuthHandler) SwitchTenant(c *gin.Context) {
RefreshToken string `json:"refresh_token"`
}
if err := c.ShouldBindJSON(&req); err != nil {
appErr := errors.NewValidationError("Invalid switch-tenant request").WithDetails(err.Error())
appErr := errors.NewValidationError("Invalid workspace switch request").WithDetails(err.Error())
c.Error(appErr)
return
}
@@ -755,7 +755,7 @@ func (h *AuthHandler) SwitchTenant(c *gin.Context) {
resp, err := h.userService.SwitchTenant(ctx, user, req.TenantID, req.RefreshToken)
if err != nil {
logger.Errorf(ctx, "SwitchTenant failed user=%s target=%d: %v", user.ID, req.TenantID, err)
appErr := errors.NewForbiddenError("switch tenant failed").WithDetails(err.Error())
appErr := errors.NewForbiddenError("workspace switch failed").WithDetails(err.Error())
c.Error(appErr)
return
}
@@ -764,7 +764,7 @@ func (h *AuthHandler) SwitchTenant(c *gin.Context) {
}
// @Summary 自动初始化(Lite 桌面版)
// @Description Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程
// @Description Lite 版专用:首次启动时自动创建默认用户和空间并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程
// @Tags 认证
// @Accept json
// @Produce json