Skip to content

Commit

Permalink
feat: query for records without marketplaceidentifier
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Sep 21, 2022
1 parent 058e2d6 commit c6a441e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/controllers/units.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,15 @@ export const findAll = async (req, res) => {
}

where.marketplaceIdentifier = {
[Sequelize.Op.not]: [null, ''],
[Sequelize.Op.not]: null,
};
} else {
if (!where) {
where = {};
}

where.marketplaceIdentifier = {
[Sequelize.Op.eq]: null,
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/validations/units.validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const unitsBaseSchema = {
unitType: Joi.string().custom(pickListValidation('unitType')).required(),
marketplace: Joi.string().optional(),
marketplaceLink: Joi.string().optional(),
marketplaceIdentifier: Joi.string().optional(),
marketplaceIdentifier: Joi.string().disallow('').allow(null).optional(),
unitTags: Joi.string().allow('').optional(),
unitStatus: Joi.string().custom(pickListValidation('unitStatus')).required(),
unitStatusReason: Joi.string().when('unitStatus', {
Expand Down

0 comments on commit c6a441e

Please sign in to comment.