Skip to content

Commit

Permalink
fix issue with remove item api call (#102)
Browse files Browse the repository at this point in the history
* fix issue with remove item api call

* bump dep ver

* bump ver

Co-authored-by: Kevin <[email protected]>
  • Loading branch information
51ngul4r1ty and singularity15 authored May 29, 2020
1 parent e5f41c0 commit da9b7a3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "atoll",
"version": "0.8.0",
"version": "0.8.1",
"author": {
"name": "Kevin Berry",
"email": "[email protected]"
Expand Down Expand Up @@ -59,7 +59,7 @@
"check": "node ./scripts/check-package-json.js"
},
"dependencies": {
"@atoll/shared": "0.8.0",
"@atoll/shared": "0.8.1",
"@flopflip/memory-adapter": "1.6.0",
"@flopflip/react-broadcast": "10.1.11",
"axios": "0.19.2",
Expand Down
17 changes: 15 additions & 2 deletions src/server/api/handlers/backlogItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const backlogItemsDeleteHandler = async (req: Request, res: Response) =>
transaction = await sequelize.transaction({ isolationLevel: Transaction.ISOLATION_LEVELS.SERIALIZABLE });
await sequelize.query('SET CONSTRAINTS "backlogitemrank_backlogitemId_fkey" DEFERRED;', { transaction });
await sequelize.query('SET CONSTRAINTS "backlogitemrank_nextbacklogitemId_fkey" DEFERRED;', { transaction });
const id = req.params.backlogItemId;
const id = req.params.itemId;
let abort = true;
let backlogItem: BacklogItemModel = null;
let backlogItemTyped: ApiBacklogItem = null;
Expand Down Expand Up @@ -244,9 +244,22 @@ export const backlogItemsPostHandler = async (req: Request, res: Response) => {
};

export const backlogItemPutHandler = async (req: Request, res: Response) => {
const queryParamItemId = req.params.itemId;
if (!queryParamItemId) {
respondWithFailedValidation(res, "Item ID is required in URI path for this operation");
return;
}
const bodyItemId = req.body.id;
if (queryParamItemId != bodyItemId) {
respondWithFailedValidation(
res,
`Item ID in URI path (${queryParamItemId}) should match Item ID in payload (${bodyItemId})`
);
return;
}
try {
const backlogItem = await BacklogItemModel.findOne({
where: { id: req.body.id }
where: { id: bodyItemId }
});
if (!backlogItem) {
respondWithNotFound(res, `Unable to find item to update with ID ${req.body.id}`);
Expand Down

0 comments on commit da9b7a3

Please sign in to comment.