File size: 1,610 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
const invitesArraySchema = {
	type: 'array',
	items: {
		type: 'object',
		properties: {
			key: { type: 'string' },
			role: { type: 'string' },
			isPending: { type: 'boolean' },
			inviteDate: { type: 'string' },
			acceptedDate: { anyOf: [ { type: 'string' }, { enum: [ null ] } ] },
			user: {
				type: 'object',
				properties: {
					login: { type: 'string' },
					email: { anyOf: [ { type: 'string' }, { enum: [ false ] } ] },
					name: { type: 'string' },
					avatar_URL: { type: 'string' },
				},
				additionalProperties: false,
			},
			invitedBy: {
				type: 'object',
				properties: {
					login: { type: 'string' },
					name: { type: 'string' },
					avatar_URL: { type: 'string' },
				},
				additionalProperties: false,
			},
		},
		additionalProperties: false,
	},
};

export const inviteItemsSchema = {
	type: 'object',
	patternProperties: {
		// Site ID
		'^\\d+$': {
			type: 'object',
			properties: {
				pending: invitesArraySchema,
				accepted: invitesArraySchema,
			},
			required: [ 'pending', 'accepted' ],
			additionalProperties: false,
		},
	},
};

const inviteLinksArraySchema = {
	type: 'array',
	items: {
		type: 'object',
		properties: {
			key: { type: 'string' },
			link: { type: 'string' },
			role: { type: 'string' },
			inviteDate: { type: 'string' },
			expiry: { type: 'string' },
		},
		additionalProperties: false,
	},
};

export const inviteLinksSchema = {
	type: 'object',
	patternProperties: {
		// Site ID
		'^\\d+$': {
			type: 'object',
			properties: {
				'^\\[a-zA-Z]+$': inviteLinksArraySchema,
			},
			additionalProperties: true,
		},
	},
};