-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemas.js
93 lines (87 loc) · 2.89 KB
/
schemas.js
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
const Joi = require('joi');
const { number } = require('joi');
module.exports.userSchema = Joi.object({
favorites: Joi.array().items(Joi.number()).max(10).required()
});
module.exports.postingSchema = Joi.object({
posting: Joi.object({
title: Joi.string().required(),
image: Joi.string().optional(),
description: Joi.string().required(),
location: Joi.string().required(),
}).required()
});
module.exports.commentSchema = Joi.object({
comment: Joi.object({
rating: Joi.number().optional().min(1).max(5),
body: Joi.string().required()
}).required()
})
module.exports.fixtureSchema = Joi.object({
fixture: Joi.object({
fixtureId: Joi.number().required(),
referee: Joi.string().required(),
timezone: Joi.string().required(),
date: Joi.date().required(),
timestamp: Joi.number().required(),
periods: Joi.object({
first: Joi.number().required(),
second: Joi.number().required(),
}).required(),
venue: Joi.object({
id: Joi.number().required(),
name: Joi.string().required(),
city: Joi.string().required(),
}).required(),
status: Joi.object({
long: Joi.string().required(),
short: Joi.string().required(),
elapsed: Joi.string().required(),
}).required()
}).required(),
league: Joi.object({
id: Joi.number().required(),
name: Joi.string().required(),
country: Joi.string().required(),
logo: Joi.string().required(),
flag: Joi.string().required(),
season: Joi.number().required(),
round: Joi.string().required()
}).required(),
teams: Joi.object({
home: Joi.object({
id: Joi.number().required(),
name: Joi.string().required(),
logo: Joi.string().required(),
winner: Joi.boolean().required()
}).required(),
away: Joi.object({
id: Joi.number().required(),
name: Joi.string().required(),
logo: Joi.string().required(),
winner: Joi.boolean().required()
}).required()
}).required(),
goals: Joi.object({
home: Joi.number().required(),
away: Joi.number().required()
}).required(),
score: Joi.object({
halftime: Joi.object({
home: Joi.number().required(),
away: Joi.number().required()
}).required(),
fulltime: Joi.object({
home: Joi.number().required(),
away: Joi.number().required()
}).required(),
extratime: Joi.object({
home: Joi.number().required(),
away: Joi.number().required()
}).required(),
penalty: Joi.object({
home: Joi.number().required(),
away: Joi.number().required()
}).required()
}).required()
});