summaryrefslogtreecommitdiff
path: root/src-migrate/types/auth.ts
blob: 02e3623d451a1c120600dbc30284c2b6fbfb7051 (plain)
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
import { registerSchema } from '~/validations/auth';
import { OdooApiRes } from './odoo';
import { z } from 'zod';

export type AuthProps = {
  id: number;
  parentId: number;
  parentName: string;
  partnerId: number;
  name: string;
  email: string;
  phone: string;
  mobile: string;
  external: boolean;
  company: boolean;
  pricelist: string | null;
  token: string;
};

export type AuthApiProps = OdooApiRes<AuthProps>;

export type RegisterProps = z.infer<typeof registerSchema>;

export type RegisterResApiProps = {
  register: boolean;
  reason: 'EMAIL_USED' | 'NOT_ACTIVE' | null;
};

type ActivationResProps = {
  activation: boolean;
  user: AuthProps | null;
};

export type ActivationTokenProps = {
  token: string;
};

export type ActivationTokenResApiProps = ActivationResProps & {
  reason: 'INVALID_TOKEN' | null;
};

export type ActivationOtpProps = {
  email: string;
  otp: string;
};

export type ActivationOtpResApiProps = ActivationResProps & {
  reason: 'INVALID_OTP' | null;
};

export type ActivationReqProps = {
  email: string;
};

export type ActivationReqResApiProps = {
  activation_request: boolean;
  reason: 'NOT_FOUND' | 'ACTIVE' | null;
};