diff options
| author | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-05-01 00:20:33 +0200 |
|---|---|---|
| committer | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-05-01 00:20:33 +0200 |
| commit | c813dfadd4b673080695ef3ade37a44e37036c07 (patch) | |
| tree | 4d6348ecad8c65780323ccb823063f335c5c9e7f /backend/ts/api/won.ts | |
| parent | 040d5372c1033bb7c0580ad2c9b6b32f974a20c8 (diff) | |
| download | fia-c813dfadd4b673080695ef3ade37a44e37036c07.tar.gz fia-c813dfadd4b673080695ef3ade37a44e37036c07.tar.zst fia-c813dfadd4b673080695ef3ade37a44e37036c07.zip | |
Version 1.1
Diffstat (limited to 'backend/ts/api/won.ts')
| -rw-r--r-- | backend/ts/api/won.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/backend/ts/api/won.ts b/backend/ts/api/won.ts new file mode 100644 index 0000000..1e8287c --- /dev/null +++ b/backend/ts/api/won.ts @@ -0,0 +1,14 @@ +import { Request, Response } from "express"; +import { API_RES, makeQuery } from "../../../helpers/helpersBack"; + +export default async function won(req: Request, res: Response) { + if (req.session === undefined || req.session.gid === undefined || req.session.index === undefined) { + console.log(JSON.stringify(req)); + res.status(400); + res.send(API_RES.failure); + return; + } + await makeQuery("UPDATE `fia` SET `winner` = ? WHERE `id` = ?", [req.session.index, req.session.gid]); + + res.send(API_RES.success); +}
\ No newline at end of file |
