Skip to content

Commit b1fad0f

Browse files
author
Sachin Maheshwari
committed
supporting 'limit' filed in query string temporarily.
1 parent d5e9ac5 commit b1fad0f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/services/NotificationService.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ updateSettings.schema = {
179179
function* listNotifications(query, userId) {
180180
const settings = yield getSettings(userId);
181181
const notificationSettings = settings.notifications;
182-
const limit = query.per_page;
182+
const limit = query.limit || query.per_page;
183183
const offset = (query.page - 1) * limit;
184184
const filter = { where: {
185185
userId,
@@ -213,7 +213,7 @@ function* listNotifications(query, userId) {
213213
});
214214
return {
215215
items,
216-
perPage: query.per_page,
216+
perPage: limit,
217217
currentPage: query.page,
218218
total: docs.count,
219219
};
@@ -223,6 +223,8 @@ listNotifications.schema = {
223223
query: Joi.object().keys({
224224
page: Joi.number().integer().min(1).default(1),
225225
per_page: Joi.number().integer().min(1).default(DEFAULT_LIMIT),
226+
// supporting limit field temporarily
227+
limit: Joi.number().integer().min(1),
226228
type: Joi.string(),
227229
platform: Joi.string(),
228230
// when it is true, return only read notifications

0 commit comments

Comments
 (0)