Skip to content

Commit c7c4485

Browse files
committed
chore: refactor cfg
1 parent 9e9e12f commit c7c4485

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
truncate table match_type_cfgs;

src/matches/matches.controller.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export class MatchesController {
197197
const match = matches_by_pk as typeof matches_by_pk & {
198198
is_lan: boolean;
199199
options: typeof matches_by_pk.options & {
200-
cfg_override: string;
200+
cfg_overrides: Record<string, string>;
201201
};
202202
lineup_1: typeof matches_by_pk.lineup_1 & {
203203
tag: string;
@@ -231,18 +231,26 @@ export class MatchesController {
231231
__args: {
232232
where: {
233233
type: {
234-
_in: ["Base", "Live", match.options.type],
234+
_in: ["Lan", match.options.type],
235235
},
236236
},
237237
},
238238
cfg: true,
239+
type: true,
239240
},
240241
});
241242

242243
if (match_type_cfgs) {
243-
match.options.cfg_override = match_type_cfgs
244-
.map((cfg) => cfg.cfg)
245-
.join("\n");
244+
match.options.cfg_overrides = {
245+
Lan: "",
246+
Competitive: "",
247+
Duel: "",
248+
Wingman: "",
249+
};
250+
251+
for (const cfg of match_type_cfgs) {
252+
match.options.cfg_overrides[cfg.type] = cfg.cfg;
253+
}
246254
}
247255

248256
match.lineup_1.tag = match.lineup_1.team?.short_name;

0 commit comments

Comments
 (0)