From e5f987513a3a19c536acd6b4e80e4c0dbbfd87d6 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 8 Aug 2021 22:40:54 +0200 Subject: Added a count query param for the tree history API endpoint --- docs_src/API/v1/repos.md | 11 ++++++----- packages/server/src/routes/api/v1/repo/index.ts | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs_src/API/v1/repos.md b/docs_src/API/v1/repos.md index e5c24b9..f7bb5ef 100644 --- a/docs_src/API/v1/repos.md +++ b/docs_src/API/v1/repos.md @@ -68,11 +68,12 @@ Retrieves a tree entry's commit history. **Parameters:**
-| Name | Location | Description | Required | Schema | -|--------|----------|------------------|----------|--------| -| repo | path | The repository | true | string | -| path | query | Path in the tree | true | string | -| branch | query | A branch | false | string | +| Name | Location | Description | Required | Schema | +|--------|----------|-------------------|----------|--------| +| repo | path | The repository | true | string | +| path | query | Path in the tree | true | string | +| branch | query | A branch | false | string | +| count | query | Number of commits | false | number | **Response:**
diff --git a/packages/server/src/routes/api/v1/repo/index.ts b/packages/server/src/routes/api/v1/repo/index.ts index 3b115d4..2221171 100644 --- a/packages/server/src/routes/api/v1/repo/index.ts +++ b/packages/server/src/routes/api/v1/repo/index.ts @@ -125,7 +125,7 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do return; } - const history = await tree_entry.history(); + const history = await tree_entry.history(Number(req.query.count)); reply.send({ data: await Promise.all(history.map(commitMap)) }); } -- cgit v1.2.3-18-g5258