feat: implement TASK-WP1-05 account deletion
This commit is contained in:
@@ -169,6 +169,88 @@ export const LogoutResponseSchema = Type.Object(
|
||||
{ additionalProperties: false, $id: "LogoutResponse" },
|
||||
);
|
||||
|
||||
export const CsrfHeadersSchema = Type.Object(
|
||||
{
|
||||
"x-csrf-token": Type.String({ maxLength: 64, minLength: 43, pattern: "^[A-Za-z0-9_-]+$" }),
|
||||
},
|
||||
{ additionalProperties: true, $id: "CsrfHeaders" },
|
||||
);
|
||||
|
||||
export const AccountSettingsResponseSchema = Type.Object(
|
||||
{
|
||||
account: Type.Object(
|
||||
{
|
||||
email: Type.String({ maxLength: 320, pattern: emailPattern }),
|
||||
status: Type.Literal("active"),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
csrf_token: Type.String({ maxLength: 64, minLength: 43, pattern: "^[A-Za-z0-9_-]+$" }),
|
||||
local_data: Type.Object(
|
||||
{
|
||||
backup_enabled: Type.Literal(false),
|
||||
capacity_status: Type.Union([
|
||||
Type.Literal("normal"), Type.Literal("warning"), Type.Literal("critical"),
|
||||
Type.Literal("full"), Type.Literal("unavailable"),
|
||||
]),
|
||||
hard_limit_bytes: Type.Integer({ minimum: 1 }),
|
||||
location: Type.Literal("configured_local_data_root"),
|
||||
managed_content_bytes: Type.Integer({ minimum: 0 }),
|
||||
migration_supported: Type.Literal(false),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
profile: Type.Object(
|
||||
{
|
||||
creator_name: Type.String({ maxLength: 80, minLength: 1 }),
|
||||
social_id: Type.String({ maxLength: 80, minLength: 1 }),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
},
|
||||
{ additionalProperties: false, $id: "AccountSettingsResponse" },
|
||||
);
|
||||
|
||||
export const AccountProfileUpdateRequestSchema = Type.Object(
|
||||
{
|
||||
creator_name: Type.String({ maxLength: 80, minLength: 1 }),
|
||||
social_id: Type.String({ maxLength: 80, minLength: 1 }),
|
||||
},
|
||||
{ additionalProperties: false, $id: "AccountProfileUpdateRequest" },
|
||||
);
|
||||
|
||||
export const AccountProfileUpdateResponseSchema = Type.Object(
|
||||
{
|
||||
profile: AccountSettingsResponseSchema.properties.profile,
|
||||
status: Type.Literal("saved"),
|
||||
},
|
||||
{ additionalProperties: false, $id: "AccountProfileUpdateResponse" },
|
||||
);
|
||||
|
||||
export const AccountDeletionSendResponseSchema = Type.Object(
|
||||
{
|
||||
challenge_expires_at: Type.String({ pattern: isoTimestampPattern }),
|
||||
deletion_id: Type.String({ pattern: uuidPattern }),
|
||||
resend_available_at: Type.String({ pattern: isoTimestampPattern }),
|
||||
status: Type.Literal("verification_sent"),
|
||||
},
|
||||
{ additionalProperties: false, $id: "AccountDeletionSendResponse" },
|
||||
);
|
||||
|
||||
export const AccountDeletionCompleteRequestSchema = Type.Object(
|
||||
{
|
||||
confirmation: Type.Literal("注销账号"),
|
||||
deletion_id: Type.String({ pattern: uuidPattern }),
|
||||
verification_code: Type.String({ pattern: "^[0-9]{6}$" }),
|
||||
},
|
||||
{ additionalProperties: false, $id: "AccountDeletionCompleteRequest" },
|
||||
);
|
||||
|
||||
export const AccountDeletionResponseSchema = Type.Object(
|
||||
{ status: Type.Literal("deleted") },
|
||||
{ additionalProperties: false, $id: "AccountDeletionResponse" },
|
||||
);
|
||||
|
||||
export type RegistrationSendRequest = Static<typeof RegistrationSendRequestSchema>;
|
||||
export type RegistrationSendResponse = Static<typeof RegistrationSendResponseSchema>;
|
||||
export type RegistrationCompleteRequest = Static<typeof RegistrationCompleteRequestSchema>;
|
||||
@@ -178,3 +260,5 @@ export type LoginSendRequest = Static<typeof LoginSendRequestSchema>;
|
||||
export type LoginCompleteRequest = Static<typeof LoginCompleteRequestSchema>;
|
||||
export type AdminLoginSendRequest = Static<typeof AdminLoginSendRequestSchema>;
|
||||
export type AdminLoginCompleteRequest = Static<typeof AdminLoginCompleteRequestSchema>;
|
||||
export type AccountProfileUpdateRequest = Static<typeof AccountProfileUpdateRequestSchema>;
|
||||
export type AccountDeletionCompleteRequest = Static<typeof AccountDeletionCompleteRequestSchema>;
|
||||
|
||||
Reference in New Issue
Block a user