u
This commit is contained in:
@@ -62,6 +62,7 @@ export default function list(provider) {
|
||||
(typeof opts.search === 'string' && opts.search.trim() !== '') ||
|
||||
opts.onlyUnpaid === true ||
|
||||
opts.onlyUndelivered === true ||
|
||||
opts.entityId !== undefined ||
|
||||
opts.seekMonths !== undefined
|
||||
);
|
||||
|
||||
@@ -92,6 +93,16 @@ export default function list(provider) {
|
||||
type: orderType,
|
||||
};
|
||||
|
||||
// Filter by entityId
|
||||
if (opts?.entityId !== undefined && opts.entityId !== null) {
|
||||
const entityId = Number(opts.entityId);
|
||||
if (!Number.isInteger(entityId) || entityId <= 0) {
|
||||
throw new Error('Invalid entityId');
|
||||
}
|
||||
params.entityId = entityId;
|
||||
conditions.push('m.entity_id = @entityId');
|
||||
}
|
||||
|
||||
// Date cutoff via seekMonths (strictly integer)
|
||||
if (opts?.seekMonths !== undefined) {
|
||||
if (typeof opts.seekMonths !== 'number' || !Number.isInteger(opts.seekMonths)) {
|
||||
|
||||
@@ -53,6 +53,7 @@ export default function list(provider) {
|
||||
opts.offset !== undefined ||
|
||||
opts.limit !== undefined ||
|
||||
(typeof opts.search === 'string' && opts.search.trim() !== '') ||
|
||||
opts.entityId !== undefined ||
|
||||
opts.seekMonths !== undefined
|
||||
);
|
||||
|
||||
@@ -83,6 +84,16 @@ export default function list(provider) {
|
||||
type: quoteType,
|
||||
};
|
||||
|
||||
// Filter by entityId
|
||||
if (opts?.entityId !== undefined && opts.entityId !== null) {
|
||||
const entityId = Number(opts.entityId);
|
||||
if (!Number.isInteger(entityId) || entityId <= 0) {
|
||||
throw new Error('Invalid entityId');
|
||||
}
|
||||
params.entityId = entityId;
|
||||
conditions.push('m.entity_id = @entityId');
|
||||
}
|
||||
|
||||
// Date cutoff via seekMonths (strictly integer)
|
||||
if (opts?.seekMonths !== undefined) {
|
||||
if (typeof opts.seekMonths !== 'number' || !Number.isInteger(opts.seekMonths)) {
|
||||
|
||||
@@ -90,6 +90,16 @@ export default function list(provider) {
|
||||
conditions.push(`m.${isSqlite ? '"date"' : '[date]'} <= @dateTo`);
|
||||
}
|
||||
|
||||
// Filter by entityId
|
||||
if (opts?.entityId !== undefined && opts.entityId !== null) {
|
||||
const entityId = Number(opts.entityId);
|
||||
if (!Number.isInteger(entityId) || entityId <= 0) {
|
||||
throw new Error('Invalid entityId');
|
||||
}
|
||||
params.entityId = entityId;
|
||||
conditions.push('m.entity_id = @entityId');
|
||||
}
|
||||
|
||||
// Parent order id filter
|
||||
if (opts?.orderId !== undefined && opts?.orderId !== null) {
|
||||
const parsedOrderId = Number(opts.orderId);
|
||||
|
||||
Reference in New Issue
Block a user