aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/routes/api/v1/repo/map.ts
diff options
context:
space:
mode:
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
+ };
+}