Commit 06460df1 authored by Ivanq's avatar Ivanq

Repo: Implement addIssue()

parent ced8885d
......@@ -3,6 +3,8 @@ class Repository {
this.address = address;
this.zeroPage = zeroPage;
this.zeroFS = new ZeroFS(zeroPage);
this.zeroAuth = new ZeroAuth(zeroPage);
this.zeroDB = new ZeroDB(zeroPage);
this.git = new Git("merged-GitCenter/" + address + "/repo.git", zeroPage);
}
......@@ -124,4 +126,29 @@ class Repository {
.map(ref => ref.replace("refs/heads/", ""));
});
}
// Issues
addIssue(title, content) {
return this.zeroAuth.requestAuth()
.then(auth => {
return this.zeroDB.insertRow(
"merged-GitCenter/" + this.address + "/data/users/" + auth.address + "/data.json",
"merged-GitCenter/" + this.address + "/data/users/" + auth.address + "/content.json",
"issues",
{
title: title,
body: content,
date_added: Date.now(),
open: 1
},
{
source: "next_issue_id",
column: "id"
}
);
})
.then(row => {
return row.id;
});
}
};
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment