Skip to content

Commit

Permalink
address my own review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TShapinsky committed Dec 13, 2023
1 parent d993358 commit 8443025
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion alfalfa_web/server/api-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ router.post("/runs/:runId/points", async (req, res, next) => {
*/
router.get("/runs/:runId/points/values", (req, res, next) => {
api
.getPointsByRun(req.run)
.getPointsByType(req.run, ["OUTPUT", "BIDIRECTIONAL"])
.then(async (points) => {
const payload = {};
await Promise.all(
Expand Down
10 changes: 6 additions & 4 deletions alfalfa_web/server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ class AlfalfaAPI {

removeRun = async (run) => {
// Delete run
await this.run.deleteOne({ _id: run._id });
const { deletedCount } = await this.run.deleteOne({ _id: run._id });

if (run) {
if (deletedCount == 1) {
// Delete points
await this.points.deleteMany({ run: run._id });

Expand All @@ -188,7 +188,9 @@ class AlfalfaAPI {
const key = await scan(this.redis, run.ref_id);
if (key.length) await del(this.redis, key);

return true;
return Promise.resolve();
} else {
return Promise.reject("Could not remove Run");
}
};

Expand Down Expand Up @@ -346,7 +348,7 @@ class AlfalfaAPI {
if (deletedCount == 1) {
return Promise.resolve();
} else {
return Promise.reject();
return Promise.reject("Could not remove Alias");
}
};

Expand Down

0 comments on commit 8443025

Please sign in to comment.