mail: add search param for mailbox and mailing list api
This commit is contained in:
+6
-2
@@ -159,7 +159,9 @@ function listMailboxes(req, res, next) {
|
||||
var perPage = typeof req.query.per_page !== 'undefined'? parseInt(req.query.per_page) : 25;
|
||||
if (!perPage || perPage < 0) return next(new HttpError(400, 'per_page query param has to be a positive number'));
|
||||
|
||||
mail.listMailboxes(req.params.domain, page, perPage, function (error, result) {
|
||||
if (req.query.search && typeof req.query.search !== 'string') return next(new HttpError(400, 'search must be a string'));
|
||||
|
||||
mail.listMailboxes(req.params.domain, req.query.search || null, page, perPage, function (error, result) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, { mailboxes: result }));
|
||||
@@ -254,7 +256,9 @@ function getLists(req, res, next) {
|
||||
const perPage = typeof req.query.per_page !== 'undefined'? parseInt(req.query.per_page) : 25;
|
||||
if (!perPage || perPage < 0) return next(new HttpError(400, 'per_page query param has to be a positive number'));
|
||||
|
||||
mail.getLists(req.params.domain, page, perPage, function (error, result) {
|
||||
if (req.query.search && typeof req.query.search !== 'string') return next(new HttpError(400, 'search must be a string'));
|
||||
|
||||
mail.getLists(req.params.domain, req.query.search || null, page, perPage, function (error, result) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, { lists: result }));
|
||||
|
||||
Reference in New Issue
Block a user