aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/api/v1/repo/branches.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src/api/v1/repo/branches.ts')
-rw-r--r--packages/server/src/api/v1/repo/branches.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/server/src/api/v1/repo/branches.ts b/packages/server/src/api/v1/repo/branches.ts
index fe962aa..b280a4a 100644
--- a/packages/server/src/api/v1/repo/branches.ts
+++ b/packages/server/src/api/v1/repo/branches.ts
@@ -1,6 +1,7 @@
import { FastifyInstance, FastifyPluginOptions } from "fastify";
import { Branch } from "../../../git/branch";
import { Route } from "../../../fastify_types";
+import { BranchSummary as APIBranchSummary, Branch as APIBranch } from "shared_types";
export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, done: (err?: Error) => void): void {
fastify.route<Route>({
@@ -11,7 +12,7 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do
reply.send({
data: branches.map(branch => {
- return {
+ return <APIBranchSummary>{
id: branch.id,
name: branch.name
};
@@ -31,12 +32,14 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do
return;
}
+ const data: APIBranch = {
+ id: branch.id,
+ name: branch.name,
+ latest_commit: await branch.latestCommit()
+ };
+
reply.send({
- data: {
- id: branch.id,
- name: branch.name,
- latest_commit: await branch.latestCommit()
- }
+ data: data
});
}
});