aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/api/v1/repo/branches.ts
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-07-06 15:37:35 +0200
committerHampusM <hampus@hampusmat.com>2021-07-06 15:37:35 +0200
commit7b48039aa475b8c0b52b019f10fad66c7842d08b (patch)
treec3b0c1666ce74f0fb0b0f43a924a476b6164934a /packages/server/src/api/v1/repo/branches.ts
parent10f0154f1f46881123ef3418beb0eced48bfb4b9 (diff)
API uses shared types
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
});
}
});