add score-scout stubs

This commit is contained in:
anvar 2023-12-09 11:26:08 +03:00
parent 2cfc6956aa
commit cc0acd6814
5 changed files with 593 additions and 0 deletions

View File

@ -0,0 +1,69 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const express = require("express");
const router = express.Router();
router.use(express.json());
module.exports = router;
let tournamentsActiveActivated = true;
let tournamentsArchivedActivated = true;
let tournamentActivated = true;
router.get("/tournaments/active", (req, res) => {
if (tournamentsActiveActivated) {
res.status(200).send(require("./tournaments_active.json"));
} else {
res.status(500).send();
}
});
router.get("/tournaments/active/toggle", (req, res) => {
tournamentsActiveActivated = !tournamentsActiveActivated;
res.send(tournamentsActiveActivated ? "Activated" : "Deactivated");
});
router.get("/tournaments/archived", (req, res) => {
if (tournamentsArchivedActivated) {
res.status(200).send(require("./tournaments_archived.json"));
} else {
res.status(500).send();
}
});
router.get("/tournaments/archived/toggle", (req, res) => {
tournamentsArchivedActivated = !tournamentsArchivedActivated;
res.send(tournamentsArchivedActivated ? "Activated" : "Deactivated");
});
router.get("/tournaments/:id", (req, res) => {
id = req.params.id;
if (tournamentActivated) {
if (id === "2") {
res.status(200).send(require("./tournament-empty.json"));
} else {
res.status(200).send(require("./tournament.json"));
}
} else {
res.status(500).send();
}
});
router.get("/tournaments/:id/toggle", (req, res) => {
tournamentActivated = !tournamentActivated;
res.send(tournamentActivated ? "Activated" : "Deactivated");
});
router.post("/tournaments/:id", (req, res) => {
const data = req.body;
if (data === undefined) {
return res.status(400).send("Bad Request: No data provided");
}
try {
res.status(200).send("Data successfully written to file");
} catch (error) {
res.status(500).send("Internal Server Error");
}
});

View File

@ -0,0 +1,109 @@
{
"title": "Fall Students Tournament",
"amountGamesPlayed": 90,
"date": "2020-11-30",
"isFinished": false,
"isRatingSystem": false,
"players": [
{ "name": "Kailee Escamilla" },
{ "name": "Chiara Shultz" },
{ "name": "Jensen Hillman" },
{ "name": "Marques Cotter" },
{ "name": "Dequan Harms" },
{ "name": "Alexcia Gaston" },
{ "name": "Bruno Smalley" },
{ "name": "Dorian Fenton" },
{ "name": "Brian Thorpe" },
{ "name": "Laura Raymond" },
{ "name": "Ireland Acuna" },
{ "name": "Mallory Whitaker" },
{ "name": "Cinthia Garibay" },
{ "name": "Teresa Tong" },
{ "name": "Santana Custer" },
{ "name": "Shemar Sander" }
],
"firstStage": {
"type": "bracket",
"players": [
{
"name": "Kailee Escamilla",
"id": 0
},
{
"name": "Chiara Shultz",
"id": 1
},
{
"name": "Jensen Hillman",
"id": 2
},
{
"name": "Marques Cotter",
"id": 3
},
{
"name": "Dequan Harms",
"id": 4
},
{
"name": "Alexcia Gaston",
"id": 5
},
{
"name": "Bruno Smalley",
"id": 6
},
{
"name": "Dorian Fenton",
"id": 7
},
{
"name": "Brian Thorpe",
"id": 8
},
{
"name": "Laura Raymond",
"id": 9
},
{
"name": "Ireland Acuna",
"id": 10
},
{
"name": "Mallory Whitaker",
"id": 11
},
{
"name": "Cinthia Garibay",
"id": 12
},
{
"name": "Teresa Tong",
"id": 13
},
{
"name": "Santana Custer",
"id": 14
},
{
"name": "Shemar Sander",
"id": 15
}
],
"stages": [
{
"matchIds": [0, 1, 2, 3, 4, 5, 6, 7]
},
{
"matchIds": [8, 9, 10, 11]
},
{
"matchIds": [12, 13]
},
{
"matchIds": [14]
}
],
"matches": []
}
}

