Skip to content

Commit

Permalink
feat: add additional checks to offer endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Sep 9, 2022
1 parent fb26d68 commit 576ed00
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/controllers/offer.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export const generateOfferFile = async (req, res) => {

export const cancelActiveOffer = async (req, res) => {
try {
await assertIfReadOnlyMode();
await assertStagingTableNotEmpty();
await assertHomeOrgExists();
await assertWalletIsSynced();
await assertNoPendingCommits();

const activeOffer = await Meta.findOne({
where: { metaKey: 'activeOfferTradeId' },
});
Expand Down Expand Up @@ -94,6 +100,11 @@ export const importOfferFile = async (req, res) => {
export const commitImportedOfferFile = async (req, res) => {
try {
await assertActiveOfferFile();
await assertIfReadOnlyMode();
await assertStagingTableIsEmpty();
await assertHomeOrgExists();
await assertWalletIsSynced();
await assertNoPendingCommits();

const offerFile = Meta.findOne({ where: { metaKey: 'activeOffer' } });
const response = await datalayer.takeOffer(offerFile);
Expand Down

0 comments on commit 576ed00

Please sign in to comment.