aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-08-08 22:40:54 +0200
committerHampusM <hampus@hampusmat.com>2021-08-08 22:40:54 +0200
commite5f987513a3a19c536acd6b4e80e4c0dbbfd87d6 (patch)
tree5f334a9edd872df4e1790b3165f75f4c3cf06b58
parentf2d55a9f05f5df7960d7f6dd37d1ef96c762d65a (diff)
Added a count query param for the tree history API endpoint
-rw-r--r--docs_src/API/v1/repos.md11
-rw-r--r--packages/server/src/routes/api/v1/repo/index.ts2
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:**<br>
-| 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:**<br>
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)) });
}