View File

@ -0,0 +1,335 @@
{
"title": "Fall Students Tournament",
"amountGamesPlayed": 90,
"date": "2020-11-30",
"isFinished": false,
"isRatingSystem": false,
"players": [
{ "name": "Kailee Escamilla" },
{ "name": "Chiara Shultz" },
{ "name": "Jensen Hillman" },
{ "name": "Marques Cotter" },
{ "name": "Dequan Harms" },
{ "name": "Alexcia Gaston" },
{ "name": "Bruno Smalley" },
{ "name": "Dorian Fenton" },
{ "name": "Brian Thorpe" },
{ "name": "Laura Raymond" },
{ "name": "Ireland Acuna" },
{ "name": "Mallory Whitaker" },
{ "name": "Cinthia Garibay" },
{ "name": "Teresa Tong" },
{ "name": "Santana Custer" },
{ "name": "Shemar Sander" }
],
"firstStage": {
"type": "bracket",
"players": [
{
"name": "Kailee Escamilla",
"id": 0
},
{
"name": "Chiara Shultz",
"id": 1
},
{
"name": "Jensen Hillman",
"id": 2
},
{
"name": "Marques Cotter",
"id": 3
},
{
"name": "Dequan Harms",
"id": 4
},
{
"name": "Alexcia Gaston",
"id": 5
},
{
"name": "Bruno Smalley",
"id": 6
},
{
"name": "Dorian Fenton",
"id": 7
},
{
"name": "Brian Thorpe",
"id": 8
},
{
"name": "Laura Raymond",
"id": 9
},
{
"name": "Ireland Acuna",
"id": 10
},
{
"name": "Mallory Whitaker",
"id": 11
},
{
"name": "Cinthia Garibay",
"id": 12
},
{
"name": "Teresa Tong",
"id": 13
},
{
"name": "Santana Custer",
"id": 14
},
{
"name": "Shemar Sander",
"id": 15
}
],
"stages": [
{
"matchIds": [0, 1, 2, 3, 4, 5, 6, 7]
},
{
"matchIds": [8, 9, 10, 11]
},
{
"matchIds": [12, 13]
},
{
"matchIds": [14]
}
],
"matches": [
{
"type": "withScore",
"firstPlayer": {
"name": "Kailee Escamilla",
"id": 0
},
"secondPlayer": {
"name": "Shemar Sander",
"id": 15
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 2,
"secondPlayerScore": 0
},
{
"type": "withScore",
"firstPlayer": {
"name": "Dorian Fenton",
"id": 7
},
"secondPlayer": {
"name": "Brian Thorpe",
"id": 8
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 0,
"secondPlayerScore": 2
},
{
"type": "withScore",
"firstPlayer": {
"name": "Marques Cotter",
"id": 3
},
"secondPlayer": {
"name": "Cinthia Garibay",
"id": 12
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 0,
"secondPlayerScore": 3
},
{
"type": "withScore",
"firstPlayer": {
"name": "Dequan Harms",
"id": 4
},
"secondPlayer": {
"name": "Mallory Whitaker",
"id": 11
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 3,
"secondPlayerScore": 0
},
{
"type": "withScore",
"firstPlayer": {
"name": "Chiara Shultz",
"id": 1
},
"secondPlayer": {
"name": "Santana Custer",
"id": 14
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 0,
"secondPlayerScore": 2
},
{
"type": "withScore",
"firstPlayer": {
"name": "Bruno Smalley",
"id": 6
},
"secondPlayer": {
"name": "Laura Raymond",
"id": 9
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 2,
"secondPlayerScore": 0
},
{
"type": "withScore",
"firstPlayer": {
"name": "Jensen Hillman",
"id": 2
},
"secondPlayer": {
"name": "Teresa Tong",
"id": 13
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 1,
"secondPlayerScore": 2
},
{
"type": "withScore",
"firstPlayer": {
"name": "Alexcia Gaston",
"id": 5
},
"secondPlayer": {
"name": "Ireland Acuna",
"id": 10
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 2,
"secondPlayerScore": 1
},
{
"type": "withScore",
"firstPlayer": {
"name": "Kailee Escamilla",
"id": 0
},
"secondPlayer": {
"name": "Brian Thorpe",
"id": 8
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 0,
"secondPlayerScore": 3
},
{
"type": "withScore",
"firstPlayer": {
"name": "Cinthia Garibay",
"id": 12
},
"secondPlayer": {
"name": "Dequan Harms",
"id": 4
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 3,
"secondPlayerScore": 0
},
{
"type": "withScore",
"firstPlayer": {
"name": "Santana Custer",
"id": 14
},
"secondPlayer": {
"name": "Bruno Smalley",
"id": 6
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 3,
"secondPlayerScore": 1
},
{
"type": "withScore",
"firstPlayer": {
"name": "Teresa Tong",
"id": 13
},
"secondPlayer": {
"name": "Alexcia Gaston",
"id": 5
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 3,
"secondPlayerScore": 0
},
{
"type": "withScore",
"firstPlayer": {
"name": "Brian Thorpe",
"id": 8
},
"secondPlayer": {
"name": "Cinthia Garibay",
"id": 12
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 3,
"secondPlayerScore": 2
},
{
"type": "withScore",
"firstPlayer": {
"name": "Santana Custer",
"id": 14
},
"secondPlayer": {
"name": "Teresa Tong",
"id": 13
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 1,
"secondPlayerScore": 3
},
{
"type": "withScore",
"firstPlayer": {
"name": "Brian Thorpe",
"id": 8
},
"secondPlayer": {
"name": "Teresa Tong",
"id": 13
},
"isFinished": true,
"isStarted": true,
"firstPlayerScore": 3,
"secondPlayerScore": 0
}
]
}
}

View File

@ -0,0 +1,19 @@
{
"ok": true,
"data": [
{
"title": "Fall Students Tournament",
"amountPlayers": 32,
"amountGamesPlayed": 124,
"status": "In Progress",
"date": "2023-10-22"
},
{
"title": "Fall Students Tournament",
"amountPlayers": 32,
"amountGamesPlayed": 124,
"status": "In Progress",
"date": "2023-10-22"
}
]
}

View File

@ -0,0 +1,61 @@
{
"ok": true,
"data": [
{
"title": "1st Archived Tournament",
"amountPlayers": 9999,
"amountGamesPlayed": 80,
"status": "Finished",
"date": "2005-12-04"
},
{
"title": "2nd Archived Tournament",
"amountPlayers": 10,
"amountGamesPlayed": 80,
"status": "Finished",
"date": "2005-12-04"
},
{
"title": "3rd Archived Tournament",
"amountPlayers": 4,
"amountGamesPlayed": 6,
"status": "Finished",
"date": "2023-11-11"
},
{
"title": "4th Archived Tournament",
"amountPlayers": 4,
"amountGamesPlayed": 6,
"status": "Finished",
"date": "2023-11-11"
},
{
"title": "5th Archived Tournament",
"amountPlayers": 4,
"amountGamesPlayed": 6,
"status": "Finished",
"date": "2023-11-11"
},
{
"title": "6th Archived Tournament",
"amountPlayers": 4,
"amountGamesPlayed": 6,
"status": "Finished",
"date": "2023-11-11"
},
{
"title": "7th Archived Tournament",
"amountPlayers": 4,
"amountGamesPlayed": 6,
"status": "Finished",
"date": "2023-11-11"
},
{
"title": "8th Archived Tournament",
"amountPlayers": 4,
"amountGamesPlayed": 6,
"status": "Finished",
"date": "2023-11-11"
}
]
}