@battle-racing/br-common-lib 3.4.0 → 3.8.0
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/REFACTOR_README.md +185 -0
- package/br-common-lib.code-workspace +19 -0
- package/dist/constants/hardware/damage.d.ts +1 -0
- package/dist/constants/hardware/damage.js +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +2 -0
- package/dist/constants/payment-provider.d.ts +5 -0
- package/dist/constants/payment-provider.js +8 -0
- package/dist/constants/payment-status.d.ts +7 -0
- package/dist/constants/payment-status.js +10 -0
- package/dist/constants/user-role.d.ts +1 -0
- package/dist/constants/user-role.js +1 -0
- package/dist/data/all-damages.d.ts +2 -0
- package/dist/data/all-damages.js +54 -0
- package/dist/data/all-power-ups.d.ts +3 -0
- package/dist/data/all-power-ups.js +521 -0
- package/dist/data/index.d.ts +3 -1
- package/dist/data/index.js +3 -1
- package/dist/schemas/team.schema.d.ts +7 -0
- package/dist/schemas/team.schema.js +9 -0
- package/dist/types/damage/Damage.d.ts +1 -3
- package/dist/types/gameTrack/GameTrackKartConfig.d.ts +9 -0
- package/dist/types/gameTrack/index.d.ts +1 -0
- package/dist/types/gameTrack/index.js +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/pagination/Pagination.d.ts +3 -0
- package/dist/types/pagination/index.d.ts +2 -0
- package/dist/types/pagination/index.js +18 -0
- package/dist/types/pagination/pagination.schema.d.ts +14 -0
- package/dist/types/pagination/pagination.schema.js +16 -0
- package/dist/types/powerUp/PowerUp.d.ts +1 -1
- package/dist/types/powerUp/PowerUpName.d.ts +1 -1
- package/dist/types/racingTeam/RacingTeam.d.ts +6 -0
- package/dist/types/racingTeam/RacingTeam.schema.d.ts +44 -0
- package/dist/types/racingTeam/RacingTeam.schema.js +27 -0
- package/dist/types/racingTeam/RacingTeamMembership.d.ts +6 -0
- package/dist/types/racingTeam/RacingTeamMembership.schema.d.ts +31 -0
- package/dist/types/racingTeam/RacingTeamMembership.schema.js +27 -0
- package/dist/types/racingTeam/index.d.ts +4 -0
- package/dist/types/racingTeam/index.js +20 -0
- package/dist/types/socket/serverToClient/SocketKartServerToClientEventsParams.d.ts +3 -5
- package/dist/types/ticketing/GameTicket.d.ts +3 -0
- package/dist/types/ticketing/GameTicket.js +2 -0
- package/dist/types/ticketing/GameTurn.d.ts +4 -0
- package/dist/types/ticketing/GameTurn.js +2 -0
- package/dist/types/ticketing/GameTurn.schema.d.ts +92 -0
- package/dist/types/ticketing/GameTurn.schema.js +46 -0
- package/dist/types/ticketing/GameTurnTask.d.ts +3 -0
- package/dist/types/ticketing/GameTurnTask.js +2 -0
- package/dist/types/ticketing/GameTurnTask.schema.d.ts +34 -0
- package/dist/types/ticketing/GameTurnTask.schema.js +30 -0
- package/dist/types/ticketing/PaymentProvider.d.ts +34 -0
- package/dist/types/ticketing/PaymentProvider.js +2 -0
- package/dist/types/ticketing/PlayerTurn.d.ts +3 -0
- package/dist/types/ticketing/PlayerTurn.js +2 -0
- package/dist/types/ticketing/Purchase.d.ts +3 -0
- package/dist/types/ticketing/Purchase.js +2 -0
- package/dist/types/ticketing/index.d.ts +9 -0
- package/dist/types/ticketing/index.js +25 -0
- package/dist/types/ticketing/ticketing.schemas.d.ts +58 -0
- package/dist/types/ticketing/ticketing.schemas.js +41 -0
- package/dist/types/user/User.d.ts +4 -9
- package/dist/types/user/index.d.ts +3 -1
- package/dist/types/user/index.js +5 -1
- package/dist/types/user/user-type.schema.d.ts +9 -0
- package/dist/types/user/user-type.schema.js +12 -0
- package/dist/types/user/user.schema.d.ts +39 -0
- package/dist/types/user/user.schema.js +19 -0
- package/package.json +6 -2
- package/src/constants/hardware/damage.ts +1 -0
- package/src/constants/index.ts +2 -1
- package/src/constants/payment-provider.ts +5 -0
- package/src/constants/payment-status.ts +7 -0
- package/src/constants/user-role.ts +1 -0
- package/src/data/all-damages.ts +53 -0
- package/src/data/all-power-ups.ts +526 -0
- package/src/data/index.ts +4 -1
- package/src/schemas/team.schema.ts +9 -0
- package/src/types/damage/Damage.ts +2 -4
- package/src/types/gameTrack/GameTrackKartConfig.ts +10 -0
- package/src/types/gameTrack/index.ts +1 -0
- package/src/types/index.ts +3 -1
- package/src/types/pagination/Pagination.ts +4 -0
- package/src/types/pagination/index.ts +2 -0
- package/src/types/pagination/pagination.schema.ts +14 -0
- package/src/types/powerUp/PowerUp.ts +1 -1
- package/src/types/powerUp/PowerUpName.ts +2 -1
- package/src/types/racingTeam/RacingTeam.schema.ts +29 -0
- package/src/types/racingTeam/RacingTeam.ts +12 -0
- package/src/types/racingTeam/RacingTeamMembership.schema.ts +29 -0
- package/src/types/racingTeam/RacingTeamMembership.ts +12 -0
- package/src/types/racingTeam/index.ts +4 -0
- package/src/types/socket/serverToClient/SocketKartServerToClientEventsParams.ts +3 -4
- package/src/types/ticketing/GameTicket.ts +4 -0
- package/src/types/ticketing/GameTurn.schema.ts +49 -0
- package/src/types/ticketing/GameTurn.ts +6 -0
- package/src/types/ticketing/GameTurnTask.schema.ts +32 -0
- package/src/types/ticketing/GameTurnTask.ts +4 -0
- package/src/types/ticketing/PaymentProvider.ts +40 -0
- package/src/types/ticketing/Purchase.ts +4 -0
- package/src/types/ticketing/index.ts +9 -0
- package/src/types/ticketing/ticketing.schemas.ts +43 -0
- package/src/types/user/User.ts +4 -9
- package/src/types/user/index.ts +4 -1
- package/src/types/user/user-type.schema.ts +8 -0
- package/src/types/user/user.schema.ts +19 -0
- package/README.md +0 -3
- package/dist/types/hardware/screen/ScreenKartPosition.d.ts +0 -4
- package/dist/types/hardware/screen/ScreenRaceLaps.d.ts +0 -4
- package/dist/types/response/SuccesResponse.d.ts +0 -5
- package/dist/types/user/UserOrigin.d.ts +0 -1
- package/src/types/user/UserOrigin.ts +0 -1
- /package/dist/data/{RoleDefinitions.d.ts → role-definitions.d.ts} +0 -0
- /package/dist/data/{RoleDefinitions.js → role-definitions.js} +0 -0
- /package/dist/types/{hardware/screen/ScreenKartPosition.js → gameTrack/GameTrackKartConfig.js} +0 -0
- /package/dist/types/{hardware/screen/ScreenRaceLaps.js → pagination/Pagination.js} +0 -0
- /package/dist/types/{response/SuccesResponse.js → racingTeam/RacingTeam.js} +0 -0
- /package/dist/types/{user/UserOrigin.js → racingTeam/RacingTeamMembership.js} +0 -0
- /package/src/data/{RoleDefinitions.ts → role-definitions.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
export type PowerUpName = 'Battle God' | 'Battle Star' | 'Battle Shot' | 'Battle Nitro' | 'Battle Pulse' | 'Battle Trap' | 'Battle Shield' | 'Battle Turbo';
|
|
1
|
+
export type PowerUpName = 'Battle God' | 'Battle Star' | 'Battle Shot' | 'Battle Nitro' | 'Battle Pulse' | 'Battle Trap' | 'Battle Shield' | 'Battle Turbo' | 'Battle Blue Shot';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createRacingTeamSchema, paginatedRacingTeamSchema, racingTeamSchema, updateRacingTeamSchema } from './RacingTeam.schema';
|
|
3
|
+
export type RacingTeam = z.infer<typeof racingTeamSchema>;
|
|
4
|
+
export type CreateRacingTeamDto = z.infer<typeof createRacingTeamSchema>;
|
|
5
|
+
export type UpdateRacingTeamDto = z.infer<typeof updateRacingTeamSchema>;
|
|
6
|
+
export type PaginatedRacingTeam = z.infer<typeof paginatedRacingTeamSchema>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const racingTeamSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
imageUrl: z.ZodOptional<z.ZodString>;
|
|
6
|
+
adminUserId: z.ZodString;
|
|
7
|
+
createdAt: z.ZodDate;
|
|
8
|
+
updatedAt: z.ZodDate;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const createRacingTeamSchema: z.ZodObject<{
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
imageUrl: z.ZodOptional<z.ZodString>;
|
|
13
|
+
adminUserId: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const updateRacingTeamSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodOptional<z.ZodString>;
|
|
17
|
+
name: z.ZodOptional<z.ZodString>;
|
|
18
|
+
imageUrl: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
19
|
+
adminUserId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
21
|
+
updatedAt: z.ZodOptional<z.ZodDate>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const filterRacingTeamSchema: z.ZodObject<{
|
|
24
|
+
name: z.ZodOptional<z.ZodString>;
|
|
25
|
+
adminUserId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
28
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export declare const paginatedRacingTeamSchema: z.ZodObject<{
|
|
31
|
+
data: z.ZodArray<z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
imageUrl: z.ZodOptional<z.ZodString>;
|
|
35
|
+
adminUserId: z.ZodString;
|
|
36
|
+
createdAt: z.ZodDate;
|
|
37
|
+
updatedAt: z.ZodDate;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
meta: z.ZodObject<{
|
|
40
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
41
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
limit: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paginatedRacingTeamSchema = exports.filterRacingTeamSchema = exports.updateRacingTeamSchema = exports.createRacingTeamSchema = exports.racingTeamSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const pagination_1 = require("../pagination");
|
|
6
|
+
exports.racingTeamSchema = zod_1.z.object({
|
|
7
|
+
id: zod_1.z.string(),
|
|
8
|
+
name: zod_1.z.string().min(3).max(50),
|
|
9
|
+
imageUrl: zod_1.z.string().url().optional(),
|
|
10
|
+
adminUserId: zod_1.z.string(),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
14
|
+
exports.createRacingTeamSchema = exports.racingTeamSchema.omit({
|
|
15
|
+
id: true,
|
|
16
|
+
createdAt: true,
|
|
17
|
+
updatedAt: true,
|
|
18
|
+
});
|
|
19
|
+
exports.updateRacingTeamSchema = exports.racingTeamSchema.partial();
|
|
20
|
+
exports.filterRacingTeamSchema = zod_1.z.object({
|
|
21
|
+
name: zod_1.z.string().optional(),
|
|
22
|
+
adminUserId: zod_1.z.string().optional(),
|
|
23
|
+
page: zod_1.z.number().min(1).default(1),
|
|
24
|
+
limit: zod_1.z.number().min(1).max(100).default(10),
|
|
25
|
+
cursor: zod_1.z.string().optional(),
|
|
26
|
+
});
|
|
27
|
+
exports.paginatedRacingTeamSchema = (0, pagination_1.paginatedResponseSchema)(exports.racingTeamSchema);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { joinRequestSchema, teamMemberSchema, createJoinRequestSchema, answerJoinRequestSchema } from './RacingTeamMembership.schema';
|
|
3
|
+
export type JoinRequest = z.infer<typeof joinRequestSchema>;
|
|
4
|
+
export type TeamMember = z.infer<typeof teamMemberSchema>;
|
|
5
|
+
export type CreateJoinRequest = z.infer<typeof createJoinRequestSchema>;
|
|
6
|
+
export type AnswerJoinRequest = z.infer<typeof answerJoinRequestSchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const joinRequestSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
racingTeamId: z.ZodString;
|
|
5
|
+
userId: z.ZodString;
|
|
6
|
+
status: z.ZodEnum<{
|
|
7
|
+
PENDING: "PENDING";
|
|
8
|
+
ACCEPTED: "ACCEPTED";
|
|
9
|
+
REJECTED: "REJECTED";
|
|
10
|
+
}>;
|
|
11
|
+
createdAt: z.ZodDate;
|
|
12
|
+
updatedAt: z.ZodDate;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const teamMemberSchema: z.ZodObject<{
|
|
15
|
+
racingTeamId: z.ZodString;
|
|
16
|
+
userId: z.ZodString;
|
|
17
|
+
role: z.ZodEnum<{
|
|
18
|
+
PILOT: "PILOT";
|
|
19
|
+
TECHNICIAN: "TECHNICIAN";
|
|
20
|
+
COACH: "COACH";
|
|
21
|
+
}>;
|
|
22
|
+
joinedAt: z.ZodDate;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const createJoinRequestSchema: z.ZodObject<{
|
|
25
|
+
racingTeamId: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const answerJoinRequestSchema: z.ZodObject<{
|
|
28
|
+
racingTeamId: z.ZodString;
|
|
29
|
+
targetUserId: z.ZodString;
|
|
30
|
+
accepted: z.ZodBoolean;
|
|
31
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// libs/common/src/schemas/racing-team-membership.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.answerJoinRequestSchema = exports.createJoinRequestSchema = exports.teamMemberSchema = exports.joinRequestSchema = void 0;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.joinRequestSchema = zod_1.z.object({
|
|
7
|
+
id: zod_1.z.string(),
|
|
8
|
+
racingTeamId: zod_1.z.string(),
|
|
9
|
+
userId: zod_1.z.string(),
|
|
10
|
+
status: zod_1.z.enum(['PENDING', 'ACCEPTED', 'REJECTED']),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
14
|
+
exports.teamMemberSchema = zod_1.z.object({
|
|
15
|
+
racingTeamId: zod_1.z.string(),
|
|
16
|
+
userId: zod_1.z.string(),
|
|
17
|
+
role: zod_1.z.enum(['PILOT', 'TECHNICIAN', 'COACH']),
|
|
18
|
+
joinedAt: zod_1.z.date(),
|
|
19
|
+
});
|
|
20
|
+
exports.createJoinRequestSchema = zod_1.z.object({
|
|
21
|
+
racingTeamId: zod_1.z.string(),
|
|
22
|
+
});
|
|
23
|
+
exports.answerJoinRequestSchema = zod_1.z.object({
|
|
24
|
+
racingTeamId: zod_1.z.string(),
|
|
25
|
+
targetUserId: zod_1.z.string(),
|
|
26
|
+
accepted: zod_1.z.boolean(),
|
|
27
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./RacingTeam"), exports);
|
|
18
|
+
__exportStar(require("./RacingTeam.schema"), exports);
|
|
19
|
+
__exportStar(require("./RacingTeamMembership"), exports);
|
|
20
|
+
__exportStar(require("./RacingTeamMembership.schema"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Game, GameType } from '../../game';
|
|
2
|
-
import type { GameTrack } from '../../gameTrack';
|
|
2
|
+
import type { GameTrack, GameTrackKartConfig } from '../../gameTrack';
|
|
3
3
|
import type { Kart, KartStatus } from '../../kart';
|
|
4
4
|
import type { Response } from '../../response';
|
|
5
5
|
import type { SocketPowerUpEventsParams } from '../SocketPowerUpEventsParams';
|
|
@@ -11,16 +11,14 @@ export type SocketKartPowerUpEventsParams = {
|
|
|
11
11
|
[Key in keyof SocketPowerUpEventsParams as `kart:${Key}`]: SocketPowerUpEventsParams[Key];
|
|
12
12
|
};
|
|
13
13
|
export interface SocketKartEventsParams {
|
|
14
|
-
'kart:updated': {
|
|
15
|
-
kart: Kart;
|
|
16
|
-
};
|
|
17
14
|
'kart:init:response': Response<{
|
|
18
15
|
kart: Kart;
|
|
19
16
|
gameTrack: GameTrack;
|
|
20
17
|
}>;
|
|
21
|
-
/** Whenever the Game Track config changed */
|
|
18
|
+
/** Whenever the Game Track config changed, the config might change as well*/
|
|
22
19
|
'kart:gameTrack:updated': {
|
|
23
20
|
gameTrack: GameTrack;
|
|
21
|
+
config: GameTrackKartConfig;
|
|
24
22
|
};
|
|
25
23
|
/** When the physical button of the game track is pressed */
|
|
26
24
|
'kart:gameTrack:emergency:started': undefined;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GAME_TURN_STATUS: {
|
|
3
|
+
readonly CREATED: "created";
|
|
4
|
+
readonly IN_QUEUE: "in_queue";
|
|
5
|
+
readonly READY: "ready";
|
|
6
|
+
readonly PLAYING: "playing";
|
|
7
|
+
readonly COMPLETED: "completed";
|
|
8
|
+
};
|
|
9
|
+
export declare const GAME_TURN_CHECK: {
|
|
10
|
+
readonly TUTORIAL: "tutorial";
|
|
11
|
+
readonly AGE_VERIFICATION: "age_verification";
|
|
12
|
+
readonly TERMS_ACCEPTANCE: "terms_acceptance";
|
|
13
|
+
};
|
|
14
|
+
export declare const GameTurnStatusSchema: z.ZodEnum<{
|
|
15
|
+
completed: "completed";
|
|
16
|
+
created: "created";
|
|
17
|
+
in_queue: "in_queue";
|
|
18
|
+
ready: "ready";
|
|
19
|
+
playing: "playing";
|
|
20
|
+
}>;
|
|
21
|
+
export declare const GameTurnCheckSchema: z.ZodEnum<{
|
|
22
|
+
tutorial: "tutorial";
|
|
23
|
+
age_verification: "age_verification";
|
|
24
|
+
terms_acceptance: "terms_acceptance";
|
|
25
|
+
}>;
|
|
26
|
+
export declare const GameTurnSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
purchaseId: z.ZodString;
|
|
29
|
+
leaderUsername: z.ZodString;
|
|
30
|
+
gameTickets: z.ZodArray<z.ZodString>;
|
|
31
|
+
usernames: z.ZodArray<z.ZodString>;
|
|
32
|
+
status: z.ZodEnum<{
|
|
33
|
+
completed: "completed";
|
|
34
|
+
created: "created";
|
|
35
|
+
in_queue: "in_queue";
|
|
36
|
+
ready: "ready";
|
|
37
|
+
playing: "playing";
|
|
38
|
+
}>;
|
|
39
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
type: z.ZodEnum<{
|
|
42
|
+
qr_scan: "qr_scan";
|
|
43
|
+
manual_check: "manual_check";
|
|
44
|
+
link_accept: "link_accept";
|
|
45
|
+
}>;
|
|
46
|
+
status: z.ZodEnum<{
|
|
47
|
+
pending: "pending";
|
|
48
|
+
completed: "completed";
|
|
49
|
+
}>;
|
|
50
|
+
label: z.ZodString;
|
|
51
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
52
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
createdAt: z.ZodDate;
|
|
55
|
+
updatedAt: z.ZodDate;
|
|
56
|
+
startedAt: z.ZodOptional<z.ZodDate>;
|
|
57
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export declare const GameTurnQueueItemSchema: z.ZodObject<{
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
purchaseId: z.ZodString;
|
|
62
|
+
leaderUsername: z.ZodString;
|
|
63
|
+
gameTickets: z.ZodArray<z.ZodString>;
|
|
64
|
+
usernames: z.ZodArray<z.ZodString>;
|
|
65
|
+
status: z.ZodEnum<{
|
|
66
|
+
completed: "completed";
|
|
67
|
+
created: "created";
|
|
68
|
+
in_queue: "in_queue";
|
|
69
|
+
ready: "ready";
|
|
70
|
+
playing: "playing";
|
|
71
|
+
}>;
|
|
72
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
73
|
+
id: z.ZodString;
|
|
74
|
+
type: z.ZodEnum<{
|
|
75
|
+
qr_scan: "qr_scan";
|
|
76
|
+
manual_check: "manual_check";
|
|
77
|
+
link_accept: "link_accept";
|
|
78
|
+
}>;
|
|
79
|
+
status: z.ZodEnum<{
|
|
80
|
+
pending: "pending";
|
|
81
|
+
completed: "completed";
|
|
82
|
+
}>;
|
|
83
|
+
label: z.ZodString;
|
|
84
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
85
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
createdAt: z.ZodDate;
|
|
88
|
+
updatedAt: z.ZodDate;
|
|
89
|
+
startedAt: z.ZodOptional<z.ZodDate>;
|
|
90
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
91
|
+
position: z.ZodNumber;
|
|
92
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GameTurnQueueItemSchema = exports.GameTurnSchema = exports.GameTurnCheckSchema = exports.GameTurnStatusSchema = exports.GAME_TURN_CHECK = exports.GAME_TURN_STATUS = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const GameTurnTask_schema_1 = require("./GameTurnTask.schema");
|
|
6
|
+
exports.GAME_TURN_STATUS = {
|
|
7
|
+
CREATED: 'created',
|
|
8
|
+
IN_QUEUE: 'in_queue',
|
|
9
|
+
READY: 'ready',
|
|
10
|
+
PLAYING: 'playing',
|
|
11
|
+
COMPLETED: 'completed',
|
|
12
|
+
};
|
|
13
|
+
exports.GAME_TURN_CHECK = {
|
|
14
|
+
TUTORIAL: 'tutorial',
|
|
15
|
+
AGE_VERIFICATION: 'age_verification',
|
|
16
|
+
TERMS_ACCEPTANCE: 'terms_acceptance',
|
|
17
|
+
};
|
|
18
|
+
exports.GameTurnStatusSchema = zod_1.z.enum([
|
|
19
|
+
exports.GAME_TURN_STATUS.CREATED,
|
|
20
|
+
exports.GAME_TURN_STATUS.IN_QUEUE,
|
|
21
|
+
exports.GAME_TURN_STATUS.READY,
|
|
22
|
+
exports.GAME_TURN_STATUS.PLAYING,
|
|
23
|
+
exports.GAME_TURN_STATUS.COMPLETED,
|
|
24
|
+
]);
|
|
25
|
+
exports.GameTurnCheckSchema = zod_1.z.enum([
|
|
26
|
+
exports.GAME_TURN_CHECK.TUTORIAL,
|
|
27
|
+
exports.GAME_TURN_CHECK.AGE_VERIFICATION,
|
|
28
|
+
exports.GAME_TURN_CHECK.TERMS_ACCEPTANCE,
|
|
29
|
+
]);
|
|
30
|
+
exports.GameTurnSchema = zod_1.z.object({
|
|
31
|
+
id: zod_1.z.string(),
|
|
32
|
+
purchaseId: zod_1.z.string(),
|
|
33
|
+
leaderUsername: zod_1.z.string(),
|
|
34
|
+
gameTickets: zod_1.z.array(zod_1.z.string()),
|
|
35
|
+
usernames: zod_1.z.array(zod_1.z.string()),
|
|
36
|
+
status: exports.GameTurnStatusSchema,
|
|
37
|
+
tasks: zod_1.z.array(GameTurnTask_schema_1.GameTurnTaskSchema),
|
|
38
|
+
createdAt: zod_1.z.date(),
|
|
39
|
+
updatedAt: zod_1.z.date(),
|
|
40
|
+
startedAt: zod_1.z.date().optional(),
|
|
41
|
+
completedAt: zod_1.z.date().optional(),
|
|
42
|
+
});
|
|
43
|
+
// The Game turn queue item requires a position to sort it.
|
|
44
|
+
exports.GameTurnQueueItemSchema = exports.GameTurnSchema.extend({
|
|
45
|
+
position: zod_1.z.number(),
|
|
46
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GAME_TURN_TASK_TYPE: {
|
|
3
|
+
readonly QR_SCAN: "qr_scan";
|
|
4
|
+
readonly MANUAL_CHECK: "manual_check";
|
|
5
|
+
readonly LINK_ACCEPT: "link_accept";
|
|
6
|
+
};
|
|
7
|
+
export declare const GAME_TURN_TASK_STATUS: {
|
|
8
|
+
readonly PENDING: "pending";
|
|
9
|
+
readonly COMPLETED: "completed";
|
|
10
|
+
};
|
|
11
|
+
export declare const GameTurnTaskTypeSchema: z.ZodEnum<{
|
|
12
|
+
qr_scan: "qr_scan";
|
|
13
|
+
manual_check: "manual_check";
|
|
14
|
+
link_accept: "link_accept";
|
|
15
|
+
}>;
|
|
16
|
+
export declare const GameTurnTaskStatusSchema: z.ZodEnum<{
|
|
17
|
+
pending: "pending";
|
|
18
|
+
completed: "completed";
|
|
19
|
+
}>;
|
|
20
|
+
export declare const GameTurnTaskSchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
type: z.ZodEnum<{
|
|
23
|
+
qr_scan: "qr_scan";
|
|
24
|
+
manual_check: "manual_check";
|
|
25
|
+
link_accept: "link_accept";
|
|
26
|
+
}>;
|
|
27
|
+
status: z.ZodEnum<{
|
|
28
|
+
pending: "pending";
|
|
29
|
+
completed: "completed";
|
|
30
|
+
}>;
|
|
31
|
+
label: z.ZodString;
|
|
32
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
33
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
34
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GameTurnTaskSchema = exports.GameTurnTaskStatusSchema = exports.GameTurnTaskTypeSchema = exports.GAME_TURN_TASK_STATUS = exports.GAME_TURN_TASK_TYPE = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.GAME_TURN_TASK_TYPE = {
|
|
6
|
+
QR_SCAN: 'qr_scan',
|
|
7
|
+
MANUAL_CHECK: 'manual_check',
|
|
8
|
+
LINK_ACCEPT: 'link_accept',
|
|
9
|
+
};
|
|
10
|
+
exports.GAME_TURN_TASK_STATUS = {
|
|
11
|
+
PENDING: 'pending',
|
|
12
|
+
COMPLETED: 'completed',
|
|
13
|
+
};
|
|
14
|
+
exports.GameTurnTaskTypeSchema = zod_1.z.enum([
|
|
15
|
+
exports.GAME_TURN_TASK_TYPE.QR_SCAN,
|
|
16
|
+
exports.GAME_TURN_TASK_TYPE.MANUAL_CHECK,
|
|
17
|
+
exports.GAME_TURN_TASK_TYPE.LINK_ACCEPT,
|
|
18
|
+
]);
|
|
19
|
+
exports.GameTurnTaskStatusSchema = zod_1.z.enum([
|
|
20
|
+
exports.GAME_TURN_TASK_STATUS.PENDING,
|
|
21
|
+
exports.GAME_TURN_TASK_STATUS.COMPLETED,
|
|
22
|
+
]);
|
|
23
|
+
exports.GameTurnTaskSchema = zod_1.z.object({
|
|
24
|
+
id: zod_1.z.string(),
|
|
25
|
+
type: exports.GameTurnTaskTypeSchema,
|
|
26
|
+
status: exports.GameTurnTaskStatusSchema,
|
|
27
|
+
label: zod_1.z.string(),
|
|
28
|
+
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
29
|
+
completedAt: zod_1.z.date().optional(),
|
|
30
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PAYMENT_PROVIDERS, PAYMENT_STATUSES } from '../../constants';
|
|
2
|
+
export type PaymentProviderName = (typeof PAYMENT_PROVIDERS)[keyof typeof PAYMENT_PROVIDERS];
|
|
3
|
+
export type PaymentStatus = (typeof PAYMENT_STATUSES)[keyof typeof PAYMENT_STATUSES];
|
|
4
|
+
/**
|
|
5
|
+
* Generic payment provider data that can be reused across different providers
|
|
6
|
+
* This allows easy switching between Stripe, PayPal, etc.
|
|
7
|
+
*/
|
|
8
|
+
export interface PaymentProviderData {
|
|
9
|
+
provider: PaymentProviderName;
|
|
10
|
+
paymentIntentId?: string;
|
|
11
|
+
transactionId: string;
|
|
12
|
+
amountPaid: number;
|
|
13
|
+
currency: string;
|
|
14
|
+
paymentStatus: PaymentStatus;
|
|
15
|
+
paymentMethod?: string;
|
|
16
|
+
metadata?: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Strategy interface for payment providers
|
|
20
|
+
*/
|
|
21
|
+
export interface PaymentProvider {
|
|
22
|
+
/**
|
|
23
|
+
* Confirm and validate a purchase from webhook payload
|
|
24
|
+
*/
|
|
25
|
+
confirmPurchase(payload: any, signature?: string): Promise<PaymentProviderData>;
|
|
26
|
+
/**
|
|
27
|
+
* Validate webhook signature if provided
|
|
28
|
+
*/
|
|
29
|
+
validateWebhookSignature?(payload: any, signature: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Get provider name
|
|
32
|
+
*/
|
|
33
|
+
getProviderName(): string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './GameTicket';
|
|
2
|
+
export * from './PaymentProvider';
|
|
3
|
+
export * from './GameTurn';
|
|
4
|
+
export * from './Purchase';
|
|
5
|
+
export * from './ticketing.schemas';
|
|
6
|
+
export * from './ticketing.schemas';
|
|
7
|
+
export * from './GameTurnTask';
|
|
8
|
+
export * from './GameTurnTask.schema';
|
|
9
|
+
export * from './GameTurn.schema';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./GameTicket"), exports);
|
|
18
|
+
__exportStar(require("./PaymentProvider"), exports);
|
|
19
|
+
__exportStar(require("./GameTurn"), exports);
|
|
20
|
+
__exportStar(require("./Purchase"), exports);
|
|
21
|
+
__exportStar(require("./ticketing.schemas"), exports);
|
|
22
|
+
__exportStar(require("./ticketing.schemas"), exports);
|
|
23
|
+
__exportStar(require("./GameTurnTask"), exports);
|
|
24
|
+
__exportStar(require("./GameTurnTask.schema"), exports);
|
|
25
|
+
__exportStar(require("./GameTurn.schema"), exports);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GAME_TICKET_STATUS: {
|
|
3
|
+
readonly CREATED: "created";
|
|
4
|
+
readonly ASSIGNED: "assigned";
|
|
5
|
+
readonly ACTIVE: "active";
|
|
6
|
+
readonly COMPLETED: "completed";
|
|
7
|
+
};
|
|
8
|
+
export declare const TICKET_USER_TYPE: {
|
|
9
|
+
readonly LEADER: "leader";
|
|
10
|
+
readonly SUB_USER: "sub-user";
|
|
11
|
+
readonly EXISTING: "existing";
|
|
12
|
+
readonly GUEST: "guest";
|
|
13
|
+
};
|
|
14
|
+
export declare const GameTicketStatusSchema: z.ZodEnum<{
|
|
15
|
+
readonly CREATED: "created";
|
|
16
|
+
readonly ASSIGNED: "assigned";
|
|
17
|
+
readonly ACTIVE: "active";
|
|
18
|
+
readonly COMPLETED: "completed";
|
|
19
|
+
}>;
|
|
20
|
+
export declare const TicketUserTypeSchema: z.ZodEnum<{
|
|
21
|
+
readonly LEADER: "leader";
|
|
22
|
+
readonly SUB_USER: "sub-user";
|
|
23
|
+
readonly EXISTING: "existing";
|
|
24
|
+
readonly GUEST: "guest";
|
|
25
|
+
}>;
|
|
26
|
+
export declare const GameTicketSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
purchaseId: z.ZodString;
|
|
29
|
+
gameTurnId: z.ZodString;
|
|
30
|
+
ownerUsername: z.ZodString;
|
|
31
|
+
userType: z.ZodEnum<{
|
|
32
|
+
readonly LEADER: "leader";
|
|
33
|
+
readonly SUB_USER: "sub-user";
|
|
34
|
+
readonly EXISTING: "existing";
|
|
35
|
+
readonly GUEST: "guest";
|
|
36
|
+
}>;
|
|
37
|
+
status: z.ZodEnum<{
|
|
38
|
+
readonly CREATED: "created";
|
|
39
|
+
readonly ASSIGNED: "assigned";
|
|
40
|
+
readonly ACTIVE: "active";
|
|
41
|
+
readonly COMPLETED: "completed";
|
|
42
|
+
}>;
|
|
43
|
+
createdAt: z.ZodDate;
|
|
44
|
+
updatedAt: z.ZodDate;
|
|
45
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export declare const PurchaseSchema: z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
purchaseNumber: z.ZodNumber;
|
|
50
|
+
buyerUserId: z.ZodString;
|
|
51
|
+
totalTickets: z.ZodNumber;
|
|
52
|
+
availableTickets: z.ZodNumber;
|
|
53
|
+
usedTickets: z.ZodNumber;
|
|
54
|
+
purchaseDate: z.ZodDate;
|
|
55
|
+
paymentData: z.ZodOptional<z.ZodAny>;
|
|
56
|
+
createdAt: z.ZodDate;
|
|
57
|
+
updatedAt: z.ZodDate;
|
|
58
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PurchaseSchema = exports.GameTicketSchema = exports.TicketUserTypeSchema = exports.GameTicketStatusSchema = exports.TICKET_USER_TYPE = exports.GAME_TICKET_STATUS = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.GAME_TICKET_STATUS = {
|
|
6
|
+
CREATED: 'created',
|
|
7
|
+
ASSIGNED: 'assigned',
|
|
8
|
+
ACTIVE: 'active',
|
|
9
|
+
COMPLETED: 'completed',
|
|
10
|
+
};
|
|
11
|
+
exports.TICKET_USER_TYPE = {
|
|
12
|
+
LEADER: 'leader',
|
|
13
|
+
SUB_USER: 'sub-user',
|
|
14
|
+
EXISTING: 'existing',
|
|
15
|
+
GUEST: 'guest',
|
|
16
|
+
};
|
|
17
|
+
exports.GameTicketStatusSchema = zod_1.z.enum(exports.GAME_TICKET_STATUS);
|
|
18
|
+
exports.TicketUserTypeSchema = zod_1.z.enum(exports.TICKET_USER_TYPE);
|
|
19
|
+
exports.GameTicketSchema = zod_1.z.object({
|
|
20
|
+
id: zod_1.z.string(),
|
|
21
|
+
purchaseId: zod_1.z.string(),
|
|
22
|
+
gameTurnId: zod_1.z.string(),
|
|
23
|
+
ownerUsername: zod_1.z.string(),
|
|
24
|
+
userType: exports.TicketUserTypeSchema,
|
|
25
|
+
status: exports.GameTicketStatusSchema,
|
|
26
|
+
createdAt: zod_1.z.date(),
|
|
27
|
+
updatedAt: zod_1.z.date(),
|
|
28
|
+
completedAt: zod_1.z.date().optional(),
|
|
29
|
+
});
|
|
30
|
+
exports.PurchaseSchema = zod_1.z.object({
|
|
31
|
+
id: zod_1.z.string(),
|
|
32
|
+
purchaseNumber: zod_1.z.number(),
|
|
33
|
+
buyerUserId: zod_1.z.string(),
|
|
34
|
+
totalTickets: zod_1.z.number(),
|
|
35
|
+
availableTickets: zod_1.z.number(),
|
|
36
|
+
usedTickets: zod_1.z.number(),
|
|
37
|
+
purchaseDate: zod_1.z.date(),
|
|
38
|
+
paymentData: zod_1.z.any().optional(),
|
|
39
|
+
createdAt: zod_1.z.date(),
|
|
40
|
+
updatedAt: zod_1.z.date(),
|
|
41
|
+
});
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
username: string;
|
|
6
|
-
name: string;
|
|
7
|
-
origin: UserOrigin;
|
|
8
|
-
role: UserRole;
|
|
9
|
-
}
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserSchema, UserWithPasswordSchema } from './user.schema';
|
|
3
|
+
export type User = z.infer<typeof UserSchema>;
|
|
4
|
+
export type UserWithPassword = z.infer<typeof UserWithPasswordSchema>;
|