brackets-drizzle-db 2.1.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/LICENSE +674 -0
- package/README.md +136 -0
- package/dist/db/index.d.ts +7 -0
- package/dist/db/index.js +48 -0
- package/dist/db/schema/enums.d.ts +12 -0
- package/dist/db/schema/enums.js +41 -0
- package/dist/db/schema/group.d.ts +65 -0
- package/dist/db/schema/group.js +26 -0
- package/dist/db/schema/index.d.ts +8 -0
- package/dist/db/schema/index.js +26 -0
- package/dist/db/schema/match-game.d.ts +267 -0
- package/dist/db/schema/match-game.js +81 -0
- package/dist/db/schema/match.d.ts +303 -0
- package/dist/db/schema/match.js +94 -0
- package/dist/db/schema/participant.d.ts +82 -0
- package/dist/db/schema/participant.js +27 -0
- package/dist/db/schema/round.d.ts +82 -0
- package/dist/db/schema/round.js +33 -0
- package/dist/db/schema/stage.d.ts +344 -0
- package/dist/db/schema/stage.js +72 -0
- package/dist/db/schema/tournament.d.ts +115 -0
- package/dist/db/schema/tournament.js +25 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/storage-handlers/delete-handlers/group.d.ts +3 -0
- package/dist/storage-handlers/delete-handlers/group.js +27 -0
- package/dist/storage-handlers/delete-handlers/index.d.ts +7 -0
- package/dist/storage-handlers/delete-handlers/index.js +23 -0
- package/dist/storage-handlers/delete-handlers/match-game.d.ts +3 -0
- package/dist/storage-handlers/delete-handlers/match-game.js +43 -0
- package/dist/storage-handlers/delete-handlers/match.d.ts +3 -0
- package/dist/storage-handlers/delete-handlers/match.js +45 -0
- package/dist/storage-handlers/delete-handlers/participant.d.ts +3 -0
- package/dist/storage-handlers/delete-handlers/participant.js +27 -0
- package/dist/storage-handlers/delete-handlers/round.d.ts +3 -0
- package/dist/storage-handlers/delete-handlers/round.js +29 -0
- package/dist/storage-handlers/delete-handlers/stage.d.ts +3 -0
- package/dist/storage-handlers/delete-handlers/stage.js +48 -0
- package/dist/storage-handlers/delete-handlers/tournament.d.ts +3 -0
- package/dist/storage-handlers/delete-handlers/tournament.js +25 -0
- package/dist/storage-handlers/delete.d.ts +3 -0
- package/dist/storage-handlers/delete.js +24 -0
- package/dist/storage-handlers/index.d.ts +4 -0
- package/dist/storage-handlers/index.js +20 -0
- package/dist/storage-handlers/insert-handlers/group.d.ts +5 -0
- package/dist/storage-handlers/insert-handlers/group.js +21 -0
- package/dist/storage-handlers/insert-handlers/index.d.ts +7 -0
- package/dist/storage-handlers/insert-handlers/index.js +23 -0
- package/dist/storage-handlers/insert-handlers/match-game.d.ts +5 -0
- package/dist/storage-handlers/insert-handlers/match-game.js +66 -0
- package/dist/storage-handlers/insert-handlers/match.d.ts +5 -0
- package/dist/storage-handlers/insert-handlers/match.js +66 -0
- package/dist/storage-handlers/insert-handlers/participant.d.ts +5 -0
- package/dist/storage-handlers/insert-handlers/participant.js +25 -0
- package/dist/storage-handlers/insert-handlers/round.d.ts +5 -0
- package/dist/storage-handlers/insert-handlers/round.js +21 -0
- package/dist/storage-handlers/insert-handlers/stage.d.ts +5 -0
- package/dist/storage-handlers/insert-handlers/stage.js +44 -0
- package/dist/storage-handlers/insert-handlers/tournament.d.ts +5 -0
- package/dist/storage-handlers/insert-handlers/tournament.js +25 -0
- package/dist/storage-handlers/insert.d.ts +3 -0
- package/dist/storage-handlers/insert.js +25 -0
- package/dist/storage-handlers/select-handlers/group.d.ts +3 -0
- package/dist/storage-handlers/select-handlers/group.js +44 -0
- package/dist/storage-handlers/select-handlers/index.d.ts +7 -0
- package/dist/storage-handlers/select-handlers/index.js +23 -0
- package/dist/storage-handlers/select-handlers/match-game.d.ts +3 -0
- package/dist/storage-handlers/select-handlers/match-game.js +80 -0
- package/dist/storage-handlers/select-handlers/match.d.ts +3 -0
- package/dist/storage-handlers/select-handlers/match.js +86 -0
- package/dist/storage-handlers/select-handlers/participant.d.ts +3 -0
- package/dist/storage-handlers/select-handlers/participant.js +40 -0
- package/dist/storage-handlers/select-handlers/round.d.ts +3 -0
- package/dist/storage-handlers/select-handlers/round.js +46 -0
- package/dist/storage-handlers/select-handlers/stage.d.ts +3 -0
- package/dist/storage-handlers/select-handlers/stage.js +60 -0
- package/dist/storage-handlers/select-handlers/tournament.d.ts +3 -0
- package/dist/storage-handlers/select-handlers/tournament.js +38 -0
- package/dist/storage-handlers/select.d.ts +3 -0
- package/dist/storage-handlers/select.js +24 -0
- package/dist/storage-handlers/update-handlers/group.d.ts +3 -0
- package/dist/storage-handlers/update-handlers/group.js +33 -0
- package/dist/storage-handlers/update-handlers/index.d.ts +7 -0
- package/dist/storage-handlers/update-handlers/index.js +23 -0
- package/dist/storage-handlers/update-handlers/match-game.d.ts +3 -0
- package/dist/storage-handlers/update-handlers/match-game.js +99 -0
- package/dist/storage-handlers/update-handlers/match.d.ts +3 -0
- package/dist/storage-handlers/update-handlers/match.js +105 -0
- package/dist/storage-handlers/update-handlers/participant.d.ts +3 -0
- package/dist/storage-handlers/update-handlers/participant.js +40 -0
- package/dist/storage-handlers/update-handlers/round.d.ts +3 -0
- package/dist/storage-handlers/update-handlers/round.js +37 -0
- package/dist/storage-handlers/update-handlers/stage.d.ts +3 -0
- package/dist/storage-handlers/update-handlers/stage.js +61 -0
- package/dist/storage-handlers/update-handlers/tournament.d.ts +3 -0
- package/dist/storage-handlers/update-handlers/tournament.js +40 -0
- package/dist/storage-handlers/update.d.ts +3 -0
- package/dist/storage-handlers/update.js +24 -0
- package/dist/storage.d.ts +18 -0
- package/dist/storage.js +25 -0
- package/dist/transformers/enum/grand-final-type.d.ts +6 -0
- package/dist/transformers/enum/grand-final-type.js +25 -0
- package/dist/transformers/enum/index.d.ts +6 -0
- package/dist/transformers/enum/index.js +22 -0
- package/dist/transformers/enum/match-result.d.ts +6 -0
- package/dist/transformers/enum/match-result.js +25 -0
- package/dist/transformers/enum/match-status.d.ts +6 -0
- package/dist/transformers/enum/match-status.js +38 -0
- package/dist/transformers/enum/round-robin-mode.d.ts +6 -0
- package/dist/transformers/enum/round-robin-mode.js +21 -0
- package/dist/transformers/enum/seed-ordering.d.ts +6 -0
- package/dist/transformers/enum/seed-ordering.js +49 -0
- package/dist/transformers/enum/stage-type.d.ts +6 -0
- package/dist/transformers/enum/stage-type.js +25 -0
- package/dist/transformers/index.d.ts +2 -0
- package/dist/transformers/index.js +18 -0
- package/dist/transformers/model/group.d.ts +15 -0
- package/dist/transformers/model/group.js +18 -0
- package/dist/transformers/model/index.d.ts +9 -0
- package/dist/transformers/model/index.js +25 -0
- package/dist/transformers/model/match-game.d.ts +21 -0
- package/dist/transformers/model/match-game.js +90 -0
- package/dist/transformers/model/match.d.ts +23 -0
- package/dist/transformers/model/match.js +96 -0
- package/dist/transformers/model/participant-result.d.ts +21 -0
- package/dist/transformers/model/participant-result.js +26 -0
- package/dist/transformers/model/participant.d.ts +19 -0
- package/dist/transformers/model/participant.js +47 -0
- package/dist/transformers/model/round.d.ts +17 -0
- package/dist/transformers/model/round.js +20 -0
- package/dist/transformers/model/stage-settings.d.ts +18 -0
- package/dist/transformers/model/stage-settings.js +46 -0
- package/dist/transformers/model/stage.d.ts +22 -0
- package/dist/transformers/model/stage.js +26 -0
- package/dist/transformers/model/tournament.d.ts +30 -0
- package/dist/transformers/model/tournament.js +39 -0
- package/dist/types.d.ts +15 -0
- package/dist/types.js +2 -0
- package/package.json +45 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.participantMatchGameResultRelations = exports.participantMatchGameResult = exports.matchGameRelations = exports.matchGame = void 0;
|
|
4
|
+
const pg_core_1 = require("drizzle-orm/pg-core");
|
|
5
|
+
const drizzle_orm_1 = require("drizzle-orm");
|
|
6
|
+
const enums_1 = require("./enums");
|
|
7
|
+
const stage_1 = require("./stage");
|
|
8
|
+
const match_1 = require("./match");
|
|
9
|
+
const participant_1 = require("./participant");
|
|
10
|
+
// A game within a match.
|
|
11
|
+
exports.matchGame = (0, pg_core_1.pgTable)('MatchGame', {
|
|
12
|
+
id: (0, pg_core_1.text)('id').primaryKey(),
|
|
13
|
+
// Status of the match game.
|
|
14
|
+
status: (0, enums_1.matchStatusEnum)('status').notNull(),
|
|
15
|
+
// Additional data for the match game.
|
|
16
|
+
extra: (0, pg_core_1.jsonb)('extra'),
|
|
17
|
+
// ID of the parent stage.
|
|
18
|
+
stageId: (0, pg_core_1.text)('stageId')
|
|
19
|
+
.notNull()
|
|
20
|
+
.references(() => stage_1.stage.id),
|
|
21
|
+
// ID of the parent match.
|
|
22
|
+
matchId: (0, pg_core_1.text)('matchId')
|
|
23
|
+
.notNull()
|
|
24
|
+
.references(() => match_1.match.id),
|
|
25
|
+
// The number of the match game in its match
|
|
26
|
+
number: (0, pg_core_1.integer)('number').notNull(),
|
|
27
|
+
});
|
|
28
|
+
exports.matchGameRelations = (0, drizzle_orm_1.relations)(exports.matchGame, ({ one }) => ({
|
|
29
|
+
stage: one(stage_1.stage, {
|
|
30
|
+
fields: [exports.matchGame.stageId],
|
|
31
|
+
references: [stage_1.stage.id],
|
|
32
|
+
}),
|
|
33
|
+
match: one(match_1.match, {
|
|
34
|
+
fields: [exports.matchGame.matchId],
|
|
35
|
+
references: [match_1.match.id],
|
|
36
|
+
}),
|
|
37
|
+
opponent1Result: one(exports.participantMatchGameResult, {
|
|
38
|
+
fields: [exports.matchGame.id],
|
|
39
|
+
references: [exports.participantMatchGameResult.opponent1MatchGameId],
|
|
40
|
+
relationName: 'opponent1',
|
|
41
|
+
}),
|
|
42
|
+
opponent2Result: one(exports.participantMatchGameResult, {
|
|
43
|
+
fields: [exports.matchGame.id],
|
|
44
|
+
references: [exports.participantMatchGameResult.opponent2MatchGameId],
|
|
45
|
+
relationName: 'opponent2',
|
|
46
|
+
}),
|
|
47
|
+
}));
|
|
48
|
+
// The results of a participant in a match game.
|
|
49
|
+
exports.participantMatchGameResult = (0, pg_core_1.pgTable)('ParticipantMatchGameResult', {
|
|
50
|
+
id: (0, pg_core_1.text)('id').primaryKey(),
|
|
51
|
+
// If `null`, the participant is to be determined.
|
|
52
|
+
participantId: (0, pg_core_1.text)('participantId').references(() => participant_1.participant.id),
|
|
53
|
+
// Indicates where the participant comes from.
|
|
54
|
+
position: (0, pg_core_1.integer)('position'),
|
|
55
|
+
// If this participant forfeits, the other automatically wins.
|
|
56
|
+
forfeit: (0, pg_core_1.boolean)('forfeit'),
|
|
57
|
+
// The current score of the participant.
|
|
58
|
+
score: (0, pg_core_1.integer)('score'),
|
|
59
|
+
// Tells what is the result of a duel for this participant.
|
|
60
|
+
result: (0, enums_1.matchResultEnum)('result'),
|
|
61
|
+
// Foreign key for opponent1 relation
|
|
62
|
+
opponent1MatchGameId: (0, pg_core_1.text)('opponent1MatchGameId').unique(),
|
|
63
|
+
// Foreign key for opponent2 relation
|
|
64
|
+
opponent2MatchGameId: (0, pg_core_1.text)('opponent2MatchGameId').unique(),
|
|
65
|
+
});
|
|
66
|
+
exports.participantMatchGameResultRelations = (0, drizzle_orm_1.relations)(exports.participantMatchGameResult, ({ one }) => ({
|
|
67
|
+
participant: one(participant_1.participant, {
|
|
68
|
+
fields: [exports.participantMatchGameResult.participantId],
|
|
69
|
+
references: [participant_1.participant.id],
|
|
70
|
+
}),
|
|
71
|
+
opponent1MatchGame: one(exports.matchGame, {
|
|
72
|
+
fields: [exports.participantMatchGameResult.opponent1MatchGameId],
|
|
73
|
+
references: [exports.matchGame.id],
|
|
74
|
+
relationName: 'opponent1',
|
|
75
|
+
}),
|
|
76
|
+
opponent2MatchGame: one(exports.matchGame, {
|
|
77
|
+
fields: [exports.participantMatchGameResult.opponent2MatchGameId],
|
|
78
|
+
references: [exports.matchGame.id],
|
|
79
|
+
relationName: 'opponent2',
|
|
80
|
+
}),
|
|
81
|
+
}));
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
export declare const match: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
+
name: "Match";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "Match";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "PgText";
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
notNull: true;
|
|
13
|
+
hasDefault: false;
|
|
14
|
+
isPrimaryKey: true;
|
|
15
|
+
isAutoincrement: false;
|
|
16
|
+
hasRuntimeDefault: false;
|
|
17
|
+
enumValues: [string, ...string[]];
|
|
18
|
+
baseColumn: never;
|
|
19
|
+
identity: undefined;
|
|
20
|
+
generated: undefined;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
23
|
+
name: "status";
|
|
24
|
+
tableName: "Match";
|
|
25
|
+
dataType: "string";
|
|
26
|
+
columnType: "PgEnumColumn";
|
|
27
|
+
data: "LOCKED" | "WAITING" | "READY" | "RUNNING" | "COMPLETED" | "ARCHIVED";
|
|
28
|
+
driverParam: string;
|
|
29
|
+
notNull: true;
|
|
30
|
+
hasDefault: false;
|
|
31
|
+
isPrimaryKey: false;
|
|
32
|
+
isAutoincrement: false;
|
|
33
|
+
hasRuntimeDefault: false;
|
|
34
|
+
enumValues: ["LOCKED", "WAITING", "READY", "RUNNING", "COMPLETED", "ARCHIVED"];
|
|
35
|
+
baseColumn: never;
|
|
36
|
+
identity: undefined;
|
|
37
|
+
generated: undefined;
|
|
38
|
+
}, {}, {}>;
|
|
39
|
+
stageId: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
|
+
name: "stageId";
|
|
41
|
+
tableName: "Match";
|
|
42
|
+
dataType: "string";
|
|
43
|
+
columnType: "PgText";
|
|
44
|
+
data: string;
|
|
45
|
+
driverParam: string;
|
|
46
|
+
notNull: true;
|
|
47
|
+
hasDefault: false;
|
|
48
|
+
isPrimaryKey: false;
|
|
49
|
+
isAutoincrement: false;
|
|
50
|
+
hasRuntimeDefault: false;
|
|
51
|
+
enumValues: [string, ...string[]];
|
|
52
|
+
baseColumn: never;
|
|
53
|
+
identity: undefined;
|
|
54
|
+
generated: undefined;
|
|
55
|
+
}, {}, {}>;
|
|
56
|
+
groupId: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
+
name: "groupId";
|
|
58
|
+
tableName: "Match";
|
|
59
|
+
dataType: "string";
|
|
60
|
+
columnType: "PgText";
|
|
61
|
+
data: string;
|
|
62
|
+
driverParam: string;
|
|
63
|
+
notNull: true;
|
|
64
|
+
hasDefault: false;
|
|
65
|
+
isPrimaryKey: false;
|
|
66
|
+
isAutoincrement: false;
|
|
67
|
+
hasRuntimeDefault: false;
|
|
68
|
+
enumValues: [string, ...string[]];
|
|
69
|
+
baseColumn: never;
|
|
70
|
+
identity: undefined;
|
|
71
|
+
generated: undefined;
|
|
72
|
+
}, {}, {}>;
|
|
73
|
+
roundId: import("drizzle-orm/pg-core").PgColumn<{
|
|
74
|
+
name: "roundId";
|
|
75
|
+
tableName: "Match";
|
|
76
|
+
dataType: "string";
|
|
77
|
+
columnType: "PgText";
|
|
78
|
+
data: string;
|
|
79
|
+
driverParam: string;
|
|
80
|
+
notNull: true;
|
|
81
|
+
hasDefault: false;
|
|
82
|
+
isPrimaryKey: false;
|
|
83
|
+
isAutoincrement: false;
|
|
84
|
+
hasRuntimeDefault: false;
|
|
85
|
+
enumValues: [string, ...string[]];
|
|
86
|
+
baseColumn: never;
|
|
87
|
+
identity: undefined;
|
|
88
|
+
generated: undefined;
|
|
89
|
+
}, {}, {}>;
|
|
90
|
+
number: import("drizzle-orm/pg-core").PgColumn<{
|
|
91
|
+
name: "number";
|
|
92
|
+
tableName: "Match";
|
|
93
|
+
dataType: "number";
|
|
94
|
+
columnType: "PgInteger";
|
|
95
|
+
data: number;
|
|
96
|
+
driverParam: string | number;
|
|
97
|
+
notNull: true;
|
|
98
|
+
hasDefault: false;
|
|
99
|
+
isPrimaryKey: false;
|
|
100
|
+
isAutoincrement: false;
|
|
101
|
+
hasRuntimeDefault: false;
|
|
102
|
+
enumValues: undefined;
|
|
103
|
+
baseColumn: never;
|
|
104
|
+
identity: undefined;
|
|
105
|
+
generated: undefined;
|
|
106
|
+
}, {}, {}>;
|
|
107
|
+
childCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
108
|
+
name: "childCount";
|
|
109
|
+
tableName: "Match";
|
|
110
|
+
dataType: "number";
|
|
111
|
+
columnType: "PgInteger";
|
|
112
|
+
data: number;
|
|
113
|
+
driverParam: string | number;
|
|
114
|
+
notNull: true;
|
|
115
|
+
hasDefault: false;
|
|
116
|
+
isPrimaryKey: false;
|
|
117
|
+
isAutoincrement: false;
|
|
118
|
+
hasRuntimeDefault: false;
|
|
119
|
+
enumValues: undefined;
|
|
120
|
+
baseColumn: never;
|
|
121
|
+
identity: undefined;
|
|
122
|
+
generated: undefined;
|
|
123
|
+
}, {}, {}>;
|
|
124
|
+
extra: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
|
+
name: "extra";
|
|
126
|
+
tableName: "Match";
|
|
127
|
+
dataType: "json";
|
|
128
|
+
columnType: "PgJsonb";
|
|
129
|
+
data: unknown;
|
|
130
|
+
driverParam: unknown;
|
|
131
|
+
notNull: false;
|
|
132
|
+
hasDefault: false;
|
|
133
|
+
isPrimaryKey: false;
|
|
134
|
+
isAutoincrement: false;
|
|
135
|
+
hasRuntimeDefault: false;
|
|
136
|
+
enumValues: undefined;
|
|
137
|
+
baseColumn: never;
|
|
138
|
+
identity: undefined;
|
|
139
|
+
generated: undefined;
|
|
140
|
+
}, {}, {}>;
|
|
141
|
+
};
|
|
142
|
+
dialect: "pg";
|
|
143
|
+
}>;
|
|
144
|
+
export declare const matchRelations: import("drizzle-orm").Relations<"Match", {
|
|
145
|
+
stage: import("drizzle-orm").One<"Stage", true>;
|
|
146
|
+
group: import("drizzle-orm").One<"Group", true>;
|
|
147
|
+
round: import("drizzle-orm").One<"Round", true>;
|
|
148
|
+
opponent1Result: import("drizzle-orm").One<"ParticipantMatchResult", true>;
|
|
149
|
+
opponent2Result: import("drizzle-orm").One<"ParticipantMatchResult", true>;
|
|
150
|
+
games: import("drizzle-orm").Many<"MatchGame">;
|
|
151
|
+
}>;
|
|
152
|
+
export declare const participantMatchResult: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
153
|
+
name: "ParticipantMatchResult";
|
|
154
|
+
schema: undefined;
|
|
155
|
+
columns: {
|
|
156
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
157
|
+
name: "id";
|
|
158
|
+
tableName: "ParticipantMatchResult";
|
|
159
|
+
dataType: "string";
|
|
160
|
+
columnType: "PgText";
|
|
161
|
+
data: string;
|
|
162
|
+
driverParam: string;
|
|
163
|
+
notNull: true;
|
|
164
|
+
hasDefault: false;
|
|
165
|
+
isPrimaryKey: true;
|
|
166
|
+
isAutoincrement: false;
|
|
167
|
+
hasRuntimeDefault: false;
|
|
168
|
+
enumValues: [string, ...string[]];
|
|
169
|
+
baseColumn: never;
|
|
170
|
+
identity: undefined;
|
|
171
|
+
generated: undefined;
|
|
172
|
+
}, {}, {}>;
|
|
173
|
+
participantId: import("drizzle-orm/pg-core").PgColumn<{
|
|
174
|
+
name: "participantId";
|
|
175
|
+
tableName: "ParticipantMatchResult";
|
|
176
|
+
dataType: "string";
|
|
177
|
+
columnType: "PgText";
|
|
178
|
+
data: string;
|
|
179
|
+
driverParam: string;
|
|
180
|
+
notNull: false;
|
|
181
|
+
hasDefault: false;
|
|
182
|
+
isPrimaryKey: false;
|
|
183
|
+
isAutoincrement: false;
|
|
184
|
+
hasRuntimeDefault: false;
|
|
185
|
+
enumValues: [string, ...string[]];
|
|
186
|
+
baseColumn: never;
|
|
187
|
+
identity: undefined;
|
|
188
|
+
generated: undefined;
|
|
189
|
+
}, {}, {}>;
|
|
190
|
+
position: import("drizzle-orm/pg-core").PgColumn<{
|
|
191
|
+
name: "position";
|
|
192
|
+
tableName: "ParticipantMatchResult";
|
|
193
|
+
dataType: "number";
|
|
194
|
+
columnType: "PgInteger";
|
|
195
|
+
data: number;
|
|
196
|
+
driverParam: string | number;
|
|
197
|
+
notNull: false;
|
|
198
|
+
hasDefault: false;
|
|
199
|
+
isPrimaryKey: false;
|
|
200
|
+
isAutoincrement: false;
|
|
201
|
+
hasRuntimeDefault: false;
|
|
202
|
+
enumValues: undefined;
|
|
203
|
+
baseColumn: never;
|
|
204
|
+
identity: undefined;
|
|
205
|
+
generated: undefined;
|
|
206
|
+
}, {}, {}>;
|
|
207
|
+
forfeit: import("drizzle-orm/pg-core").PgColumn<{
|
|
208
|
+
name: "forfeit";
|
|
209
|
+
tableName: "ParticipantMatchResult";
|
|
210
|
+
dataType: "boolean";
|
|
211
|
+
columnType: "PgBoolean";
|
|
212
|
+
data: boolean;
|
|
213
|
+
driverParam: boolean;
|
|
214
|
+
notNull: false;
|
|
215
|
+
hasDefault: false;
|
|
216
|
+
isPrimaryKey: false;
|
|
217
|
+
isAutoincrement: false;
|
|
218
|
+
hasRuntimeDefault: false;
|
|
219
|
+
enumValues: undefined;
|
|
220
|
+
baseColumn: never;
|
|
221
|
+
identity: undefined;
|
|
222
|
+
generated: undefined;
|
|
223
|
+
}, {}, {}>;
|
|
224
|
+
score: import("drizzle-orm/pg-core").PgColumn<{
|
|
225
|
+
name: "score";
|
|
226
|
+
tableName: "ParticipantMatchResult";
|
|
227
|
+
dataType: "number";
|
|
228
|
+
columnType: "PgInteger";
|
|
229
|
+
data: number;
|
|
230
|
+
driverParam: string | number;
|
|
231
|
+
notNull: false;
|
|
232
|
+
hasDefault: false;
|
|
233
|
+
isPrimaryKey: false;
|
|
234
|
+
isAutoincrement: false;
|
|
235
|
+
hasRuntimeDefault: false;
|
|
236
|
+
enumValues: undefined;
|
|
237
|
+
baseColumn: never;
|
|
238
|
+
identity: undefined;
|
|
239
|
+
generated: undefined;
|
|
240
|
+
}, {}, {}>;
|
|
241
|
+
result: import("drizzle-orm/pg-core").PgColumn<{
|
|
242
|
+
name: "result";
|
|
243
|
+
tableName: "ParticipantMatchResult";
|
|
244
|
+
dataType: "string";
|
|
245
|
+
columnType: "PgEnumColumn";
|
|
246
|
+
data: "WIN" | "DRAW" | "LOSS";
|
|
247
|
+
driverParam: string;
|
|
248
|
+
notNull: false;
|
|
249
|
+
hasDefault: false;
|
|
250
|
+
isPrimaryKey: false;
|
|
251
|
+
isAutoincrement: false;
|
|
252
|
+
hasRuntimeDefault: false;
|
|
253
|
+
enumValues: ["WIN", "DRAW", "LOSS"];
|
|
254
|
+
baseColumn: never;
|
|
255
|
+
identity: undefined;
|
|
256
|
+
generated: undefined;
|
|
257
|
+
}, {}, {}>;
|
|
258
|
+
opponent1MatchId: import("drizzle-orm/pg-core").PgColumn<{
|
|
259
|
+
name: "opponent1MatchId";
|
|
260
|
+
tableName: "ParticipantMatchResult";
|
|
261
|
+
dataType: "string";
|
|
262
|
+
columnType: "PgText";
|
|
263
|
+
data: string;
|
|
264
|
+
driverParam: string;
|
|
265
|
+
notNull: false;
|
|
266
|
+
hasDefault: false;
|
|
267
|
+
isPrimaryKey: false;
|
|
268
|
+
isAutoincrement: false;
|
|
269
|
+
hasRuntimeDefault: false;
|
|
270
|
+
enumValues: [string, ...string[]];
|
|
271
|
+
baseColumn: never;
|
|
272
|
+
identity: undefined;
|
|
273
|
+
generated: undefined;
|
|
274
|
+
}, {}, {}>;
|
|
275
|
+
opponent2MatchId: import("drizzle-orm/pg-core").PgColumn<{
|
|
276
|
+
name: "opponent2MatchId";
|
|
277
|
+
tableName: "ParticipantMatchResult";
|
|
278
|
+
dataType: "string";
|
|
279
|
+
columnType: "PgText";
|
|
280
|
+
data: string;
|
|
281
|
+
driverParam: string;
|
|
282
|
+
notNull: false;
|
|
283
|
+
hasDefault: false;
|
|
284
|
+
isPrimaryKey: false;
|
|
285
|
+
isAutoincrement: false;
|
|
286
|
+
hasRuntimeDefault: false;
|
|
287
|
+
enumValues: [string, ...string[]];
|
|
288
|
+
baseColumn: never;
|
|
289
|
+
identity: undefined;
|
|
290
|
+
generated: undefined;
|
|
291
|
+
}, {}, {}>;
|
|
292
|
+
};
|
|
293
|
+
dialect: "pg";
|
|
294
|
+
}>;
|
|
295
|
+
export declare const participantMatchResultRelations: import("drizzle-orm").Relations<"ParticipantMatchResult", {
|
|
296
|
+
participant: import("drizzle-orm").One<"Participant", false>;
|
|
297
|
+
opponent1Match: import("drizzle-orm").One<"Match", false>;
|
|
298
|
+
opponent2Match: import("drizzle-orm").One<"Match", false>;
|
|
299
|
+
}>;
|
|
300
|
+
export type Match = typeof match.$inferSelect;
|
|
301
|
+
export type NewMatch = typeof match.$inferInsert;
|
|
302
|
+
export type ParticipantMatchResult = typeof participantMatchResult.$inferSelect;
|
|
303
|
+
export type NewParticipantMatchResult = typeof participantMatchResult.$inferInsert;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.participantMatchResultRelations = exports.participantMatchResult = exports.matchRelations = exports.match = void 0;
|
|
4
|
+
const pg_core_1 = require("drizzle-orm/pg-core");
|
|
5
|
+
const drizzle_orm_1 = require("drizzle-orm");
|
|
6
|
+
const enums_1 = require("./enums");
|
|
7
|
+
const stage_1 = require("./stage");
|
|
8
|
+
const group_1 = require("./group");
|
|
9
|
+
const round_1 = require("./round");
|
|
10
|
+
const match_game_1 = require("./match-game");
|
|
11
|
+
const participant_1 = require("./participant");
|
|
12
|
+
// A match in a round.
|
|
13
|
+
exports.match = (0, pg_core_1.pgTable)('Match', {
|
|
14
|
+
id: (0, pg_core_1.text)('id').primaryKey(),
|
|
15
|
+
// Status of the match.
|
|
16
|
+
status: (0, enums_1.matchStatusEnum)('status').notNull(),
|
|
17
|
+
// ID of the parent stage.
|
|
18
|
+
stageId: (0, pg_core_1.text)('stageId')
|
|
19
|
+
.notNull()
|
|
20
|
+
.references(() => stage_1.stage.id),
|
|
21
|
+
// ID of the parent group.
|
|
22
|
+
groupId: (0, pg_core_1.text)('groupId')
|
|
23
|
+
.notNull()
|
|
24
|
+
.references(() => group_1.group.id),
|
|
25
|
+
// ID of the parent round.
|
|
26
|
+
roundId: (0, pg_core_1.text)('roundId')
|
|
27
|
+
.notNull()
|
|
28
|
+
.references(() => round_1.round.id),
|
|
29
|
+
// The number of the match in its round
|
|
30
|
+
number: (0, pg_core_1.integer)('number').notNull(),
|
|
31
|
+
// The count of match games this match has.
|
|
32
|
+
childCount: (0, pg_core_1.integer)('childCount').notNull(),
|
|
33
|
+
// Additional data for the match
|
|
34
|
+
extra: (0, pg_core_1.jsonb)('extra'),
|
|
35
|
+
});
|
|
36
|
+
exports.matchRelations = (0, drizzle_orm_1.relations)(exports.match, ({ one, many }) => ({
|
|
37
|
+
stage: one(stage_1.stage, {
|
|
38
|
+
fields: [exports.match.stageId],
|
|
39
|
+
references: [stage_1.stage.id],
|
|
40
|
+
}),
|
|
41
|
+
group: one(group_1.group, {
|
|
42
|
+
fields: [exports.match.groupId],
|
|
43
|
+
references: [group_1.group.id],
|
|
44
|
+
}),
|
|
45
|
+
round: one(round_1.round, {
|
|
46
|
+
fields: [exports.match.roundId],
|
|
47
|
+
references: [round_1.round.id],
|
|
48
|
+
}),
|
|
49
|
+
opponent1Result: one(exports.participantMatchResult, {
|
|
50
|
+
fields: [exports.match.id],
|
|
51
|
+
references: [exports.participantMatchResult.opponent1MatchId],
|
|
52
|
+
relationName: 'opponent1',
|
|
53
|
+
}),
|
|
54
|
+
opponent2Result: one(exports.participantMatchResult, {
|
|
55
|
+
fields: [exports.match.id],
|
|
56
|
+
references: [exports.participantMatchResult.opponent2MatchId],
|
|
57
|
+
relationName: 'opponent2',
|
|
58
|
+
}),
|
|
59
|
+
games: many(match_game_1.matchGame),
|
|
60
|
+
}));
|
|
61
|
+
// The results of a participant in a match.
|
|
62
|
+
exports.participantMatchResult = (0, pg_core_1.pgTable)('ParticipantMatchResult', {
|
|
63
|
+
id: (0, pg_core_1.text)('id').primaryKey(),
|
|
64
|
+
// If `null`, the participant is to be determined.
|
|
65
|
+
participantId: (0, pg_core_1.text)('participantId').references(() => participant_1.participant.id),
|
|
66
|
+
// Indicates where the participant comes from.
|
|
67
|
+
position: (0, pg_core_1.integer)('position'),
|
|
68
|
+
// If this participant forfeits, the other automatically wins.
|
|
69
|
+
forfeit: (0, pg_core_1.boolean)('forfeit'),
|
|
70
|
+
// The current score of the participant.
|
|
71
|
+
score: (0, pg_core_1.integer)('score'),
|
|
72
|
+
// Tells what is the result of a duel for this participant.
|
|
73
|
+
result: (0, enums_1.matchResultEnum)('result'),
|
|
74
|
+
// Foreign key for opponent1 relation
|
|
75
|
+
opponent1MatchId: (0, pg_core_1.text)('opponent1MatchId').unique(),
|
|
76
|
+
// Foreign key for opponent2 relation
|
|
77
|
+
opponent2MatchId: (0, pg_core_1.text)('opponent2MatchId').unique(),
|
|
78
|
+
});
|
|
79
|
+
exports.participantMatchResultRelations = (0, drizzle_orm_1.relations)(exports.participantMatchResult, ({ one }) => ({
|
|
80
|
+
participant: one(participant_1.participant, {
|
|
81
|
+
fields: [exports.participantMatchResult.participantId],
|
|
82
|
+
references: [participant_1.participant.id],
|
|
83
|
+
}),
|
|
84
|
+
opponent1Match: one(exports.match, {
|
|
85
|
+
fields: [exports.participantMatchResult.opponent1MatchId],
|
|
86
|
+
references: [exports.match.id],
|
|
87
|
+
relationName: 'opponent1',
|
|
88
|
+
}),
|
|
89
|
+
opponent2Match: one(exports.match, {
|
|
90
|
+
fields: [exports.participantMatchResult.opponent2MatchId],
|
|
91
|
+
references: [exports.match.id],
|
|
92
|
+
relationName: 'opponent2',
|
|
93
|
+
}),
|
|
94
|
+
}));
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const participant: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
+
name: "Participant";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "Participant";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "PgText";
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
notNull: true;
|
|
13
|
+
hasDefault: false;
|
|
14
|
+
isPrimaryKey: true;
|
|
15
|
+
isAutoincrement: false;
|
|
16
|
+
hasRuntimeDefault: false;
|
|
17
|
+
enumValues: [string, ...string[]];
|
|
18
|
+
baseColumn: never;
|
|
19
|
+
identity: undefined;
|
|
20
|
+
generated: undefined;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
tournamentId: import("drizzle-orm/pg-core").PgColumn<{
|
|
23
|
+
name: "tournamentId";
|
|
24
|
+
tableName: "Participant";
|
|
25
|
+
dataType: "string";
|
|
26
|
+
columnType: "PgText";
|
|
27
|
+
data: string;
|
|
28
|
+
driverParam: string;
|
|
29
|
+
notNull: true;
|
|
30
|
+
hasDefault: false;
|
|
31
|
+
isPrimaryKey: false;
|
|
32
|
+
isAutoincrement: false;
|
|
33
|
+
hasRuntimeDefault: false;
|
|
34
|
+
enumValues: [string, ...string[]];
|
|
35
|
+
baseColumn: never;
|
|
36
|
+
identity: undefined;
|
|
37
|
+
generated: undefined;
|
|
38
|
+
}, {}, {}>;
|
|
39
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
|
+
name: "name";
|
|
41
|
+
tableName: "Participant";
|
|
42
|
+
dataType: "string";
|
|
43
|
+
columnType: "PgText";
|
|
44
|
+
data: string;
|
|
45
|
+
driverParam: string;
|
|
46
|
+
notNull: true;
|
|
47
|
+
hasDefault: false;
|
|
48
|
+
isPrimaryKey: false;
|
|
49
|
+
isAutoincrement: false;
|
|
50
|
+
hasRuntimeDefault: false;
|
|
51
|
+
enumValues: [string, ...string[]];
|
|
52
|
+
baseColumn: never;
|
|
53
|
+
identity: undefined;
|
|
54
|
+
generated: undefined;
|
|
55
|
+
}, {}, {}>;
|
|
56
|
+
extra: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
+
name: "extra";
|
|
58
|
+
tableName: "Participant";
|
|
59
|
+
dataType: "json";
|
|
60
|
+
columnType: "PgJsonb";
|
|
61
|
+
data: unknown;
|
|
62
|
+
driverParam: unknown;
|
|
63
|
+
notNull: false;
|
|
64
|
+
hasDefault: false;
|
|
65
|
+
isPrimaryKey: false;
|
|
66
|
+
isAutoincrement: false;
|
|
67
|
+
hasRuntimeDefault: false;
|
|
68
|
+
enumValues: undefined;
|
|
69
|
+
baseColumn: never;
|
|
70
|
+
identity: undefined;
|
|
71
|
+
generated: undefined;
|
|
72
|
+
}, {}, {}>;
|
|
73
|
+
};
|
|
74
|
+
dialect: "pg";
|
|
75
|
+
}>;
|
|
76
|
+
export declare const participantRelations: import("drizzle-orm").Relations<"Participant", {
|
|
77
|
+
tournament: import("drizzle-orm").One<"Tournament", true>;
|
|
78
|
+
matchResults: import("drizzle-orm").Many<"ParticipantMatchResult">;
|
|
79
|
+
matchGameResults: import("drizzle-orm").Many<"ParticipantMatchGameResult">;
|
|
80
|
+
}>;
|
|
81
|
+
export type Participant = typeof participant.$inferSelect;
|
|
82
|
+
export type NewParticipant = typeof participant.$inferInsert;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.participantRelations = exports.participant = void 0;
|
|
4
|
+
const pg_core_1 = require("drizzle-orm/pg-core");
|
|
5
|
+
const drizzle_orm_1 = require("drizzle-orm");
|
|
6
|
+
const tournament_1 = require("./tournament");
|
|
7
|
+
const match_1 = require("./match");
|
|
8
|
+
const match_game_1 = require("./match-game");
|
|
9
|
+
// A participant of a stage (team or individual).
|
|
10
|
+
exports.participant = (0, pg_core_1.pgTable)('Participant', {
|
|
11
|
+
id: (0, pg_core_1.text)('id').primaryKey(),
|
|
12
|
+
tournamentId: (0, pg_core_1.text)('tournamentId')
|
|
13
|
+
.notNull()
|
|
14
|
+
.references(() => tournament_1.tournament.id),
|
|
15
|
+
// Name of the participant
|
|
16
|
+
name: (0, pg_core_1.text)('name').notNull(),
|
|
17
|
+
// Additional data for the participant
|
|
18
|
+
extra: (0, pg_core_1.jsonb)('extra'),
|
|
19
|
+
});
|
|
20
|
+
exports.participantRelations = (0, drizzle_orm_1.relations)(exports.participant, ({ one, many }) => ({
|
|
21
|
+
tournament: one(tournament_1.tournament, {
|
|
22
|
+
fields: [exports.participant.tournamentId],
|
|
23
|
+
references: [tournament_1.tournament.id],
|
|
24
|
+
}),
|
|
25
|
+
matchResults: many(match_1.participantMatchResult),
|
|
26
|
+
matchGameResults: many(match_game_1.participantMatchGameResult),
|
|
27
|
+
}));
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const round: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
+
name: "Round";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "Round";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "PgText";
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
notNull: true;
|
|
13
|
+
hasDefault: false;
|
|
14
|
+
isPrimaryKey: true;
|
|
15
|
+
isAutoincrement: false;
|
|
16
|
+
hasRuntimeDefault: false;
|
|
17
|
+
enumValues: [string, ...string[]];
|
|
18
|
+
baseColumn: never;
|
|
19
|
+
identity: undefined;
|
|
20
|
+
generated: undefined;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
stageId: import("drizzle-orm/pg-core").PgColumn<{
|
|
23
|
+
name: "stageId";
|
|
24
|
+
tableName: "Round";
|
|
25
|
+
dataType: "string";
|
|
26
|
+
columnType: "PgText";
|
|
27
|
+
data: string;
|
|
28
|
+
driverParam: string;
|
|
29
|
+
notNull: true;
|
|
30
|
+
hasDefault: false;
|
|
31
|
+
isPrimaryKey: false;
|
|
32
|
+
isAutoincrement: false;
|
|
33
|
+
hasRuntimeDefault: false;
|
|
34
|
+
enumValues: [string, ...string[]];
|
|
35
|
+
baseColumn: never;
|
|
36
|
+
identity: undefined;
|
|
37
|
+
generated: undefined;
|
|
38
|
+
}, {}, {}>;
|
|
39
|
+
groupId: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
|
+
name: "groupId";
|
|
41
|
+
tableName: "Round";
|
|
42
|
+
dataType: "string";
|
|
43
|
+
columnType: "PgText";
|
|
44
|
+
data: string;
|
|
45
|
+
driverParam: string;
|
|
46
|
+
notNull: true;
|
|
47
|
+
hasDefault: false;
|
|
48
|
+
isPrimaryKey: false;
|
|
49
|
+
isAutoincrement: false;
|
|
50
|
+
hasRuntimeDefault: false;
|
|
51
|
+
enumValues: [string, ...string[]];
|
|
52
|
+
baseColumn: never;
|
|
53
|
+
identity: undefined;
|
|
54
|
+
generated: undefined;
|
|
55
|
+
}, {}, {}>;
|
|
56
|
+
number: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
+
name: "number";
|
|
58
|
+
tableName: "Round";
|
|
59
|
+
dataType: "number";
|
|
60
|
+
columnType: "PgInteger";
|
|
61
|
+
data: number;
|
|
62
|
+
driverParam: string | number;
|
|
63
|
+
notNull: true;
|
|
64
|
+
hasDefault: false;
|
|
65
|
+
isPrimaryKey: false;
|
|
66
|
+
isAutoincrement: false;
|
|
67
|
+
hasRuntimeDefault: false;
|
|
68
|
+
enumValues: undefined;
|
|
69
|
+
baseColumn: never;
|
|
70
|
+
identity: undefined;
|
|
71
|
+
generated: undefined;
|
|
72
|
+
}, {}, {}>;
|
|
73
|
+
};
|
|
74
|
+
dialect: "pg";
|
|
75
|
+
}>;
|
|
76
|
+
export declare const roundRelations: import("drizzle-orm").Relations<"Round", {
|
|
77
|
+
stage: import("drizzle-orm").One<"Stage", true>;
|
|
78
|
+
group: import("drizzle-orm").One<"Group", true>;
|
|
79
|
+
matches: import("drizzle-orm").Many<"Match">;
|
|
80
|
+
}>;
|
|
81
|
+
export type Round = typeof round.$inferSelect;
|
|
82
|
+
export type NewRound = typeof round.$inferInsert;
|