From 9736749a779661a95211a91200617a03a1b9a702 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 15 Aug 2021 15:03:44 +0200 Subject: Added a count query parameter to the log API endpoint --- packages/server/src/routes/api/v1/repo/log.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages/server/src/routes/api/v1/repo') diff --git a/packages/server/src/routes/api/v1/repo/log.ts b/packages/server/src/routes/api/v1/repo/log.ts index aaad042..edca0b3 100644 --- a/packages/server/src/routes/api/v1/repo/log.ts +++ b/packages/server/src/routes/api/v1/repo/log.ts @@ -21,8 +21,13 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do fastify.route({ method: "GET", url: "/log", + schema: { + querystring: { + count: { type: "number" } + } + }, handler: async(req, reply) => { - const commits = await req.repository.commits(); + const commits = await req.repository.commits(Number(req.query.count)); reply.send({ data: await Promise.all(commits.map(commitMap)) -- cgit v1.2.3-18-g5258