tenniscommon 1.1.35 → 1.1.37
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 +20 -41
- package/dist/cjs/common/general/generalUtils.d.ts +1 -0
- package/dist/cjs/common/general/generalUtils.js +1 -0
- package/dist/cjs/common/opponent/validation.d.ts +2 -2
- package/dist/cjs/common/player/initialData.d.ts +5 -8
- package/dist/cjs/common/player/initialData.js +6 -12
- package/dist/cjs/common/player/interfaces.d.ts +0 -3
- package/dist/cjs/common/player/interfaces.js +1 -0
- package/dist/cjs/common/player/validation.d.ts +0 -70
- package/dist/cjs/common/player/validation.js +0 -7
- package/dist/cjs/common/tournament/validation.d.ts +2 -2
- package/dist/cjs/common/training/initialData.d.ts +1 -1
- package/dist/cjs/common/training/initialData.js +28 -9
- package/dist/cjs/common/training/initialStats.d.ts +1 -3
- package/dist/cjs/common/training/initialStats.js +83 -41
- package/dist/cjs/common/training/interfaces.d.ts +159 -37
- package/dist/cjs/common/training/interfaces.js +6 -8
- package/dist/cjs/common/training/validation.d.ts +51 -12
- package/dist/cjs/common/training/validation.js +25 -14
- package/dist/cjs/common/trainingWeekly/initialData.js +16 -10
- package/dist/cjs/common/trainingWeekly/interfaces.d.ts +14 -9
- package/dist/cjs/common/trainingWeekly/validation.d.ts +42 -18
- package/dist/cjs/common/trainingWeekly/validation.js +20 -13
- package/dist/esm/common/general/generalUtils.d.ts +1 -0
- package/dist/esm/common/general/generalUtils.js +1 -0
- package/dist/esm/common/opponent/validation.d.ts +2 -2
- package/dist/esm/common/player/initialData.d.ts +5 -8
- package/dist/esm/common/player/initialData.js +6 -12
- package/dist/esm/common/player/interfaces.d.ts +0 -3
- package/dist/esm/common/player/interfaces.js +1 -0
- package/dist/esm/common/player/validation.d.ts +0 -70
- package/dist/esm/common/player/validation.js +0 -7
- package/dist/esm/common/tournament/validation.d.ts +2 -2
- package/dist/esm/common/training/initialData.d.ts +1 -1
- package/dist/esm/common/training/initialData.js +26 -8
- package/dist/esm/common/training/initialStats.d.ts +1 -3
- package/dist/esm/common/training/initialStats.js +82 -38
- package/dist/esm/common/training/interfaces.d.ts +159 -37
- package/dist/esm/common/training/interfaces.js +6 -8
- package/dist/esm/common/training/validation.d.ts +51 -12
- package/dist/esm/common/training/validation.js +25 -14
- package/dist/esm/common/trainingWeekly/initialData.js +16 -10
- package/dist/esm/common/trainingWeekly/interfaces.d.ts +14 -9
- package/dist/esm/common/trainingWeekly/validation.d.ts +42 -18
- package/dist/esm/common/trainingWeekly/validation.js +20 -13
- package/dist/types/common/general/generalUtils.d.ts +1 -0
- package/dist/types/common/opponent/validation.d.ts +2 -2
- package/dist/types/common/player/initialData.d.ts +5 -8
- package/dist/types/common/player/interfaces.d.ts +0 -3
- package/dist/types/common/player/validation.d.ts +0 -70
- package/dist/types/common/tournament/validation.d.ts +2 -2
- package/dist/types/common/training/initialData.d.ts +1 -1
- package/dist/types/common/training/initialStats.d.ts +1 -3
- package/dist/types/common/training/interfaces.d.ts +159 -37
- package/dist/types/common/training/validation.d.ts +51 -12
- package/dist/types/common/trainingWeekly/interfaces.d.ts +14 -9
- package/dist/types/common/trainingWeekly/validation.d.ts +42 -18
- package/package.json +2 -1
- package/dist/cjs/common/spending/index.d.ts +0 -4
- package/dist/cjs/common/spending/index.js +0 -20
- package/dist/cjs/common/spending/initialData.d.ts +0 -2
- package/dist/cjs/common/spending/initialData.js +0 -15
- package/dist/cjs/common/spending/initialStats.d.ts +0 -4
- package/dist/cjs/common/spending/initialStats.js +0 -50
- package/dist/cjs/common/spending/interfaces.d.ts +0 -80
- package/dist/cjs/common/spending/interfaces.js +0 -41
- package/dist/cjs/common/spending/validation.d.ts +0 -39
- package/dist/cjs/common/spending/validation.js +0 -22
- package/dist/esm/common/spending/index.d.ts +0 -4
- package/dist/esm/common/spending/index.js +0 -4
- package/dist/esm/common/spending/initialData.d.ts +0 -2
- package/dist/esm/common/spending/initialData.js +0 -12
- package/dist/esm/common/spending/initialStats.d.ts +0 -4
- package/dist/esm/common/spending/initialStats.js +0 -44
- package/dist/esm/common/spending/interfaces.d.ts +0 -80
- package/dist/esm/common/spending/interfaces.js +0 -37
- package/dist/esm/common/spending/validation.d.ts +0 -39
- package/dist/esm/common/spending/validation.js +0 -19
- package/dist/types/common/spending/index.d.ts +0 -4
- package/dist/types/common/spending/initialData.d.ts +0 -2
- package/dist/types/common/spending/initialStats.d.ts +0 -4
- package/dist/types/common/spending/interfaces.d.ts +0 -80
- package/dist/types/common/spending/validation.d.ts +0 -39
package/README.md
CHANGED
|
@@ -1,41 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
Provide instructions and examples for using your project. Here’s an example:
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
node your-script.js
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
```javascript
|
|
30
|
-
const yourPackage = require('your-package-name');
|
|
31
|
-
|
|
32
|
-
// Your code here
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Contributing
|
|
36
|
-
|
|
37
|
-
Feel free to contribute by submitting a pull request. Please make sure to update tests as appropriate.
|
|
38
|
-
|
|
39
|
-
## License
|
|
40
|
-
|
|
41
|
-
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
|
|
1
|
+
## `tenniscommon` — Project Summary
|
|
2
|
+
`tenniscommon` is a shared **TypeScript domain library** used across the Tennis application ecosystem. It centralizes the **interfaces/types**, **validation schemas**, **utility helpers**, and **initial/default data + stats factories** so both:
|
|
3
|
+
- **tennisClient** (Next.js frontend) and
|
|
4
|
+
- **tennisServer** (Node.js / Express API backend)
|
|
5
|
+
|
|
6
|
+
consume the **same source of truth** for data shapes and validation rules.
|
|
7
|
+
### What it provides
|
|
8
|
+
The library is organized by feature/domain (for example: general, player, opponent, matchplay, tournament, training, trainingWeekly, spending, performance, chat). Each domain typically contains:
|
|
9
|
+
- **Interfaces & unions** for strong typing across client/server
|
|
10
|
+
- **Zod validation** for runtime input validation (useful for API boundaries and form validation)
|
|
11
|
+
- **Initial data / stats creators** to generate safe “empty/default” objects for new records and dashboards
|
|
12
|
+
- **Exports via index files** so consumers can import per-domain
|
|
13
|
+
|
|
14
|
+
### Build & distribution
|
|
15
|
+
Because it’s consumed by both Node.js and Next.js, `tenniscommon` is built in **two module formats**:
|
|
16
|
+
- **CommonJS (CJS)** output in `dist/cjs`
|
|
17
|
+
- **ES Modules (ESM)** output in `dist/esm`
|
|
18
|
+
- **Type declarations** in `dist/types`
|
|
19
|
+
|
|
20
|
+
This allows modern ESM tooling (like Next.js) and traditional Node.js CommonJS usage to both work cleanly from the same package.
|
|
@@ -2,6 +2,7 @@ import { PlayerConfig } from '../player';
|
|
|
2
2
|
import { ValueOf } from './generalInterfaces';
|
|
3
3
|
export declare const COMMONS: {
|
|
4
4
|
readonly WEEKDAY: {
|
|
5
|
+
readonly Weekly: "Weekly";
|
|
5
6
|
readonly Monday: "Monday";
|
|
6
7
|
readonly Tuesday: "Tuesday";
|
|
7
8
|
readonly Wednesday: "Wednesday";
|
|
@@ -9,15 +9,15 @@ export declare const opponentItemSchema: z.ZodObject<{
|
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
name: string;
|
|
11
11
|
show: string;
|
|
12
|
-
playerId: string;
|
|
13
12
|
born: number;
|
|
13
|
+
playerId: string;
|
|
14
14
|
hand: string;
|
|
15
15
|
comment?: string | undefined;
|
|
16
16
|
}, {
|
|
17
17
|
name: string;
|
|
18
18
|
show: string;
|
|
19
|
-
playerId: string;
|
|
20
19
|
born: number;
|
|
20
|
+
playerId: string;
|
|
21
21
|
hand: string;
|
|
22
22
|
comment?: string | undefined;
|
|
23
23
|
}>;
|
|
@@ -2,14 +2,11 @@ import { PlayerConfig } from './interfaces';
|
|
|
2
2
|
import { ValueOf } from '../general';
|
|
3
3
|
export declare const GLOBAL: {
|
|
4
4
|
TIME: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
last4Years: string;
|
|
11
|
-
last5Years: string;
|
|
12
|
-
specificYear: string;
|
|
5
|
+
allTime: string;
|
|
6
|
+
last6Months: string;
|
|
7
|
+
last12Months: string;
|
|
8
|
+
last18Months: string;
|
|
9
|
+
year: string;
|
|
13
10
|
};
|
|
14
11
|
SET: {
|
|
15
12
|
all: string;
|
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createInitialPlayerData = exports.createInitialPlayerConfig = exports.GLOBAL_ARRAYS = exports.GLOBAL = void 0;
|
|
4
4
|
const general_1 = require("../general");
|
|
5
|
-
const spending_1 = require("../spending");
|
|
6
5
|
exports.GLOBAL = {
|
|
7
6
|
TIME: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
last4Years: 'Last 4 Years',
|
|
14
|
-
last5Years: 'Last 5 Years',
|
|
15
|
-
specificYear: 'Specific Year',
|
|
7
|
+
allTime: 'All Time',
|
|
8
|
+
last6Months: 'Last 6 Months',
|
|
9
|
+
last12Months: 'Last 12 Months',
|
|
10
|
+
last18Months: 'Last 18 Months',
|
|
11
|
+
year: 'Year...',
|
|
16
12
|
},
|
|
17
13
|
SET: {
|
|
18
14
|
all: 'All',
|
|
@@ -37,12 +33,10 @@ exports.GLOBAL_ARRAYS = {
|
|
|
37
33
|
const createInitialPlayerConfig = (born) => ({
|
|
38
34
|
theme: 'theme-orange-light',
|
|
39
35
|
dataTableRows: 10,
|
|
40
|
-
budget: 10000,
|
|
41
36
|
calendarUseToday: general_1.COMMONS.BOOLEAN.Yes,
|
|
42
37
|
calendarDefaultDate: new Date(),
|
|
43
38
|
born: born,
|
|
44
|
-
|
|
45
|
-
globalFilterTimeFrame: exports.GLOBAL.TIME.allYears,
|
|
39
|
+
globalFilterTimeFrame: exports.GLOBAL.TIME.last6Months,
|
|
46
40
|
globalFilterSpecificYear: new Date().getFullYear(),
|
|
47
41
|
globalFilterSetFormat: exports.GLOBAL.SET.full,
|
|
48
42
|
globalFilterAgeGroup: exports.GLOBAL.AGE.u14,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SpendingCosts } from '../spending';
|
|
2
1
|
export interface PlayerRegistrationRequest {
|
|
3
2
|
player: PlayerData;
|
|
4
3
|
inviteCode: string;
|
|
@@ -17,11 +16,9 @@ export interface PlayerData {
|
|
|
17
16
|
export interface PlayerConfig {
|
|
18
17
|
theme: string;
|
|
19
18
|
dataTableRows: number;
|
|
20
|
-
budget: number;
|
|
21
19
|
calendarUseToday: string;
|
|
22
20
|
calendarDefaultDate: Date;
|
|
23
21
|
born: number;
|
|
24
|
-
spendingCosts: SpendingCosts[];
|
|
25
22
|
globalFilterTimeFrame: string;
|
|
26
23
|
globalFilterSpecificYear: number;
|
|
27
24
|
globalFilterSetFormat: string;
|
|
@@ -2,7 +2,6 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const playerConfigSchema: z.ZodObject<{
|
|
3
3
|
theme: z.ZodString;
|
|
4
4
|
dataTableRows: z.ZodNumber;
|
|
5
|
-
budget: z.ZodNumber;
|
|
6
5
|
calendarUseToday: z.ZodEffects<z.ZodString, {
|
|
7
6
|
value: boolean;
|
|
8
7
|
error: null;
|
|
@@ -12,16 +11,6 @@ export declare const playerConfigSchema: z.ZodObject<{
|
|
|
12
11
|
}, string>;
|
|
13
12
|
calendarDefaultDate: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, unknown>;
|
|
14
13
|
born: z.ZodNumber;
|
|
15
|
-
spendingCosts: z.ZodArray<z.ZodObject<{
|
|
16
|
-
category: z.ZodString;
|
|
17
|
-
cost: z.ZodNumber;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
cost: number;
|
|
20
|
-
category: string;
|
|
21
|
-
}, {
|
|
22
|
-
cost: number;
|
|
23
|
-
category: string;
|
|
24
|
-
}>, "atleastone">;
|
|
25
14
|
globalFilterTimeFrame: z.ZodString;
|
|
26
15
|
globalFilterSpecificYear: z.ZodNumber;
|
|
27
16
|
globalFilterSetFormat: z.ZodString;
|
|
@@ -29,7 +18,6 @@ export declare const playerConfigSchema: z.ZodObject<{
|
|
|
29
18
|
}, "strip", z.ZodTypeAny, {
|
|
30
19
|
theme: string;
|
|
31
20
|
dataTableRows: number;
|
|
32
|
-
budget: number;
|
|
33
21
|
calendarUseToday: {
|
|
34
22
|
value: boolean;
|
|
35
23
|
error: null;
|
|
@@ -39,13 +27,6 @@ export declare const playerConfigSchema: z.ZodObject<{
|
|
|
39
27
|
};
|
|
40
28
|
calendarDefaultDate: Date;
|
|
41
29
|
born: number;
|
|
42
|
-
spendingCosts: [{
|
|
43
|
-
cost: number;
|
|
44
|
-
category: string;
|
|
45
|
-
}, ...{
|
|
46
|
-
cost: number;
|
|
47
|
-
category: string;
|
|
48
|
-
}[]];
|
|
49
30
|
globalFilterTimeFrame: string;
|
|
50
31
|
globalFilterSpecificYear: number;
|
|
51
32
|
globalFilterSetFormat: string;
|
|
@@ -53,16 +34,8 @@ export declare const playerConfigSchema: z.ZodObject<{
|
|
|
53
34
|
}, {
|
|
54
35
|
theme: string;
|
|
55
36
|
dataTableRows: number;
|
|
56
|
-
budget: number;
|
|
57
37
|
calendarUseToday: string;
|
|
58
38
|
born: number;
|
|
59
|
-
spendingCosts: [{
|
|
60
|
-
cost: number;
|
|
61
|
-
category: string;
|
|
62
|
-
}, ...{
|
|
63
|
-
cost: number;
|
|
64
|
-
category: string;
|
|
65
|
-
}[]];
|
|
66
39
|
globalFilterTimeFrame: string;
|
|
67
40
|
globalFilterSpecificYear: number;
|
|
68
41
|
globalFilterSetFormat: string;
|
|
@@ -78,7 +51,6 @@ export declare const playerDataSchema: z.ZodObject<{
|
|
|
78
51
|
config: z.ZodObject<{
|
|
79
52
|
theme: z.ZodString;
|
|
80
53
|
dataTableRows: z.ZodNumber;
|
|
81
|
-
budget: z.ZodNumber;
|
|
82
54
|
calendarUseToday: z.ZodEffects<z.ZodString, {
|
|
83
55
|
value: boolean;
|
|
84
56
|
error: null;
|
|
@@ -88,16 +60,6 @@ export declare const playerDataSchema: z.ZodObject<{
|
|
|
88
60
|
}, string>;
|
|
89
61
|
calendarDefaultDate: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, unknown>;
|
|
90
62
|
born: z.ZodNumber;
|
|
91
|
-
spendingCosts: z.ZodArray<z.ZodObject<{
|
|
92
|
-
category: z.ZodString;
|
|
93
|
-
cost: z.ZodNumber;
|
|
94
|
-
}, "strip", z.ZodTypeAny, {
|
|
95
|
-
cost: number;
|
|
96
|
-
category: string;
|
|
97
|
-
}, {
|
|
98
|
-
cost: number;
|
|
99
|
-
category: string;
|
|
100
|
-
}>, "atleastone">;
|
|
101
63
|
globalFilterTimeFrame: z.ZodString;
|
|
102
64
|
globalFilterSpecificYear: z.ZodNumber;
|
|
103
65
|
globalFilterSetFormat: z.ZodString;
|
|
@@ -105,7 +67,6 @@ export declare const playerDataSchema: z.ZodObject<{
|
|
|
105
67
|
}, "strip", z.ZodTypeAny, {
|
|
106
68
|
theme: string;
|
|
107
69
|
dataTableRows: number;
|
|
108
|
-
budget: number;
|
|
109
70
|
calendarUseToday: {
|
|
110
71
|
value: boolean;
|
|
111
72
|
error: null;
|
|
@@ -115,13 +76,6 @@ export declare const playerDataSchema: z.ZodObject<{
|
|
|
115
76
|
};
|
|
116
77
|
calendarDefaultDate: Date;
|
|
117
78
|
born: number;
|
|
118
|
-
spendingCosts: [{
|
|
119
|
-
cost: number;
|
|
120
|
-
category: string;
|
|
121
|
-
}, ...{
|
|
122
|
-
cost: number;
|
|
123
|
-
category: string;
|
|
124
|
-
}[]];
|
|
125
79
|
globalFilterTimeFrame: string;
|
|
126
80
|
globalFilterSpecificYear: number;
|
|
127
81
|
globalFilterSetFormat: string;
|
|
@@ -129,16 +83,8 @@ export declare const playerDataSchema: z.ZodObject<{
|
|
|
129
83
|
}, {
|
|
130
84
|
theme: string;
|
|
131
85
|
dataTableRows: number;
|
|
132
|
-
budget: number;
|
|
133
86
|
calendarUseToday: string;
|
|
134
87
|
born: number;
|
|
135
|
-
spendingCosts: [{
|
|
136
|
-
cost: number;
|
|
137
|
-
category: string;
|
|
138
|
-
}, ...{
|
|
139
|
-
cost: number;
|
|
140
|
-
category: string;
|
|
141
|
-
}[]];
|
|
142
88
|
globalFilterTimeFrame: string;
|
|
143
89
|
globalFilterSpecificYear: number;
|
|
144
90
|
globalFilterSetFormat: string;
|
|
@@ -153,7 +99,6 @@ export declare const playerDataSchema: z.ZodObject<{
|
|
|
153
99
|
config: {
|
|
154
100
|
theme: string;
|
|
155
101
|
dataTableRows: number;
|
|
156
|
-
budget: number;
|
|
157
102
|
calendarUseToday: {
|
|
158
103
|
value: boolean;
|
|
159
104
|
error: null;
|
|
@@ -163,13 +108,6 @@ export declare const playerDataSchema: z.ZodObject<{
|
|
|
163
108
|
};
|
|
164
109
|
calendarDefaultDate: Date;
|
|
165
110
|
born: number;
|
|
166
|
-
spendingCosts: [{
|
|
167
|
-
cost: number;
|
|
168
|
-
category: string;
|
|
169
|
-
}, ...{
|
|
170
|
-
cost: number;
|
|
171
|
-
category: string;
|
|
172
|
-
}[]];
|
|
173
111
|
globalFilterTimeFrame: string;
|
|
174
112
|
globalFilterSpecificYear: number;
|
|
175
113
|
globalFilterSetFormat: string;
|
|
@@ -184,16 +122,8 @@ export declare const playerDataSchema: z.ZodObject<{
|
|
|
184
122
|
config: {
|
|
185
123
|
theme: string;
|
|
186
124
|
dataTableRows: number;
|
|
187
|
-
budget: number;
|
|
188
125
|
calendarUseToday: string;
|
|
189
126
|
born: number;
|
|
190
|
-
spendingCosts: [{
|
|
191
|
-
cost: number;
|
|
192
|
-
category: string;
|
|
193
|
-
}, ...{
|
|
194
|
-
cost: number;
|
|
195
|
-
category: string;
|
|
196
|
-
}[]];
|
|
197
127
|
globalFilterTimeFrame: string;
|
|
198
128
|
globalFilterSpecificYear: number;
|
|
199
129
|
globalFilterSetFormat: string;
|
|
@@ -2,16 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.playerDataSchema = exports.playerConfigSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
// Define schema for a single SpendingCost
|
|
6
|
-
const SpendingCostSchema = zod_1.z.object({
|
|
7
|
-
category: zod_1.z.string().min(1, 'Category is required.'),
|
|
8
|
-
cost: zod_1.z.number().nonnegative('Cost must be a non-negative number.'),
|
|
9
|
-
});
|
|
10
5
|
//Add and Update Config
|
|
11
6
|
exports.playerConfigSchema = zod_1.z.object({
|
|
12
7
|
theme: zod_1.z.string().min(1, 'Theme is required.'),
|
|
13
8
|
dataTableRows: zod_1.z.number().nonnegative('Data Table Rows must be a non-negative number.'),
|
|
14
|
-
budget: zod_1.z.number().nonnegative('Budget must be a non-negative number.'),
|
|
15
9
|
calendarUseToday: zod_1.z.string().transform((val) => {
|
|
16
10
|
if (val === 'Yes')
|
|
17
11
|
return { value: true, error: null };
|
|
@@ -21,7 +15,6 @@ exports.playerConfigSchema = zod_1.z.object({
|
|
|
21
15
|
}),
|
|
22
16
|
calendarDefaultDate: zod_1.z.preprocess((arg) => (typeof arg === 'string' || arg instanceof Date ? new Date(arg) : undefined), zod_1.z.date().refine(date => !isNaN(date.getTime()), 'Invalid date.')),
|
|
23
17
|
born: zod_1.z.number().int().gte(1950, 'Year must be greater than 1950.'),
|
|
24
|
-
spendingCosts: zod_1.z.array(SpendingCostSchema).nonempty('Spending Costs is required.'),
|
|
25
18
|
globalFilterTimeFrame: zod_1.z.string().min(1, 'Global Filter Time Frame is required.'),
|
|
26
19
|
globalFilterSpecificYear: zod_1.z.number().int().gte(1950, 'Year must be greater than 1950.'),
|
|
27
20
|
globalFilterSetFormat: zod_1.z.string().min(1, 'Global Filter Set Format is required.'),
|
|
@@ -9,13 +9,13 @@ export declare const tournamentYearItemSchema: z.ZodObject<{
|
|
|
9
9
|
show: string;
|
|
10
10
|
year: number;
|
|
11
11
|
date: Date;
|
|
12
|
-
category: string;
|
|
13
12
|
comment: string;
|
|
13
|
+
category: string;
|
|
14
14
|
}, {
|
|
15
15
|
show: string;
|
|
16
16
|
year: number;
|
|
17
|
-
category: string;
|
|
18
17
|
comment: string;
|
|
18
|
+
category: string;
|
|
19
19
|
date?: unknown;
|
|
20
20
|
}>;
|
|
21
21
|
export declare const tournamentItemSchema: z.ZodObject<{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TrainingItem } from './interfaces';
|
|
2
|
-
export declare
|
|
2
|
+
export declare const createEmptyTrainingItem: (playerId: string, isoYear: number, isoWeek: number) => TrainingItem;
|
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.createEmptyTrainingItem = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
5
|
// Factory function for creating initial TrainingItem
|
|
6
|
-
|
|
6
|
+
const createEmptyTrainingItem = (playerId, isoYear, isoWeek) => {
|
|
7
|
+
let date = new Date(isoYear, 0, 4); // 4th Jan is always in the first ISO week
|
|
8
|
+
date = (0, date_fns_1.setISOWeekYear)(date, isoYear);
|
|
9
|
+
date = (0, date_fns_1.setISOWeek)(date, isoWeek);
|
|
10
|
+
date = (0, date_fns_1.startOfISOWeek)(date);
|
|
7
11
|
return {
|
|
8
12
|
_id: '',
|
|
9
|
-
playerId
|
|
10
|
-
date
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
playerId,
|
|
14
|
+
date,
|
|
15
|
+
isoWeek,
|
|
16
|
+
isoYear,
|
|
17
|
+
matchPractice: 0,
|
|
18
|
+
tactical: 0,
|
|
19
|
+
serve: 0,
|
|
20
|
+
return: 0,
|
|
21
|
+
forehand: 0,
|
|
22
|
+
backhand: 0,
|
|
23
|
+
volley: 0,
|
|
24
|
+
overhead: 0,
|
|
25
|
+
dropShot: 0,
|
|
26
|
+
slice: 0,
|
|
27
|
+
strengthAndConditioning: 0,
|
|
28
|
+
speedAndEndurance: 0,
|
|
29
|
+
lesson: 0,
|
|
30
|
+
squad: 0,
|
|
31
|
+
notes: '',
|
|
14
32
|
};
|
|
15
|
-
}
|
|
33
|
+
};
|
|
34
|
+
exports.createEmptyTrainingItem = createEmptyTrainingItem;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { TrainingStats
|
|
1
|
+
import { TrainingStats } from './interfaces';
|
|
2
2
|
export declare const createDefaultTrainingStats: () => TrainingStats;
|
|
3
|
-
export declare const createDefaultTrainingGroups: () => TrainingGroups;
|
|
4
|
-
export declare const createDefaultTrainingType: () => TrainingType;
|
|
@@ -1,50 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const interfaces_1 = require("./interfaces");
|
|
5
|
-
const general_1 = require("../general");
|
|
3
|
+
exports.createDefaultTrainingStats = void 0;
|
|
6
4
|
const createDefaultTrainingStats = () => {
|
|
7
|
-
const hoursPerType = {};
|
|
8
|
-
const hoursPerMonth = {};
|
|
9
|
-
// Initialize costPerType with 0 for each spending type
|
|
10
|
-
interfaces_1.TRAINING_ARRAYS.ACTIVITY.forEach(type => (hoursPerType[type] = 0));
|
|
11
|
-
// Initialize costPerMonth with 0 for each month
|
|
12
|
-
general_1.COMMONS_ARRAYS.MONTH.forEach(month => {
|
|
13
|
-
hoursPerMonth[month] = 0;
|
|
14
|
-
});
|
|
15
5
|
return {
|
|
16
6
|
totalHours: 0,
|
|
17
7
|
averageHoursPerMonth: 0,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
weeklyAverageLast4Weeks: 0,
|
|
9
|
+
coaching: {
|
|
10
|
+
hours: 0,
|
|
11
|
+
percentage: 0,
|
|
12
|
+
breakdown: {
|
|
13
|
+
lesson: { hours: 0, percentage: 0 },
|
|
14
|
+
squad: { hours: 0, percentage: 0 },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
technical: {
|
|
18
|
+
hours: 0,
|
|
19
|
+
percentage: 0,
|
|
20
|
+
breakdown: {
|
|
21
|
+
skill: {
|
|
22
|
+
tactical: { hours: 0, percentage: 0 },
|
|
23
|
+
serve: { hours: 0, percentage: 0 },
|
|
24
|
+
return: { hours: 0, percentage: 0 },
|
|
25
|
+
forehand: { hours: 0, percentage: 0 },
|
|
26
|
+
backhand: { hours: 0, percentage: 0 },
|
|
27
|
+
volley: { hours: 0, percentage: 0 },
|
|
28
|
+
overhead: { hours: 0, percentage: 0 },
|
|
29
|
+
dropShot: { hours: 0, percentage: 0 },
|
|
30
|
+
slice: { hours: 0, percentage: 0 },
|
|
31
|
+
strengthAndConditioning: { hours: 0, percentage: 0 },
|
|
32
|
+
speedAndEndurance: { hours: 0, percentage: 0 },
|
|
33
|
+
},
|
|
34
|
+
serveAndReturn: { hours: 0, percentage: 0 },
|
|
35
|
+
netAndTouch: { hours: 0, percentage: 0 },
|
|
36
|
+
groundstrokes: { hours: 0, percentage: 0 },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
matchPractice: { hours: 0, percentage: 0 },
|
|
40
|
+
physical: {
|
|
41
|
+
hours: 0,
|
|
42
|
+
percentage: 0,
|
|
43
|
+
breakdown: {
|
|
44
|
+
strengthAndConditioning: { hours: 0, percentage: 0 },
|
|
45
|
+
speedAndEndurance: { hours: 0, percentage: 0 },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
hoursPerMonth: {
|
|
49
|
+
January: 0,
|
|
50
|
+
February: 0,
|
|
51
|
+
March: 0,
|
|
52
|
+
April: 0,
|
|
53
|
+
May: 0,
|
|
54
|
+
June: 0,
|
|
55
|
+
July: 0,
|
|
56
|
+
August: 0,
|
|
57
|
+
September: 0,
|
|
58
|
+
October: 0,
|
|
59
|
+
November: 0,
|
|
60
|
+
December: 0,
|
|
61
|
+
},
|
|
62
|
+
technicalHoursPerMonth: {
|
|
63
|
+
January: 0,
|
|
64
|
+
February: 0,
|
|
65
|
+
March: 0,
|
|
66
|
+
April: 0,
|
|
67
|
+
May: 0,
|
|
68
|
+
June: 0,
|
|
69
|
+
July: 0,
|
|
70
|
+
August: 0,
|
|
71
|
+
September: 0,
|
|
72
|
+
October: 0,
|
|
73
|
+
November: 0,
|
|
74
|
+
December: 0,
|
|
75
|
+
},
|
|
76
|
+
matchPracticeHoursPerMonth: {
|
|
77
|
+
January: 0,
|
|
78
|
+
February: 0,
|
|
79
|
+
March: 0,
|
|
80
|
+
April: 0,
|
|
81
|
+
May: 0,
|
|
82
|
+
June: 0,
|
|
83
|
+
July: 0,
|
|
84
|
+
August: 0,
|
|
85
|
+
September: 0,
|
|
86
|
+
October: 0,
|
|
87
|
+
November: 0,
|
|
88
|
+
December: 0,
|
|
89
|
+
},
|
|
22
90
|
};
|
|
23
91
|
};
|
|
24
92
|
exports.createDefaultTrainingStats = createDefaultTrainingStats;
|
|
25
|
-
const createDefaultTrainingGroups = () => {
|
|
26
|
-
return {
|
|
27
|
-
trainingAtNoCostHours: 0,
|
|
28
|
-
trainingAtNoCostHoursPercentage: 0,
|
|
29
|
-
trainingAtCostHours: 0,
|
|
30
|
-
trainingAtCostHoursPercentage: 0,
|
|
31
|
-
onCourtHours: 0,
|
|
32
|
-
onCourtHoursPercentage: 0,
|
|
33
|
-
coachedHours: 0,
|
|
34
|
-
coachedHoursPercentage: 0,
|
|
35
|
-
physicalHours: 0,
|
|
36
|
-
physicalHoursPercentage: 0,
|
|
37
|
-
matchPracticeHours: 0,
|
|
38
|
-
matchPracticeHoursPercentage: 0,
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
exports.createDefaultTrainingGroups = createDefaultTrainingGroups;
|
|
42
|
-
const createDefaultTrainingType = () => {
|
|
43
|
-
return {
|
|
44
|
-
type: '',
|
|
45
|
-
hours: 0,
|
|
46
|
-
percentage: 0,
|
|
47
|
-
perMonth: {},
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
exports.createDefaultTrainingType = createDefaultTrainingType;
|