All files / src/models auth.ts

0% Statements 0/0
0% Branches 1/1
0% Functions 1/1
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92                                                                                                                                                                                       
export type AvailabilityStatus = 'AVAILABLE' | 'TAKEN';
export type UserRole = 'USER' | 'ADMIN';
 
export interface CheckAvailabilityRequest {
  username: string;
  email: string;
}
 
export interface CheckAvailabilityResponse {
  username: AvailabilityStatus;
  email: AvailabilityStatus;
}
 
export interface RequestOtpRequest {
  email: string;
}
 
export interface RequestOtpResponse {
  status: 'accepted';
  message: string;
}
 
export interface LoginRequest {
  username: string;
  password: string;
}
 
export interface VerifyRegistrationRequest {
  email: string;
  otp: string;
  username: string;
  password: string;
  phone_number?: string | null;
  gender?: string | null;
  birth_date?: string | null;
}
 
export interface UserSummary {
  id: string;
  username: string;
  email: string;
  phone_number: string | null;
  email_verified: boolean;
  status: string;
  role: UserRole;
}
 
export interface AuthSessionResponse {
  access_token: string;
  refresh_token: string;
  token_type: 'Bearer';
  expires_in_seconds: number;
  user: UserSummary;
}
 
export interface RefreshRequest {
  refresh_token: string;
}
 
export interface LogoutRequest {
  refresh_token: string;
}
 
export interface ErrorBody {
  code: string;
  message: string;
  details?: Record<string, string>;
}
 
export interface ErrorResponse {
  error: ErrorBody;
}
 
export interface ForgotPasswordRequestOtpRequest {
  email: string;
}
 
export interface ForgotPasswordVerifyOtpRequest {
  email: string;
  otp: string;
}
 
export interface ForgotPasswordVerifyOtpResponse {
  reset_token: string;
}
 
export interface ForgotPasswordResetPasswordRequest {
  email: string;
  reset_token: string;
  new_password: string;
}