feat(server,web): add force delete to immediately remove user (#7681)

* feat(server,web): add force delete to immediately remove user

* update wording on force delete confirmation

* fix force delete css

* PR feedback

* cleanup user service delete for force

* adding user status column

* some cleanup and tests

* more test fixes

* run npm run sql:generate

* chore: cleanup and websocket

* chore: linting

* userRepository.restore

* removed bad color class from delete-confirm-dialoge

* additional confirmation for user force delete

* shorten confirmation message

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Sam Holton
2024-03-08 17:49:39 -05:00
committed by GitHub
parent 9cb0a1ffbf
commit 7a4ae7d142
47 changed files with 628 additions and 97 deletions

View File

@@ -6402,6 +6402,16 @@
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeleteUserDto"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
@@ -7750,6 +7760,14 @@
],
"type": "object"
},
"DeleteUserDto": {
"properties": {
"force": {
"type": "boolean"
}
},
"type": "object"
},
"DownloadArchiveInfo": {
"properties": {
"assetIds": {
@@ -8616,6 +8634,9 @@
"shouldChangePassword": {
"type": "boolean"
},
"status": {
"$ref": "#/components/schemas/UserStatus"
},
"storageLabel": {
"nullable": true,
"type": "string"
@@ -8638,6 +8659,7 @@
"quotaSizeInBytes",
"quotaUsageInBytes",
"shouldChangePassword",
"status",
"storageLabel",
"updatedAt"
],
@@ -10561,6 +10583,9 @@
"shouldChangePassword": {
"type": "boolean"
},
"status": {
"$ref": "#/components/schemas/UserStatus"
},
"storageLabel": {
"nullable": true,
"type": "string"
@@ -10583,11 +10608,20 @@
"quotaSizeInBytes",
"quotaUsageInBytes",
"shouldChangePassword",
"status",
"storageLabel",
"updatedAt"
],
"type": "object"
},
"UserStatus": {
"enum": [
"active",
"removing",
"deleted"
],
"type": "string"
},
"ValidateAccessTokenResponseDto": {
"properties": {
"authStatus": {

View File

@@ -75,6 +75,7 @@ export type UserResponseDto = {
quotaSizeInBytes: number | null;
quotaUsageInBytes: number | null;
shouldChangePassword: boolean;
status: UserStatus;
storageLabel: string | null;
updatedAt: string;
};
@@ -518,6 +519,7 @@ export type PartnerResponseDto = {
quotaSizeInBytes: number | null;
quotaUsageInBytes: number | null;
shouldChangePassword: boolean;
status: UserStatus;
storageLabel: string | null;
updatedAt: string;
};
@@ -994,6 +996,9 @@ export type CreateProfileImageResponseDto = {
profileImagePath: string;
userId: string;
};
export type DeleteUserDto = {
force?: boolean;
};
export function getActivities({ albumId, assetId, level, $type, userId }: {
albumId: string;
assetId?: string;
@@ -2678,16 +2683,18 @@ export function getProfileImage({ id }: {
...opts
}));
}
export function deleteUser({ id }: {
export function deleteUser({ id, deleteUserDto }: {
id: string;
deleteUserDto: DeleteUserDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: UserResponseDto;
}>(`/user/${encodeURIComponent(id)}`, {
}>(`/user/${encodeURIComponent(id)}`, oazapfts.json({
...opts,
method: "DELETE"
}));
method: "DELETE",
body: deleteUserDto
})));
}
export function restoreUser({ id }: {
id: string;
@@ -2724,6 +2731,11 @@ export enum UserAvatarColor {
Gray = "gray",
Amber = "amber"
}
export enum UserStatus {
Active = "active",
Removing = "removing",
Deleted = "deleted"
}
export enum TagTypeEnum {
Object = "OBJECT",
Face = "FACE",