fix: update match configuration to bestOf 5 and scoringType to score_v2
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { a as cancelMatch, g as getMatchFull } from "../../../../../chunks/engine.js";
|
||||
const GET = async ({ params, locals }) => {
|
||||
if (!locals.user) error(401, "Not logged in");
|
||||
try {
|
||||
const m = await getMatchFull(params.id);
|
||||
return json(m);
|
||||
} catch (e) {
|
||||
error(404, e.message);
|
||||
}
|
||||
};
|
||||
const DELETE = async ({ params, locals }) => {
|
||||
if (!locals.user) error(401, "Not logged in");
|
||||
try {
|
||||
const m = await cancelMatch(params.id);
|
||||
return json(m);
|
||||
} catch (e) {
|
||||
error(400, e.message);
|
||||
}
|
||||
};
|
||||
export {
|
||||
DELETE,
|
||||
GET
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { m as moveToLobby } from "../../../../../../chunks/engine.js";
|
||||
const POST = async ({ params, request, locals }) => {
|
||||
if (!locals.user) error(401, "Not logged in");
|
||||
const body = await request.json().catch(() => ({}));
|
||||
try {
|
||||
const m = await moveToLobby(params.id, body.osuLobbyId);
|
||||
return json(m);
|
||||
} catch (e) {
|
||||
error(400, e.message);
|
||||
}
|
||||
};
|
||||
export {
|
||||
POST
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { p as pickMap } from "../../../../../../chunks/engine.js";
|
||||
const POST = async ({ params, request, locals }) => {
|
||||
if (!locals.user) error(401, "Not logged in");
|
||||
const { participantId, mappoolSlotId } = await request.json();
|
||||
if (!participantId || !mappoolSlotId) {
|
||||
error(400, "participantId and mappoolSlotId required");
|
||||
}
|
||||
try {
|
||||
const game = await pickMap(params.id, participantId, mappoolSlotId);
|
||||
return json(game);
|
||||
} catch (e) {
|
||||
error(400, e.message);
|
||||
}
|
||||
};
|
||||
export {
|
||||
POST
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { s as submitRoll } from "../../../../../../chunks/engine.js";
|
||||
const POST = async ({ params, request, locals }) => {
|
||||
if (!locals.user) error(401, "Not logged in");
|
||||
const { participantId, value } = await request.json();
|
||||
if (!participantId || value == null) {
|
||||
error(400, "participantId and value required");
|
||||
}
|
||||
try {
|
||||
const m = await submitRoll(params.id, participantId, value);
|
||||
return json(m);
|
||||
} catch (e) {
|
||||
error(400, e.message);
|
||||
}
|
||||
};
|
||||
export {
|
||||
POST
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { b as moveToRolling } from "../../../../../../chunks/engine.js";
|
||||
const POST = async ({ params, locals }) => {
|
||||
if (!locals.user) error(401, "Not logged in");
|
||||
try {
|
||||
const m = await moveToRolling(params.id);
|
||||
return json(m);
|
||||
} catch (e) {
|
||||
error(400, e.message);
|
||||
}
|
||||
};
|
||||
export {
|
||||
POST
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { d as submitGameScores } from "../../../../../../chunks/engine.js";
|
||||
const POST = async ({ request, locals }) => {
|
||||
if (!locals.user) error(401, "Not logged in");
|
||||
const { matchGameId, scores } = await request.json();
|
||||
if (!matchGameId || !scores?.length) {
|
||||
error(400, "matchGameId and scores required");
|
||||
}
|
||||
try {
|
||||
const m = await submitGameScores(matchGameId, scores);
|
||||
return json(m);
|
||||
} catch (e) {
|
||||
error(400, e.message);
|
||||
}
|
||||
};
|
||||
export {
|
||||
POST
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { d as db } from "../../../../chunks/index2.js";
|
||||
import { c as createMatch } from "../../../../chunks/engine.js";
|
||||
const GET = async ({ locals }) => {
|
||||
if (!locals.user) error(401, "Not logged in");
|
||||
const matches = await db.query.match.findMany({
|
||||
with: {
|
||||
participants: { with: { team: true } }
|
||||
},
|
||||
orderBy: (m, { desc }) => [desc(m.createdAt)]
|
||||
});
|
||||
return json(matches);
|
||||
};
|
||||
const POST = async ({ request, locals }) => {
|
||||
if (!locals.user) error(401, "Not logged in");
|
||||
const body = await request.json();
|
||||
const { name, config, mappoolId, teams } = body;
|
||||
if (!name || !config || !mappoolId || !teams?.length) {
|
||||
error(400, "Missing required fields");
|
||||
}
|
||||
try {
|
||||
const result = await createMatch({
|
||||
name,
|
||||
config,
|
||||
mappoolId,
|
||||
teams,
|
||||
createdBy: locals.user.id
|
||||
});
|
||||
return json(result, { status: 201 });
|
||||
} catch (e) {
|
||||
error(400, e.message);
|
||||
}
|
||||
};
|
||||
export {
|
||||
GET,
|
||||
POST
|
||||
};
|
||||
Reference in New Issue
Block a user