Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release #407

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.8
20.11.1
76 changes: 38 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
],
"type": "module",
"dependencies": {
"@bull-board/api": "^5.15.5",
"@bull-board/express": "^5.15.5",
"@bull-board/koa": "^5.15.5",
"@restorecommerce/acs-client": "^1.5.1",
"@restorecommerce/chassis-srv": "^1.5.0",
"@bull-board/api": "^5.16.0",
"@bull-board/express": "^5.16.0",
"@bull-board/koa": "^5.16.0",
"@restorecommerce/acs-client": "^1.6.0",
"@restorecommerce/chassis-srv": "^1.6.0",
"@restorecommerce/cluster-service": "^1.0.3",
"@restorecommerce/kafka-client": "^1.2.1",
"@restorecommerce/logger": "^1.2.10",
"@restorecommerce/rc-grpc-clients": "^5.1.23",
"@restorecommerce/scs-jobs": "^0.1.23",
"@restorecommerce/service-config": "^1.0.12",
"bullmq": "^5.7.1",
"bullmq": "^5.7.4",
"cache-manager": "^5.5.1",
"cache-manager-redis": "^0.6.0",
"cron-parser": "^4.9.0",
Expand Down
37 changes: 22 additions & 15 deletions src/schedulingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ export class SchedulingService implements SchedulingServiceServiceImplementation

private filterByOwnerShip(customArgsObj, result) {
// applying filter based on custom arguments (filterByOwnerShip)
let filteredResult: Job[] = [];
let customArgs = (customArgsObj)?.custom_arguments;
if (customArgs?.value) {
let customArgsFilter;
Expand All @@ -638,28 +639,34 @@ export class SchedulingService implements SchedulingServiceServiceImplementation
message: error.message, stack: error.stack
});
}
if (!customArgsFilter) {
if (customArgsFilter?.length === 0) {
return [];
}
const ownerIndicatorEntity = customArgsFilter.entity;
const ownerValues = customArgsFilter.instance;
const ownerIndictaorEntURN = this.cfg.get('authorization:urns:ownerIndicatoryEntity');
const ownerInstanceURN = this.cfg.get('authorization:urns:ownerInstance');
result = result.filter(job => {
if (job?.data?.meta?.owners?.length > 0) {
for (let owner of job.data.meta.owners) {
if (owner?.id === ownerIndictaorEntURN && owner?.value === ownerIndicatorEntity && owner?.attributes?.length > 0) {
for (let ownerInstObj of owner.attributes) {
if (ownerInstObj?.id === ownerInstanceURN && ownerInstObj?.value && ownerValues.includes(ownerInstObj.value)) {
return job;
for (let customArgObj of customArgsFilter) {
const ownerIndicatorEntity = customArgObj?.entity;
const ownerValues = customArgObj?.instance;
const ownerIndictaorEntURN = this.cfg.get('authorization:urns:ownerIndicatoryEntity');
const ownerInstanceURN = this.cfg.get('authorization:urns:ownerInstance');
const filteredResp = result.filter(job => {
if (job?.data?.meta?.owners?.length > 0) {
for (let owner of job.data.meta.owners) {
if (owner?.id === ownerIndictaorEntURN && owner?.value === ownerIndicatorEntity && owner?.attributes?.length > 0) {
for (let ownerInstObj of owner.attributes) {
if (ownerInstObj?.id === ownerInstanceURN && ownerInstObj?.value && ownerValues.includes(ownerInstObj.value)) {
return job;
}
}
}
}
}
}
});
});
filteredResult = filteredResult.concat(filteredResp);
}
return filteredResult;
} else {
// no custom filters exist, return complete result set
return result;
}
return result;
}

async deleteRedisKey(key: string): Promise<any> {
Expand Down
Loading