#7896 - 24.36 Dev To Test #2884

Merged
jsegarra merged 118 commits from dev into test 2024-08-27 10:32:53 +00:00
2 changed files with 10 additions and 5 deletions
Showing only changes of commit b3b7e9c213 - Show all commits

View File

@ -31,20 +31,19 @@ module.exports = function(Self) {
/*
* Intercept GET request for find
*/
this.beforeRemote('find', async function(ctx) {
this.beforeRemote('find', async ctx => {
isSelect = true;
const filter = ctx.args.filter || {};
// console.log(this.dataSource, Self.dataSource); undefined/null
if (filter.limit === undefined) {
filter.limit = 1/* limit */;
filter.limit = this.app.orm.selectLimit;
ctx.args.filter = filter;
}
});
this.observe('loaded', async function({data}) {
this.observe('loaded', async({data}) => {
if (!isSelect) return;
const length = Array.isArray(data) ? data.length : data ? 1 : 0;
if (length >= 1) throw new UserError('Too many records');
if (length >= this.app.orm.selectLimit) throw new UserError('Too many records');
});
// Register field ACL validation

View File

@ -0,0 +1,6 @@
module.exports = async function(app) {
if (!app.orm) {
const ormConfig = await app.models.OrmConfig.findOne();
app.orm = ormConfig;
}
};