#7897 - masterTest_24_36 #2909

Merged
jsegarra merged 132 commits from 7897_masterTest_24_36 into master 2024-09-03 06:37:54 +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;
}
};