From f2d55a9f05f5df7960d7f6dd37d1ef96c762d65a Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 8 Aug 2021 15:33:22 +0200 Subject: Added a tree commit history API endpoint --- packages/server/src/routes/api/v1/repo/log.ts | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'packages/server/src/routes/api/v1/repo/log.ts') diff --git a/packages/server/src/routes/api/v1/repo/log.ts b/packages/server/src/routes/api/v1/repo/log.ts index 76706b3..b2eea42 100644 --- a/packages/server/src/routes/api/v1/repo/log.ts +++ b/packages/server/src/routes/api/v1/repo/log.ts @@ -3,23 +3,8 @@ import { Commit } from "../../../../git/commit"; import { Patch } from "../../../../git/patch"; import { Route } from "../../../../types/fastify"; import { verifySHA } from "../../util"; -import { LogCommit as APILogCommit, Patch as APIPatch, Commit as APICommit } from "api"; - -async function commitMap(commit: Commit) { - const stats = await commit.stats(); - return { - id: commit.id, - author: { - name: commit.author.name, - email: commit.author.email - }, - message: commit.message, - date: commit.date, - insertions: stats.insertions, - deletions: stats.deletions, - files_changed: stats.files_changed - }; -} +import { Patch as APIPatch, Commit as APICommit } from "api"; +import { commitMap } from "./map"; async function patchMap(patch: Patch) { return { @@ -78,4 +63,4 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do }); done(); -} \ No newline at end of file +} -- cgit v1.2.3-18-g5258