batchCooking/packages/shared/src/schemas/account.ts
Nicolas 1248461125 Shared: types/schémas/codes d'erreur pour foyer admin/invitation + suppression de compte (step 1/8)
- HouseView gagne adminId/inviteCode/members (HouseMemberView)
- createHouseSchema, joinHouseSchema
- deleteAccountSchema (nouveau packages/shared/src/schemas/account.ts)
- ErrorCode: ALREADY_HAS_HOUSE, NOT_HOUSE_ADMIN, INVITE_CODE_NOT_FOUND
2026-08-17 10:37:50 +02:00

15 lines
649 B
TypeScript

import { z } from "zod";
// See schemas/auth.ts for the shared client/server validation rationale.
/**
* Payload accepted by `DELETE /auth/me`. Deleting an account is
* irreversible, so it's gated behind re-entering the current password —
* same idea as `loginSchema`'s password field (presence only, the API does
* the real `argon2.verify`), not a fresh set of complexity rules.
*/
export const deleteAccountSchema = z.object({
password: z.string().min(1, "Le mot de passe est requis"),
});
/** Inferred TS type for {@link deleteAccountSchema}'s validated output. */
export type DeleteAccountInput = z.infer<typeof deleteAccountSchema>;