Merge pull request 'feat: refs #7524 no apply limit' (!2921) from 7524-hotfix-addNoLimit into master
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2921
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
This commit is contained in:
Jorge Penadés 2024-09-10 14:48:20 +00:00
commit b10ad7527a
2 changed files with 8 additions and 6 deletions

View File

@ -33,7 +33,7 @@ module.exports = function(Self) {
const defaultLimit = this.app.orm.selectLimit; const defaultLimit = this.app.orm.selectLimit;
const filter = ctx.args.filter || {limit: defaultLimit}; const filter = ctx.args.filter || {limit: defaultLimit};
if (filter.limit > defaultLimit) { if (!filter.limit || filter.limit > defaultLimit) {
filter.limit = defaultLimit; filter.limit = defaultLimit;
ctx.args.filter = filter; ctx.args.filter = filter;
} }
@ -349,9 +349,10 @@ module.exports = function(Self) {
}, },
hasFilter(ctx) { hasFilter(ctx) {
return ctx.req.method.toUpperCase() === 'GET' && const {method, req} = ctx;
ctx.method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object'); if (method.noLimit) return false;
} return req.method.toUpperCase() === 'GET' &&
method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object');
},
}); });
}; };

View File

@ -16,7 +16,8 @@ module.exports = Self => {
http: { http: {
path: `/getBalance`, path: `/getBalance`,
verb: 'GET' verb: 'GET'
} },
noLimit: true
}); });
Self.getBalance = async(ctx, filter, options) => { Self.getBalance = async(ctx, filter, options) => {