Closed andysay closed 1 year ago
const { NotFound, GeneralError, BadRequest } = require("@feathersjs/errors"); module.exports = (options = {}) => { return async (context) => { const { app, data } = context; const result = app.service("users").find({ query: { //both uniq $select: [data.email, data.username], }, }); const { total } = await result; if (total > 0) { throw new BadRequest("Invalid Parameters", { errors: { // how get whats really conflict in db? ???? email? username? or both ... i want return to front for exactly status }, }); } return context; }; };
thx.
thx.