tenniscommon 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/cjs/common/general/generalInterfaces.d.ts +16 -0
- package/dist/cjs/common/general/generalInterfaces.js +2 -0
- package/dist/cjs/common/general/generalUtils.d.ts +88 -0
- package/dist/cjs/common/general/generalUtils.js +148 -0
- package/dist/cjs/common/general/index.d.ts +2 -0
- package/dist/cjs/common/general/index.js +18 -0
- package/dist/cjs/common/matchplay/index.d.ts +4 -0
- package/dist/cjs/common/matchplay/index.js +20 -0
- package/dist/cjs/common/matchplay/initialData.d.ts +3 -0
- package/dist/cjs/common/matchplay/initialData.js +65 -0
- package/dist/cjs/common/matchplay/initialStats.d.ts +7 -0
- package/dist/cjs/common/matchplay/initialStats.js +105 -0
- package/dist/cjs/common/matchplay/initialTotals.d.ts +4 -0
- package/dist/cjs/common/matchplay/initialTotals.js +72 -0
- package/dist/cjs/common/matchplay/interfaces.d.ts +184 -0
- package/dist/cjs/common/matchplay/interfaces.js +106 -0
- package/dist/cjs/common/matchplay/validation.d.ts +783 -0
- package/dist/cjs/common/matchplay/validation.js +108 -0
- package/dist/cjs/common/opponent/index.d.ts +3 -0
- package/dist/cjs/common/opponent/index.js +19 -0
- package/dist/cjs/common/opponent/initialData.d.ts +3 -0
- package/dist/cjs/common/opponent/initialData.js +25 -0
- package/dist/cjs/common/opponent/interfaces.d.ts +22 -0
- package/dist/cjs/common/opponent/interfaces.js +8 -0
- package/dist/cjs/common/opponent/validation.d.ts +23 -0
- package/dist/cjs/common/opponent/validation.js +13 -0
- package/dist/cjs/common/performance/index.d.ts +3 -0
- package/dist/cjs/common/performance/index.js +19 -0
- package/dist/cjs/common/performance/initialData.d.ts +2 -0
- package/dist/cjs/common/performance/initialData.js +13 -0
- package/dist/cjs/common/performance/interfaces.d.ts +68 -0
- package/dist/cjs/common/performance/interfaces.js +37 -0
- package/dist/cjs/common/performance/validation.d.ts +17 -0
- package/dist/cjs/common/performance/validation.js +11 -0
- package/dist/cjs/common/player/index.d.ts +3 -0
- package/dist/cjs/common/player/index.js +19 -0
- package/dist/cjs/common/player/initialData.d.ts +37 -0
- package/dist/cjs/common/player/initialData.js +60 -0
- package/dist/cjs/common/player/interfaces.d.ts +28 -0
- package/dist/cjs/common/player/interfaces.js +2 -0
- package/dist/cjs/common/player/validation.d.ts +204 -0
- package/dist/cjs/common/player/validation.js +38 -0
- package/dist/cjs/common/spending/index.d.ts +4 -0
- package/dist/cjs/common/spending/index.js +20 -0
- package/dist/cjs/common/spending/initialData.d.ts +2 -0
- package/dist/cjs/common/spending/initialData.js +15 -0
- package/dist/cjs/common/spending/initialStats.d.ts +2 -0
- package/dist/cjs/common/spending/initialStats.js +29 -0
- package/dist/cjs/common/spending/initialTotals.d.ts +2 -0
- package/dist/cjs/common/spending/initialTotals.js +29 -0
- package/dist/cjs/common/spending/interfaces.d.ts +61 -0
- package/dist/cjs/common/spending/interfaces.js +41 -0
- package/dist/cjs/common/spending/validation.d.ts +39 -0
- package/dist/cjs/common/spending/validation.js +22 -0
- package/dist/cjs/common/tournament/index.d.ts +3 -0
- package/dist/cjs/common/tournament/index.js +19 -0
- package/dist/cjs/common/tournament/initialData.d.ts +3 -0
- package/dist/cjs/common/tournament/initialData.js +27 -0
- package/dist/cjs/common/tournament/interfaces.d.ts +43 -0
- package/dist/cjs/common/tournament/interfaces.js +27 -0
- package/dist/cjs/common/tournament/validation.d.ts +49 -0
- package/dist/cjs/common/tournament/validation.js +25 -0
- package/dist/cjs/common/training/index.d.ts +4 -0
- package/dist/cjs/common/training/index.js +20 -0
- package/dist/cjs/common/training/initialData.d.ts +2 -0
- package/dist/cjs/common/training/initialData.js +14 -0
- package/dist/cjs/common/training/initialStats.d.ts +2 -0
- package/dist/cjs/common/training/initialStats.js +27 -0
- package/dist/cjs/common/training/initialTotals.d.ts +2 -0
- package/dist/cjs/common/training/initialTotals.js +27 -0
- package/dist/cjs/common/training/interfaces.d.ts +40 -0
- package/dist/cjs/common/training/interfaces.js +17 -0
- package/dist/cjs/common/training/validation.d.ts +20 -0
- package/dist/cjs/common/training/validation.js +11 -0
- package/dist/cjs/common/trainingWeekly/index.d.ts +3 -0
- package/dist/cjs/common/trainingWeekly/index.js +19 -0
- package/dist/cjs/common/trainingWeekly/initialData.d.ts +2 -0
- package/dist/cjs/common/trainingWeekly/initialData.js +17 -0
- package/dist/cjs/common/trainingWeekly/interfaces.d.ts +12 -0
- package/dist/cjs/common/trainingWeekly/interfaces.js +2 -0
- package/dist/cjs/common/trainingWeekly/validation.d.ts +23 -0
- package/dist/cjs/common/trainingWeekly/validation.js +12 -0
- package/dist/esm/common/general/generalInterfaces.d.ts +16 -0
- package/dist/esm/common/general/generalInterfaces.js +1 -0
- package/dist/esm/common/general/generalUtils.d.ts +88 -0
- package/dist/esm/common/general/generalUtils.js +133 -0
- package/dist/esm/common/general/index.d.ts +2 -0
- package/dist/esm/common/general/index.js +2 -0
- package/dist/esm/common/matchplay/index.d.ts +4 -0
- package/dist/esm/common/matchplay/index.js +4 -0
- package/dist/esm/common/matchplay/initialData.d.ts +3 -0
- package/dist/esm/common/matchplay/initialData.js +61 -0
- package/dist/esm/common/matchplay/initialStats.d.ts +7 -0
- package/dist/esm/common/matchplay/initialStats.js +96 -0
- package/dist/esm/common/matchplay/initialTotals.d.ts +4 -0
- package/dist/esm/common/matchplay/initialTotals.js +66 -0
- package/dist/esm/common/matchplay/interfaces.d.ts +184 -0
- package/dist/esm/common/matchplay/interfaces.js +103 -0
- package/dist/esm/common/matchplay/validation.d.ts +783 -0
- package/dist/esm/common/matchplay/validation.js +105 -0
- package/dist/esm/common/opponent/index.d.ts +3 -0
- package/dist/esm/common/opponent/index.js +3 -0
- package/dist/esm/common/opponent/initialData.d.ts +3 -0
- package/dist/esm/common/opponent/initialData.js +21 -0
- package/dist/esm/common/opponent/interfaces.d.ts +22 -0
- package/dist/esm/common/opponent/interfaces.js +5 -0
- package/dist/esm/common/opponent/validation.d.ts +23 -0
- package/dist/esm/common/opponent/validation.js +10 -0
- package/dist/esm/common/performance/index.d.ts +3 -0
- package/dist/esm/common/performance/index.js +3 -0
- package/dist/esm/common/performance/initialData.d.ts +2 -0
- package/dist/esm/common/performance/initialData.js +10 -0
- package/dist/esm/common/performance/interfaces.d.ts +68 -0
- package/dist/esm/common/performance/interfaces.js +34 -0
- package/dist/esm/common/performance/validation.d.ts +17 -0
- package/dist/esm/common/performance/validation.js +8 -0
- package/dist/esm/common/player/index.d.ts +3 -0
- package/dist/esm/common/player/index.js +3 -0
- package/dist/esm/common/player/initialData.d.ts +37 -0
- package/dist/esm/common/player/initialData.js +55 -0
- package/dist/esm/common/player/interfaces.d.ts +28 -0
- package/dist/esm/common/player/interfaces.js +1 -0
- package/dist/esm/common/player/validation.d.ts +204 -0
- package/dist/esm/common/player/validation.js +35 -0
- package/dist/esm/common/spending/index.d.ts +4 -0
- package/dist/esm/common/spending/index.js +4 -0
- package/dist/esm/common/spending/initialData.d.ts +2 -0
- package/dist/esm/common/spending/initialData.js +12 -0
- package/dist/esm/common/spending/initialStats.d.ts +2 -0
- package/dist/esm/common/spending/initialStats.js +25 -0
- package/dist/esm/common/spending/initialTotals.d.ts +2 -0
- package/dist/esm/common/spending/initialTotals.js +25 -0
- package/dist/esm/common/spending/interfaces.d.ts +61 -0
- package/dist/esm/common/spending/interfaces.js +37 -0
- package/dist/esm/common/spending/validation.d.ts +39 -0
- package/dist/esm/common/spending/validation.js +19 -0
- package/dist/esm/common/tournament/index.d.ts +3 -0
- package/dist/esm/common/tournament/index.js +3 -0
- package/dist/esm/common/tournament/initialData.d.ts +3 -0
- package/dist/esm/common/tournament/initialData.js +23 -0
- package/dist/esm/common/tournament/interfaces.d.ts +43 -0
- package/dist/esm/common/tournament/interfaces.js +24 -0
- package/dist/esm/common/tournament/validation.d.ts +49 -0
- package/dist/esm/common/tournament/validation.js +22 -0
- package/dist/esm/common/training/index.d.ts +4 -0
- package/dist/esm/common/training/index.js +4 -0
- package/dist/esm/common/training/initialData.d.ts +2 -0
- package/dist/esm/common/training/initialData.js +11 -0
- package/dist/esm/common/training/initialStats.d.ts +2 -0
- package/dist/esm/common/training/initialStats.js +23 -0
- package/dist/esm/common/training/initialTotals.d.ts +2 -0
- package/dist/esm/common/training/initialTotals.js +23 -0
- package/dist/esm/common/training/interfaces.d.ts +40 -0
- package/dist/esm/common/training/interfaces.js +14 -0
- package/dist/esm/common/training/validation.d.ts +20 -0
- package/dist/esm/common/training/validation.js +8 -0
- package/dist/esm/common/trainingWeekly/index.d.ts +3 -0
- package/dist/esm/common/trainingWeekly/index.js +3 -0
- package/dist/esm/common/trainingWeekly/initialData.d.ts +2 -0
- package/dist/esm/common/trainingWeekly/initialData.js +14 -0
- package/dist/esm/common/trainingWeekly/interfaces.d.ts +12 -0
- package/dist/esm/common/trainingWeekly/interfaces.js +1 -0
- package/dist/esm/common/trainingWeekly/validation.d.ts +23 -0
- package/dist/esm/common/trainingWeekly/validation.js +9 -0
- package/dist/types/common/general/generalInterfaces.d.ts +16 -0
- package/dist/types/common/general/generalUtils.d.ts +88 -0
- package/dist/types/common/general/index.d.ts +2 -0
- package/dist/types/common/matchplay/index.d.ts +4 -0
- package/dist/types/common/matchplay/initialData.d.ts +3 -0
- package/dist/types/common/matchplay/initialStats.d.ts +7 -0
- package/dist/types/common/matchplay/initialTotals.d.ts +4 -0
- package/dist/types/common/matchplay/interfaces.d.ts +184 -0
- package/dist/types/common/matchplay/validation.d.ts +783 -0
- package/dist/types/common/opponent/index.d.ts +3 -0
- package/dist/types/common/opponent/initialData.d.ts +3 -0
- package/dist/types/common/opponent/interfaces.d.ts +22 -0
- package/dist/types/common/opponent/validation.d.ts +23 -0
- package/dist/types/common/performance/index.d.ts +3 -0
- package/dist/types/common/performance/initialData.d.ts +2 -0
- package/dist/types/common/performance/interfaces.d.ts +68 -0
- package/dist/types/common/performance/validation.d.ts +17 -0
- package/dist/types/common/player/index.d.ts +3 -0
- package/dist/types/common/player/initialData.d.ts +37 -0
- package/dist/types/common/player/interfaces.d.ts +28 -0
- package/dist/types/common/player/validation.d.ts +204 -0
- package/dist/types/common/spending/index.d.ts +4 -0
- package/dist/types/common/spending/initialData.d.ts +2 -0
- package/dist/types/common/spending/initialStats.d.ts +2 -0
- package/dist/types/common/spending/initialTotals.d.ts +2 -0
- package/dist/types/common/spending/interfaces.d.ts +61 -0
- package/dist/types/common/spending/validation.d.ts +39 -0
- package/dist/types/common/tournament/index.d.ts +3 -0
- package/dist/types/common/tournament/initialData.d.ts +3 -0
- package/dist/types/common/tournament/interfaces.d.ts +43 -0
- package/dist/types/common/tournament/validation.d.ts +49 -0
- package/dist/types/common/training/index.d.ts +4 -0
- package/dist/types/common/training/initialData.d.ts +2 -0
- package/dist/types/common/training/initialStats.d.ts +2 -0
- package/dist/types/common/training/initialTotals.d.ts +2 -0
- package/dist/types/common/training/interfaces.d.ts +40 -0
- package/dist/types/common/training/validation.d.ts +20 -0
- package/dist/types/common/trainingWeekly/index.d.ts +3 -0
- package/dist/types/common/trainingWeekly/initialData.d.ts +2 -0
- package/dist/types/common/trainingWeekly/interfaces.d.ts +12 -0
- package/dist/types/common/trainingWeekly/validation.d.ts +23 -0
- package/package.json +95 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Add a match to Singles
|
|
3
|
+
export const singlesMatchplayItemSchema = z.object({
|
|
4
|
+
playerId: z.string().min(1, 'PlayerId is required.'),
|
|
5
|
+
date: z.preprocess(arg => (typeof arg === 'string' || arg instanceof Date ? new Date(arg) : undefined), z.date().refine(date => !isNaN(date.getTime()), 'Invalid date.')),
|
|
6
|
+
tournamentId: z.string().min(1, 'Tournament is required.'),
|
|
7
|
+
tournamentYearId: z.string().min(1, 'Tournament Year is required.'),
|
|
8
|
+
matchFormat: z.string().min(1, 'Match Format is required.'),
|
|
9
|
+
matchAgeGroup: z.string().min(1, 'Match Age Group is required.'),
|
|
10
|
+
matchRound: z.string().min(1, 'Tournament Round is required.'),
|
|
11
|
+
matchSurface: z.string().min(1, 'Match Surface is required.'),
|
|
12
|
+
matchLocation: z.string().min(1, 'Match Location is required.'),
|
|
13
|
+
matchSetFormat: z.string().min(1, 'Match Set Format is required.'),
|
|
14
|
+
matchResult: z.string().min(1, 'Match Result is required.'),
|
|
15
|
+
partnerId: z.string().optional(),
|
|
16
|
+
opponentId: z.string().min(1, 'Opponent is required.'),
|
|
17
|
+
opponentIdTeo: z.string().optional(),
|
|
18
|
+
firstSetWon: z.string().min(1, 'First Set Winner is required.'),
|
|
19
|
+
secondSetWon: z.string().min(1, 'Second Set Winner is required.'),
|
|
20
|
+
decidingSetFormat: z.string().optional(),
|
|
21
|
+
decidingSetWon: z.string().optional(),
|
|
22
|
+
firstSet: z.string().min(1, 'First Set Score is required.'),
|
|
23
|
+
firstSetTieBreak: z.string().optional(),
|
|
24
|
+
secondSet: z.string().min(1, 'Second Set Score is required.'),
|
|
25
|
+
secondSetTieBreak: z.string().optional(),
|
|
26
|
+
decidingSet: z.string().optional(),
|
|
27
|
+
decidingSetTieBreak: z.string().optional(),
|
|
28
|
+
comment: z.string().optional(),
|
|
29
|
+
})
|
|
30
|
+
.refine(data => !(data.firstSet === '7-6' || data.firstSet === '6-7') || !!data.firstSetTieBreak, {
|
|
31
|
+
message: 'First Set Tie Break Score is required',
|
|
32
|
+
path: ['firstSetTieBreak'],
|
|
33
|
+
})
|
|
34
|
+
.refine(data => !(data.secondSet === '7-6' || data.secondSet === '6-7') || !!data.secondSetTieBreak, {
|
|
35
|
+
message: 'Second Set Tie Break Score is required',
|
|
36
|
+
path: ['secondSetTieBreak'],
|
|
37
|
+
})
|
|
38
|
+
.refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSetFormat, {
|
|
39
|
+
message: 'Deciding Set format is required.',
|
|
40
|
+
path: ['decidingSetFormat'],
|
|
41
|
+
})
|
|
42
|
+
.refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSetWon, {
|
|
43
|
+
message: 'Deciding Set Winner is required',
|
|
44
|
+
path: ['decidingSetWon'],
|
|
45
|
+
})
|
|
46
|
+
.refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSet, {
|
|
47
|
+
message: 'Deciding Set Score is required',
|
|
48
|
+
path: ['decidingSet'],
|
|
49
|
+
})
|
|
50
|
+
.refine(data => data.firstSetWon === data.secondSetWon || !(data.decidingSet === '7-6' || data.decidingSet === '6-7') || !!data.decidingSetTieBreak, {
|
|
51
|
+
message: 'Deciding Set Tie Break is required',
|
|
52
|
+
path: ['decidingSetTieBreak'],
|
|
53
|
+
});
|
|
54
|
+
// Add a match to Doubles
|
|
55
|
+
export const doublesMatchplayItemSchema = z.object({
|
|
56
|
+
playerId: z.string().min(1, 'PlayerId is required.'),
|
|
57
|
+
date: z.preprocess(arg => (typeof arg === 'string' || arg instanceof Date ? new Date(arg) : undefined), z.date().refine(date => !isNaN(date.getTime()), 'Invalid date.')),
|
|
58
|
+
tournamentId: z.string().min(1, 'Tournament is required.'),
|
|
59
|
+
tournamentYearId: z.string().min(1, 'Tournament Year is required.'),
|
|
60
|
+
matchFormat: z.string().min(1, 'Match Format is required.'),
|
|
61
|
+
matchAgeGroup: z.string().min(1, 'Match Age Group is required.'),
|
|
62
|
+
matchRound: z.string().min(1, 'Tournament Round is required.'),
|
|
63
|
+
matchSurface: z.string().min(1, 'Match Surface is required.'),
|
|
64
|
+
matchLocation: z.string().min(1, 'Match Location is required.'),
|
|
65
|
+
matchSetFormat: z.string().min(1, 'Match Set Format is required.'),
|
|
66
|
+
matchResult: z.string().min(1, 'Match Result is required.'),
|
|
67
|
+
partnerId: z.string().min(1, 'Partner is required.'),
|
|
68
|
+
opponentId: z.string().min(1, 'Opponent is required.'),
|
|
69
|
+
opponentIdTwo: z.string().min(1, 'Opponent two is required.'),
|
|
70
|
+
firstSetWon: z.string().min(1, 'First Set Winner is required.'),
|
|
71
|
+
secondSetWon: z.string().min(1, 'Second Set Winner is required.'),
|
|
72
|
+
decidingSetFormat: z.string().optional(),
|
|
73
|
+
decidingSetWon: z.string().optional(),
|
|
74
|
+
firstSet: z.string().min(1, 'First Set Score is required.'),
|
|
75
|
+
firstSetTieBreak: z.string().optional(),
|
|
76
|
+
secondSet: z.string().min(1, 'Second Set Score is required.'),
|
|
77
|
+
secondSetTieBreak: z.string().optional(),
|
|
78
|
+
decidingSet: z.string().optional(),
|
|
79
|
+
decidingSetTieBreak: z.string().optional(),
|
|
80
|
+
comment: z.string().optional(),
|
|
81
|
+
})
|
|
82
|
+
.refine(data => !(data.firstSet === '7-6' || data.firstSet === '6-7') || !!data.firstSetTieBreak, {
|
|
83
|
+
message: 'First Set Tie Break Score is required',
|
|
84
|
+
path: ['firstSetTieBreak'],
|
|
85
|
+
})
|
|
86
|
+
.refine(data => !(data.secondSet === '7-6' || data.secondSet === '6-7') || !!data.secondSetTieBreak, {
|
|
87
|
+
message: 'Second Set Tie Break Score is required',
|
|
88
|
+
path: ['secondSetTieBreak'],
|
|
89
|
+
})
|
|
90
|
+
.refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSetFormat, {
|
|
91
|
+
message: 'Deciding Set format is required.',
|
|
92
|
+
path: ['decidingSetFormat'],
|
|
93
|
+
})
|
|
94
|
+
.refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSetWon, {
|
|
95
|
+
message: 'Deciding Set Winner is required',
|
|
96
|
+
path: ['decidingSetWon'],
|
|
97
|
+
})
|
|
98
|
+
.refine(data => data.firstSetWon === data.secondSetWon || !!data.decidingSet, {
|
|
99
|
+
message: 'Deciding Set Score is required',
|
|
100
|
+
path: ['decidingSet'],
|
|
101
|
+
})
|
|
102
|
+
.refine(data => data.firstSetWon === data.secondSetWon || !(data.decidingSet === '7-6' || data.decidingSet === '6-7') || !!data.decidingSetTieBreak, {
|
|
103
|
+
message: 'Deciding Set Tie Break is required',
|
|
104
|
+
path: ['decidingSetTieBreak'],
|
|
105
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HAND } from './interfaces';
|
|
2
|
+
import { COMMONS } from '../general';
|
|
3
|
+
import { createBasicStatsPack } from '../matchplay';
|
|
4
|
+
export function createInitialOpponentItem(playerId, born) {
|
|
5
|
+
return {
|
|
6
|
+
_id: '',
|
|
7
|
+
playerId: playerId,
|
|
8
|
+
name: '',
|
|
9
|
+
born: born,
|
|
10
|
+
hand: HAND.Right,
|
|
11
|
+
show: COMMONS.BOOLEAN.Yes,
|
|
12
|
+
comment: '',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function createOpponentStats(name, hand) {
|
|
16
|
+
return {
|
|
17
|
+
name: name,
|
|
18
|
+
hand: hand,
|
|
19
|
+
basicStatsPack: createBasicStatsPack(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BOOLEAN_UNION } from '../general';
|
|
2
|
+
import { BasicStatsPack } from '../matchplay';
|
|
3
|
+
export declare const HAND: {
|
|
4
|
+
readonly Left: "Left";
|
|
5
|
+
readonly Right: "Right";
|
|
6
|
+
};
|
|
7
|
+
export type HAND_UNION = typeof HAND[keyof typeof HAND];
|
|
8
|
+
export declare const HAND_ARRAY: HAND_UNION[];
|
|
9
|
+
export interface OpponentItem {
|
|
10
|
+
_id: string;
|
|
11
|
+
playerId: string;
|
|
12
|
+
name: string;
|
|
13
|
+
born: number;
|
|
14
|
+
hand: HAND_UNION;
|
|
15
|
+
show: BOOLEAN_UNION;
|
|
16
|
+
comment: string;
|
|
17
|
+
}
|
|
18
|
+
export interface OpponentStats {
|
|
19
|
+
name: string;
|
|
20
|
+
hand: string;
|
|
21
|
+
basicStatsPack: BasicStatsPack;
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const opponentItemSchema: z.ZodObject<{
|
|
3
|
+
playerId: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
born: z.ZodNumber;
|
|
6
|
+
hand: z.ZodString;
|
|
7
|
+
show: z.ZodString;
|
|
8
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
name: string;
|
|
11
|
+
show: string;
|
|
12
|
+
playerId: string;
|
|
13
|
+
born: number;
|
|
14
|
+
hand: string;
|
|
15
|
+
comment?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
name: string;
|
|
18
|
+
show: string;
|
|
19
|
+
playerId: string;
|
|
20
|
+
born: number;
|
|
21
|
+
hand: string;
|
|
22
|
+
comment?: string | undefined;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Add opponent to
|
|
3
|
+
export const opponentItemSchema = z.object({
|
|
4
|
+
playerId: z.string().min(1, 'PlayerId is required.'),
|
|
5
|
+
name: z.string().min(1, 'Name is required.'),
|
|
6
|
+
born: z.number().int().gte(1950, 'Year must be greater than 1950.'),
|
|
7
|
+
hand: z.string().min(1, 'Dominant Hand is required.'),
|
|
8
|
+
show: z.string().min(1, 'Show is required.'),
|
|
9
|
+
comment: z.string().optional(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ValueOf } from '../general';
|
|
2
|
+
export declare const PERFORMANCE: {
|
|
3
|
+
readonly ACTIVITY: {
|
|
4
|
+
readonly CourtSpeedTest1: "Court Speed Test 1";
|
|
5
|
+
readonly CourtSpeedTest2: "Court Speed Test 2";
|
|
6
|
+
readonly MurrayAgilityExercise: "Murray Agility Exercise";
|
|
7
|
+
readonly SixPointAgilityExercise: "Six Point Agility Exercise";
|
|
8
|
+
readonly SitAndReachFlexibility: "Sit And Reach Flexibility";
|
|
9
|
+
readonly PlankCoreTest: "Plank Core Test";
|
|
10
|
+
readonly VerticalPowerJumpTest: "Vertical Power Jump Test";
|
|
11
|
+
readonly WallThrows: "Wall Throws";
|
|
12
|
+
readonly SkipTest90Secs: "Skip Test 90Secs";
|
|
13
|
+
readonly BleepTest20m: "Bleep Test 20m";
|
|
14
|
+
readonly FourKmRun: "Four Km Run";
|
|
15
|
+
readonly HillSprints: "Hill Sprints";
|
|
16
|
+
};
|
|
17
|
+
readonly UNITS: {
|
|
18
|
+
readonly CourtSpeedTest1: "seconds";
|
|
19
|
+
readonly CourtSpeedTest2: "seconds";
|
|
20
|
+
readonly MurrayAgilityExercise: "centimeters";
|
|
21
|
+
readonly SixPointAgilityExercise: "centimeters";
|
|
22
|
+
readonly SitAndReachFlexibility: "centimeters";
|
|
23
|
+
readonly PlankCoreTest: "kg";
|
|
24
|
+
readonly VerticalPowerJumpTest: "centimeters";
|
|
25
|
+
readonly WallThrows: "throws";
|
|
26
|
+
readonly SkipTest90Secs: "jumps";
|
|
27
|
+
readonly BleepTest20m: "levels";
|
|
28
|
+
readonly FourKmRun: "minutes";
|
|
29
|
+
readonly HillSprints: "seconds";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export type PERFORMANCE_ACTIVITY_UNION = ValueOf<typeof PERFORMANCE.ACTIVITY>;
|
|
33
|
+
export declare const PERFORMANCE_ARRAYS: {
|
|
34
|
+
ACTIVITY: PERFORMANCE_ACTIVITY_UNION[];
|
|
35
|
+
};
|
|
36
|
+
export interface PerformanceType {
|
|
37
|
+
type: PERFORMANCE_ACTIVITY_UNION;
|
|
38
|
+
unit: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const PERFORMANCE_TYPES: PerformanceType[];
|
|
41
|
+
export interface PerformanceItem {
|
|
42
|
+
_id: string;
|
|
43
|
+
playerId: string;
|
|
44
|
+
date: Date;
|
|
45
|
+
type: PERFORMANCE_ACTIVITY_UNION;
|
|
46
|
+
cost: number;
|
|
47
|
+
}
|
|
48
|
+
export interface PerformanceTotals {
|
|
49
|
+
TotalsPerYear: {
|
|
50
|
+
year: number;
|
|
51
|
+
totalCost: number;
|
|
52
|
+
totalCostLastMonth: number;
|
|
53
|
+
averageSpendingPerMonth: number;
|
|
54
|
+
budget: number;
|
|
55
|
+
budgetRemaining: number;
|
|
56
|
+
costPerType: {
|
|
57
|
+
[type: string]: number;
|
|
58
|
+
};
|
|
59
|
+
costPerMonth: {
|
|
60
|
+
[month: string]: number;
|
|
61
|
+
};
|
|
62
|
+
costPerMonthPerType: {
|
|
63
|
+
[month: string]: {
|
|
64
|
+
[type: string]: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}[];
|
|
68
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const PERFORMANCE = {
|
|
2
|
+
ACTIVITY: {
|
|
3
|
+
CourtSpeedTest1: 'Court Speed Test 1',
|
|
4
|
+
CourtSpeedTest2: 'Court Speed Test 2',
|
|
5
|
+
MurrayAgilityExercise: 'Murray Agility Exercise',
|
|
6
|
+
SixPointAgilityExercise: 'Six Point Agility Exercise',
|
|
7
|
+
SitAndReachFlexibility: 'Sit And Reach Flexibility',
|
|
8
|
+
PlankCoreTest: 'Plank Core Test',
|
|
9
|
+
VerticalPowerJumpTest: 'Vertical Power Jump Test',
|
|
10
|
+
WallThrows: 'Wall Throws',
|
|
11
|
+
SkipTest90Secs: 'Skip Test 90Secs',
|
|
12
|
+
BleepTest20m: 'Bleep Test 20m',
|
|
13
|
+
FourKmRun: 'Four Km Run',
|
|
14
|
+
HillSprints: 'Hill Sprints',
|
|
15
|
+
},
|
|
16
|
+
UNITS: {
|
|
17
|
+
CourtSpeedTest1: 'seconds',
|
|
18
|
+
CourtSpeedTest2: 'seconds',
|
|
19
|
+
MurrayAgilityExercise: 'centimeters',
|
|
20
|
+
SixPointAgilityExercise: 'centimeters',
|
|
21
|
+
SitAndReachFlexibility: 'centimeters',
|
|
22
|
+
PlankCoreTest: 'kg',
|
|
23
|
+
VerticalPowerJumpTest: 'centimeters',
|
|
24
|
+
WallThrows: 'throws',
|
|
25
|
+
SkipTest90Secs: 'jumps',
|
|
26
|
+
BleepTest20m: 'levels',
|
|
27
|
+
FourKmRun: 'minutes',
|
|
28
|
+
HillSprints: 'seconds',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export const PERFORMANCE_ARRAYS = {
|
|
32
|
+
ACTIVITY: Object.values(PERFORMANCE.ACTIVITY),
|
|
33
|
+
};
|
|
34
|
+
export const PERFORMANCE_TYPES = Object.entries(PERFORMANCE.UNITS).map(([type, unit]) => ({ type, unit }));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const performanceItemSchema: z.ZodObject<{
|
|
3
|
+
playerId: z.ZodString;
|
|
4
|
+
date: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, unknown>;
|
|
5
|
+
type: z.ZodString;
|
|
6
|
+
cost: z.ZodNumber;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
type: string;
|
|
9
|
+
date: Date;
|
|
10
|
+
playerId: string;
|
|
11
|
+
cost: number;
|
|
12
|
+
}, {
|
|
13
|
+
type: string;
|
|
14
|
+
playerId: string;
|
|
15
|
+
cost: number;
|
|
16
|
+
date?: unknown;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Add performance testing to
|
|
3
|
+
export const performanceItemSchema = z.object({
|
|
4
|
+
playerId: z.string().min(1, 'PlayerId is required.'),
|
|
5
|
+
date: z.preprocess((arg) => (typeof arg === 'string' || arg instanceof Date ? new Date(arg) : undefined), z.date().refine(date => !isNaN(date.getTime()), 'Invalid date.')),
|
|
6
|
+
type: z.string().min(1, 'Type is required.'),
|
|
7
|
+
cost: z.number(),
|
|
8
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PlayerConfig, PlayerData } from './interfaces';
|
|
2
|
+
import { ValueOf } from '../general';
|
|
3
|
+
export declare const GLOBAL: {
|
|
4
|
+
TIME: {
|
|
5
|
+
allYears: string;
|
|
6
|
+
currentYear: string;
|
|
7
|
+
lastYear: string;
|
|
8
|
+
last2Years: string;
|
|
9
|
+
last3Years: string;
|
|
10
|
+
last4Years: string;
|
|
11
|
+
last5Years: string;
|
|
12
|
+
specificYear: string;
|
|
13
|
+
};
|
|
14
|
+
SET: {
|
|
15
|
+
all: string;
|
|
16
|
+
full: string;
|
|
17
|
+
short: string;
|
|
18
|
+
};
|
|
19
|
+
AGE: {
|
|
20
|
+
all: string;
|
|
21
|
+
u12: string;
|
|
22
|
+
u14: string;
|
|
23
|
+
u16: string;
|
|
24
|
+
u18: string;
|
|
25
|
+
adult: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type GLOBAL_TIME_UNION = ValueOf<typeof GLOBAL.TIME>;
|
|
29
|
+
export type GLOBAL_SET_UNION = ValueOf<typeof GLOBAL.SET>;
|
|
30
|
+
export type GLOBAL_AGE_UNION = ValueOf<typeof GLOBAL.AGE>;
|
|
31
|
+
export declare const GLOBAL_ARRAYS: {
|
|
32
|
+
TIME: GLOBAL_TIME_UNION[];
|
|
33
|
+
SET: GLOBAL_SET_UNION[];
|
|
34
|
+
AGE: GLOBAL_SET_UNION[];
|
|
35
|
+
};
|
|
36
|
+
export declare const createInitialPlayerConfig: (born: number) => PlayerConfig;
|
|
37
|
+
export declare const createInitialPlayerData: () => Omit<PlayerData, "_id">;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { COMMONS } from '../general';
|
|
2
|
+
import { createInitialSpendingCosts } from '../spending';
|
|
3
|
+
export const GLOBAL = {
|
|
4
|
+
TIME: {
|
|
5
|
+
allYears: 'All Years',
|
|
6
|
+
currentYear: 'Current Year',
|
|
7
|
+
lastYear: 'Last Year',
|
|
8
|
+
last2Years: 'Last 2 Years',
|
|
9
|
+
last3Years: 'Last 3 Years',
|
|
10
|
+
last4Years: 'Last 4 Years',
|
|
11
|
+
last5Years: 'Last 5 Years',
|
|
12
|
+
specificYear: 'Specific Year',
|
|
13
|
+
},
|
|
14
|
+
SET: {
|
|
15
|
+
all: 'All',
|
|
16
|
+
full: 'Full',
|
|
17
|
+
short: 'Short'
|
|
18
|
+
},
|
|
19
|
+
AGE: {
|
|
20
|
+
all: 'All',
|
|
21
|
+
u12: 'U12',
|
|
22
|
+
u14: 'U14',
|
|
23
|
+
u16: 'U16',
|
|
24
|
+
u18: 'U18',
|
|
25
|
+
adult: 'Adult',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const GLOBAL_ARRAYS = {
|
|
29
|
+
TIME: Object.values(GLOBAL.TIME),
|
|
30
|
+
SET: Object.values(GLOBAL.SET),
|
|
31
|
+
AGE: Object.values(GLOBAL.AGE),
|
|
32
|
+
};
|
|
33
|
+
// Factory function for PlayerConfig
|
|
34
|
+
export const createInitialPlayerConfig = (born) => ({
|
|
35
|
+
theme: 'theme-orange-light',
|
|
36
|
+
dataTableRows: 10,
|
|
37
|
+
budget: 10000,
|
|
38
|
+
calendarUseToday: COMMONS.BOOLEAN.Yes,
|
|
39
|
+
calendarDefaultDate: new Date(),
|
|
40
|
+
born: born,
|
|
41
|
+
spendingCosts: createInitialSpendingCosts(),
|
|
42
|
+
globalFilterTimeFrame: GLOBAL.TIME.allYears,
|
|
43
|
+
globalFilterSpecificYear: new Date().getFullYear(),
|
|
44
|
+
globalFilterSetFormat: GLOBAL.SET.full,
|
|
45
|
+
globalFilterAgeGroup: GLOBAL.AGE.u14,
|
|
46
|
+
});
|
|
47
|
+
// Factory function for PlayerData
|
|
48
|
+
export const createInitialPlayerData = () => ({
|
|
49
|
+
firstname: '',
|
|
50
|
+
lastname: '',
|
|
51
|
+
born: new Date().getFullYear() - 18,
|
|
52
|
+
password: '',
|
|
53
|
+
email: '',
|
|
54
|
+
config: createInitialPlayerConfig(new Date().getFullYear() - 18),
|
|
55
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ObjectId } from 'mongodb';
|
|
2
|
+
import { SpendingCosts } from '../spending';
|
|
3
|
+
export interface PlayerData {
|
|
4
|
+
_id?: ObjectId;
|
|
5
|
+
firstname: string;
|
|
6
|
+
lastname: string;
|
|
7
|
+
born: number;
|
|
8
|
+
password?: string;
|
|
9
|
+
email: string;
|
|
10
|
+
config: PlayerConfig;
|
|
11
|
+
}
|
|
12
|
+
export interface PlayerConfig {
|
|
13
|
+
theme: string;
|
|
14
|
+
dataTableRows: number;
|
|
15
|
+
budget: number;
|
|
16
|
+
calendarUseToday: string;
|
|
17
|
+
calendarDefaultDate: Date;
|
|
18
|
+
born: number;
|
|
19
|
+
spendingCosts: SpendingCosts[];
|
|
20
|
+
globalFilterTimeFrame: string;
|
|
21
|
+
globalFilterSpecificYear: number;
|
|
22
|
+
globalFilterSetFormat: string;
|
|
23
|
+
globalFilterAgeGroup: string;
|
|
24
|
+
}
|
|
25
|
+
export interface LoginResponse {
|
|
26
|
+
player: PlayerData;
|
|
27
|
+
token: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|