File size: 997 Bytes
3d23b0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { FastifyRequest, FastifyReply } from 'fastify';
import * as service from '../services';
import type { ContestRankingQuery } from '../types';

export async function getContestRankingHandler(
    request: FastifyRequest<{ Querystring: ContestRankingQuery }>,
    reply: FastifyReply
) {
    const { username } = request.query;
    const data = await service.getContestRankingInfo(username);
    return reply.send(data);
}

export async function getContestHistogramHandler(
    request: FastifyRequest,
    reply: FastifyReply
) {
    const data = await service.getContestHistogram();
    return reply.send(data);
}

export async function getAllContestsHandler(
    request: FastifyRequest,
    reply: FastifyReply
) {
    const data = await service.getAllContests();
    return reply.send(data);
}

export async function getUpcomingContestsHandler(
    request: FastifyRequest,
    reply: FastifyReply
) {
    const data = await service.getUpcomingContests();
    return reply.send(data);
}