Migrace serveru na OpenAPI
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import express, { Request, Response } from "express";
|
||||
import express, { Request } from "express";
|
||||
import { getLogin } from "../auth";
|
||||
import { parseToken } from "../utils";
|
||||
import { getUserVotes, updateFeatureVote } from "../voting";
|
||||
import { FeatureRequest, UpdateFeatureVoteRequest } from "../../../types";
|
||||
import { GetVotesData, UpdateVoteData } from "../../../types";
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
router.get("/getVotes", async (req: Request<{}, any, undefined>, res: Response<FeatureRequest[]>) => {
|
||||
router.get("/getVotes", async (req: Request<{}, any, GetVotesData["body"]>, res) => {
|
||||
const login = getLogin(parseToken(req));
|
||||
const data = await getUserVotes(login);
|
||||
res.status(200).json(data);
|
||||
});
|
||||
|
||||
router.post("/updateVote", async (req: Request<{}, any, UpdateFeatureVoteRequest>, res, next) => {
|
||||
router.post("/updateVote", async (req: Request<{}, any, UpdateVoteData["body"]>, res, next) => {
|
||||
const login = getLogin(parseToken(req));
|
||||
if (req.body?.option == null || req.body?.active == null) {
|
||||
res.status(400).json({ error: "Chybné parametry volání" });
|
||||
|
||||
Reference in New Issue
Block a user