aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/routes/api/v1/repo/map.ts
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-08-08 15:33:22 +0200
committerHampusM <hampus@hampusmat.com>2021-08-08 15:33:22 +0200
commitf2d55a9f05f5df7960d7f6dd37d1ef96c762d65a (patch)
tree737a61da8603520f9afec553791a222f88bc4ff3 /packages/server/src/routes/api/v1/repo/map.ts
parent17c20d77600407209908de5541415f2c4a85f5e3 (diff)
Added a tree commit history API endpoint
Diffstat (limited to 'packages/server/src/routes/api/v1/repo/map.ts')
-rw-r--r--packages/server/src/routes/api/v1/repo/map.ts18
1 files changed, 18 insertions, 0 deletions
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<LogCommit> {
+ const stats = await commit.stats();
+ return <LogCommit>{
+ 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
+ };
+}