Added pagination size
This commit is contained in:
parent
d4e6d23459
commit
bf2e9be3b7
11 changed files with 54 additions and 17 deletions
|
@ -192,7 +192,6 @@ Publié automatiquement via #musictopus`;
|
|||
async getAll() {
|
||||
const {
|
||||
page,
|
||||
limit,
|
||||
exportFormat = "json",
|
||||
sort = "artists_sort",
|
||||
order = "asc",
|
||||
|
@ -206,6 +205,8 @@ Publié automatiquement via #musictopus`;
|
|||
discogsId,
|
||||
} = this.req.query;
|
||||
|
||||
const limit = this.req.user?.pagination || 16;
|
||||
|
||||
let userId = this.req.user?._id;
|
||||
|
||||
const where = {};
|
||||
|
@ -303,6 +304,7 @@ Publié automatiquement via #musictopus`;
|
|||
default:
|
||||
return {
|
||||
rows,
|
||||
limit,
|
||||
count,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ class Me extends Pages {
|
|||
const { _id } = this.req.user;
|
||||
|
||||
const schema = Joi.object({
|
||||
pagination: Joi.number(),
|
||||
isPublicCollection: Joi.boolean(),
|
||||
oldPassword: Joi.string(),
|
||||
password: Joi.string(),
|
||||
|
@ -45,6 +46,10 @@ class Me extends Pages {
|
|||
user.salt = value.password;
|
||||
}
|
||||
|
||||
if (value.pagination) {
|
||||
user.pagination = value.pagination;
|
||||
}
|
||||
|
||||
if (value.isPublicCollection !== undefined) {
|
||||
user.isPublicCollection = value.isPublicCollection;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@ const UserSchema = new mongoose.Schema(
|
|||
},
|
||||
hash: String,
|
||||
salt: String,
|
||||
pagination: {
|
||||
type: Number,
|
||||
default: 16,
|
||||
},
|
||||
isPublicCollection: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue