rategame-shared 1.0.9 → 1.0.11

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.
@@ -1,3 +1,4 @@
1
1
  import { z } from "zod";
2
- import { ratingSchema } from "../schemas/rating";
2
+ import { createRatingSchema, ratingSchema } from "../schemas/rating";
3
3
  export type Rating = z.infer<typeof ratingSchema>;
4
+ export type CreateRating = z.infer<typeof createRatingSchema>;
@@ -1,21 +1,21 @@
1
1
  export declare const ratingSchema: import("zod").ZodObject<{
2
2
  id: import("zod").ZodString;
3
- comment: import("zod").ZodString;
4
3
  createdAt: import("zod").ZodNumber;
5
4
  rating: import("zod").ZodNumber;
5
+ comment: import("zod").ZodOptional<import("zod").ZodString>;
6
6
  user: import("zod").ZodObject<{
7
7
  id: import("zod").ZodString;
8
- username: import("zod").ZodNumber;
8
+ username: import("zod").ZodString;
9
9
  }, "strip", import("zod").ZodTypeAny, {
10
10
  id: string;
11
- username: number;
11
+ username: string;
12
12
  }, {
13
13
  id: string;
14
- username: number;
14
+ username: string;
15
15
  }>;
16
- round: import("zod").ZodNumber;
17
16
  game: import("zod").ZodObject<{
18
17
  id: import("zod").ZodString;
18
+ round: import("zod").ZodNumber;
19
19
  homeTeam: import("zod").ZodObject<{
20
20
  id: import("zod").ZodOptional<import("zod").ZodString>;
21
21
  teamId: import("zod").ZodNumber;
@@ -62,6 +62,7 @@ export declare const ratingSchema: import("zod").ZodObject<{
62
62
  }>;
63
63
  }, "strip", import("zod").ZodTypeAny, {
64
64
  id: string;
65
+ round: number;
65
66
  homeTeam: {
66
67
  image: string;
67
68
  teamId: number;
@@ -80,6 +81,7 @@ export declare const ratingSchema: import("zod").ZodObject<{
80
81
  };
81
82
  }, {
82
83
  id: string;
84
+ round: number;
83
85
  homeTeam: {
84
86
  image: string;
85
87
  teamId: number;
@@ -99,16 +101,15 @@ export declare const ratingSchema: import("zod").ZodObject<{
99
101
  }>;
100
102
  }, "strip", import("zod").ZodTypeAny, {
101
103
  id: string;
102
- round: number;
103
104
  user: {
104
105
  id: string;
105
- username: number;
106
+ username: string;
106
107
  };
107
108
  createdAt: number;
108
109
  rating: number;
109
- comment: string;
110
110
  game: {
111
111
  id: string;
112
+ round: number;
112
113
  homeTeam: {
113
114
  image: string;
114
115
  teamId: number;
@@ -126,18 +127,18 @@ export declare const ratingSchema: import("zod").ZodObject<{
126
127
  isWinner?: boolean | undefined;
127
128
  };
128
129
  };
130
+ comment?: string | undefined;
129
131
  }, {
130
132
  id: string;
131
- round: number;
132
133
  user: {
133
134
  id: string;
134
- username: number;
135
+ username: string;
135
136
  };
136
137
  createdAt: number;
137
138
  rating: number;
138
- comment: string;
139
139
  game: {
140
140
  id: string;
141
+ round: number;
141
142
  homeTeam: {
142
143
  image: string;
143
144
  teamId: number;
@@ -155,4 +156,73 @@ export declare const ratingSchema: import("zod").ZodObject<{
155
156
  isWinner?: boolean | undefined;
156
157
  };
157
158
  };
159
+ comment?: string | undefined;
160
+ }>;
161
+ export declare const createRatingSchema: import("zod").ZodObject<{
162
+ rating: import("zod").ZodNumber;
163
+ comment: import("zod").ZodOptional<import("zod").ZodString>;
164
+ game: import("zod").ZodObject<Omit<{
165
+ id: import("zod").ZodString;
166
+ round: import("zod").ZodNumber;
167
+ homeTeam: import("zod").ZodObject<{
168
+ id: import("zod").ZodOptional<import("zod").ZodString>;
169
+ teamId: import("zod").ZodNumber;
170
+ score: import("zod").ZodNumber;
171
+ isWinner: import("zod").ZodOptional<import("zod").ZodBoolean>;
172
+ image: import("zod").ZodString;
173
+ seed: import("zod").ZodNumber;
174
+ }, "strip", import("zod").ZodTypeAny, {
175
+ image: string;
176
+ teamId: number;
177
+ score: number;
178
+ seed: number;
179
+ id?: string | undefined;
180
+ isWinner?: boolean | undefined;
181
+ }, {
182
+ image: string;
183
+ teamId: number;
184
+ score: number;
185
+ seed: number;
186
+ id?: string | undefined;
187
+ isWinner?: boolean | undefined;
188
+ }>;
189
+ awayTeam: import("zod").ZodObject<{
190
+ id: import("zod").ZodOptional<import("zod").ZodString>;
191
+ teamId: import("zod").ZodNumber;
192
+ score: import("zod").ZodNumber;
193
+ isWinner: import("zod").ZodOptional<import("zod").ZodBoolean>;
194
+ image: import("zod").ZodString;
195
+ seed: import("zod").ZodNumber;
196
+ }, "strip", import("zod").ZodTypeAny, {
197
+ image: string;
198
+ teamId: number;
199
+ score: number;
200
+ seed: number;
201
+ id?: string | undefined;
202
+ isWinner?: boolean | undefined;
203
+ }, {
204
+ image: string;
205
+ teamId: number;
206
+ score: number;
207
+ seed: number;
208
+ id?: string | undefined;
209
+ isWinner?: boolean | undefined;
210
+ }>;
211
+ }, "round" | "homeTeam" | "awayTeam">, "strip", import("zod").ZodTypeAny, {
212
+ id: string;
213
+ }, {
214
+ id: string;
215
+ }>;
216
+ }, "strip", import("zod").ZodTypeAny, {
217
+ rating: number;
218
+ game: {
219
+ id: string;
220
+ };
221
+ comment?: string | undefined;
222
+ }, {
223
+ rating: number;
224
+ game: {
225
+ id: string;
226
+ };
227
+ comment?: string | undefined;
158
228
  }>;
@@ -1,21 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ratingSchema = void 0;
3
+ exports.createRatingSchema = exports.ratingSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const game_1 = require("./game");
6
6
  exports.ratingSchema = (0, zod_1.object)({
7
7
  id: (0, zod_1.string)(),
8
- comment: (0, zod_1.string)(),
9
8
  createdAt: (0, zod_1.number)(),
10
9
  rating: (0, zod_1.number)(),
10
+ comment: (0, zod_1.string)().optional(),
11
11
  user: (0, zod_1.object)({
12
12
  id: (0, zod_1.string)(),
13
- username: (0, zod_1.number)(),
13
+ username: (0, zod_1.string)(),
14
14
  }),
15
- round: (0, zod_1.number)(),
16
15
  game: (0, zod_1.object)({
17
16
  id: (0, zod_1.string)(),
17
+ round: (0, zod_1.number)(),
18
18
  homeTeam: game_1.gameTeamSchema,
19
19
  awayTeam: game_1.gameTeamSchema,
20
20
  }),
21
21
  });
22
+ exports.createRatingSchema = exports.ratingSchema
23
+ .omit({
24
+ id: true,
25
+ createdAt: true,
26
+ user: true,
27
+ })
28
+ .extend({
29
+ game: exports.ratingSchema.shape.game.omit({
30
+ round: true,
31
+ homeTeam: true,
32
+ awayTeam: true,
33
+ }),
34
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rategame-shared",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "This package contains shared resources for the Rate Game project.",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",