mirror of
https://github.com/go-sigma/sigma.git
synced 2026-10-28 14:34:34 +08:00
refactor(api): rename UserStatus Deactive to Inactive
"Deactive" is not a valid English word; the standard antonym of "Active" is "Inactive". Restore the enum value, regenerate the go-enum output, update the CLI test expectation, sync the generated swagger enum and x-enum-varnames, and fix the web UI request payload and label. Note: persisted rows and API clients using the old "Deactive" value must switch to "Inactive"; no data migration is included. Verification: - go build -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./... - go vet -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./pkg/api/enums/... ./cmd/cli/... - CI_DATABASE_TYPE=turso go test -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./pkg/server/validators/...
This commit is contained in:
1 parent
00735de3b1
commit
ffe28bb78e
5 files changed
+10
-10
No files matched your search
@@ -266,7 +266,7 @@ func TestResourceCommands(t *testing.T) {
|
||||
{
|
||||
name: "user update",
|
||||
command: newUserUpdateCmd,
|
||||
args: []string{"user-1", "--username", "sigma", "--password", "secret", "--email", "sigma@example.test", "--role", enums.UserRoleAdmin.String(), "--status", enums.UserStatusDeactive.String(), "--namespace-limit", "10"},
|
||||
args: []string{"user-1", "--username", "sigma", "--password", "secret", "--email", "sigma@example.test", "--role", enums.UserRoleAdmin.String(), "--status", enums.UserStatusInactive.String(), "--namespace-limit", "10"},
|
||||
method: http.MethodPut,
|
||||
path: "/api/v1/users/user-1",
|
||||
body: map[string]any{
|
||||
@@ -274,7 +274,7 @@ func TestResourceCommands(t *testing.T) {
|
||||
"password": "secret",
|
||||
"email": "sigma@example.test",
|
||||
"role": enums.UserRoleAdmin.String(),
|
||||
"status": enums.UserStatusDeactive.String(),
|
||||
"status": enums.UserStatusInactive.String(),
|
||||
"namespace_limit": float64(10),
|
||||
},
|
||||
outputMatch: `"status": "updated"`,
|
||||
|
||||
@@ -265,7 +265,7 @@ type SigningType string
|
||||
|
||||
// UserStatus x ENUM(
|
||||
// Active,
|
||||
// Deactive,
|
||||
// Inactive,
|
||||
// )
|
||||
type UserStatus string
|
||||
|
||||
|
||||
@@ -3031,8 +3031,8 @@ func (x UserRole) Value() (driver.Value, error) {
|
||||
const (
|
||||
// UserStatusActive is a UserStatus of type Active.
|
||||
UserStatusActive UserStatus = "Active"
|
||||
// UserStatusDeactive is a UserStatus of type Deactive.
|
||||
UserStatusDeactive UserStatus = "Deactive"
|
||||
// UserStatusInactive is a UserStatus of type Inactive.
|
||||
UserStatusInactive UserStatus = "Inactive"
|
||||
)
|
||||
|
||||
var ErrInvalidUserStatus = errors.New("not a valid UserStatus")
|
||||
@@ -3051,7 +3051,7 @@ func (x UserStatus) IsValid() bool {
|
||||
|
||||
var _UserStatusValue = map[string]UserStatus{
|
||||
"Active": UserStatusActive,
|
||||
"Deactive": UserStatusDeactive,
|
||||
"Inactive": UserStatusInactive,
|
||||
}
|
||||
|
||||
// ParseUserStatus attempts to convert a string to a UserStatus.
|
||||
|
||||
@@ -1945,11 +1945,11 @@ definitions:
|
||||
enums.UserStatus:
|
||||
enum:
|
||||
- Active
|
||||
- Deactive
|
||||
- Inactive
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- UserStatusActive
|
||||
- UserStatusDeactive
|
||||
- UserStatusInactive
|
||||
enums.Visibility:
|
||||
enum:
|
||||
- private
|
||||
|
||||
@@ -333,7 +333,7 @@ function TableItemRow({ localServer, user, setRefresh, selfUsername }: { localSe
|
||||
<DropdownMenuItem
|
||||
disabled={isSelf}
|
||||
onClick={() => {
|
||||
axios.put(localServer + `/api/v1/users/${user.id}`, { status: "Deactive" }).then(response => {
|
||||
axios.put(localServer + `/api/v1/users/${user.id}`, { status: "Inactive" }).then(response => {
|
||||
if (response?.status === 204) {
|
||||
Toast({ level: "success", title: "Success", message: "Deactivate user success" });
|
||||
setRefresh({});
|
||||
@@ -345,7 +345,7 @@ function TableItemRow({ localServer, user, setRefresh, selfUsername }: { localSe
|
||||
}}
|
||||
>
|
||||
<Ban />
|
||||
<span>Deactive</span>
|
||||
<span>Inactive</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
Reference in new issue
Block a user