Skip to content

Commit

Permalink
fix(aap): fixes codesmells for aap plugin (#653)
Browse files Browse the repository at this point in the history
  • Loading branch information
invincibleJai authored Aug 22, 2023
1 parent 76c70a8 commit 0a9dc6b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins/aap-backend/src/providers/AapResourceEntityProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,19 @@ export class AapResourceEntityProvider implements EntityProvider {
const providerConfigs = readAapApiEntityConfigs(configRoot);

return providerConfigs.map(providerConfig => {
if (!options.schedule && !providerConfig.schedule) {
let taskRunner;
if (options.schedule) {
taskRunner = options.schedule;
} else if (options.scheduler && providerConfig.schedule) {
taskRunner = options.scheduler.createScheduledTaskRunner(
providerConfig.schedule,
);
} else {
throw new Error(
`No schedule provided neither via code nor config for AapResourceEntityProvider:${providerConfig.id}.`,
);
}

const taskRunner =
options.schedule ??
options.scheduler!.createScheduledTaskRunner(providerConfig.schedule!);

return new AapResourceEntityProvider(
providerConfig,
options.logger,
Expand Down

0 comments on commit 0a9dc6b

Please sign in to comment.