diff --git a/lib/hiring-platforms/ashby.ts b/lib/hiring-platforms/ashby.ts index a2a5708..8ce355b 100644 --- a/lib/hiring-platforms/ashby.ts +++ b/lib/hiring-platforms/ashby.ts @@ -98,8 +98,10 @@ export class Ashby extends HiringPlatform { const openJobs = result.jobs.map(job => this.mapJob(job, companyId)) - await queryInsertJobs(openJobs) - await queryMarkJobsAsClosed(companyId, openJobs) + if (openJobs.length) { + await queryInsertJobs(openJobs) + await queryMarkJobsAsClosed(companyId, openJobs) + } } private mapJob(job: AshbyJob, companyId: SelectCompany['id']): InsertJob { diff --git a/lib/hiring-platforms/greenhouse.ts b/lib/hiring-platforms/greenhouse.ts index eb0e34c..f8658a8 100644 --- a/lib/hiring-platforms/greenhouse.ts +++ b/lib/hiring-platforms/greenhouse.ts @@ -66,8 +66,10 @@ export class Greenhouse extends HiringPlatform { const openJobs = result.jobs.map(job => this.mapJob(job, companyId)) - await queryInsertJobs(openJobs) - await queryMarkJobsAsClosed(companyId, openJobs) + if (openJobs.length) { + await queryInsertJobs(openJobs) + await queryMarkJobsAsClosed(companyId, openJobs) + } } private mapJob(