-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathtypes.ts
60 lines (50 loc) · 1.3 KB
/
types.ts
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
import { type NextPage } from 'next';
import { type User } from 'next-auth';
import { z } from 'zod';
// eslint-disable-next-line @typescript-eslint/ban-types
export type NextPageWithUser<T = {}> = NextPage<{ user: User } & T> & { auth: boolean };
export type PushMessage = { title: string; message: string };
export type SplitwisePicture = {
small: string;
medium: string;
large: string;
};
export type SplitwiseBalance = {
currency_code: string;
amount: string;
};
export type SplitwiseUser = {
id: number;
first_name: string;
last_name: string | null;
email: string;
balance: SplitwiseBalance[];
picture: SplitwisePicture;
};
export type SplitwiseGroup = {
id: number;
name: string;
members: SplitwiseUser[];
};
const SplitwisePictureSchema = z.object({
small: z.string(),
medium: z.string(),
large: z.string(),
});
const SplitwiseBalanceSchema = z.object({
currency_code: z.string(),
amount: z.string(),
});
export const SplitwiseUserSchema = z.object({
id: z.number(),
first_name: z.string(),
last_name: z.string().nullable(),
email: z.string().email(),
balance: z.array(SplitwiseBalanceSchema),
picture: SplitwisePictureSchema,
});
export const SplitwiseGroupSchema = z.object({
id: z.number(),
name: z.string(),
members: z.array(SplitwiseUserSchema),
});