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/map.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 packages/server/src/routes/api/v1/repo/map.ts (limited to 'packages/server/src/routes/api/v1/repo/map.ts') diff --git a/packages/server/src/routes/api/v1/repo/map.ts b/packages/server/src/routes/api/v1/repo/map.ts new file mode 100644 index 0000000..520161e --- /dev/null +++ b/packages/server/src/routes/api/v1/repo/map.ts @@ -0,0 +1,18 @@ +import { Commit } from "../../../../git/commit"; +import { LogCommit } from "api"; + +export async function commitMap(commit: Commit): Promise { + 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 + }; +} -- cgit v1.2.3-18-g5258