feat(cronjob): implement CronJobProcessor and CronJobRepository for job scheduling and processing

- Added CronJobProcessor class to handle job creation and queue processing.
- Implemented CronJobRepository for database interactions related to cron jobs.
- Introduced CronJobType class to define job types, priorities, and statuses.
- Created ApiloLogger for logging actions related to job processing.
- Initialized apilo-sync-queue.json for job queue management.
This commit is contained in:
2026-02-27 14:51:30 +01:00
parent fc45bbf20e
commit 4cf7039759
34 changed files with 3099 additions and 741 deletions

View File

@@ -357,4 +357,34 @@ class ProducerRepository
return 0;
}
/**
* Znajdź producenta po nazwie lub utwórz nowego (dla API).
*
* @return array{id: int, created: bool}
*/
public function ensureProducerForApi(string $name): array
{
$name = trim($name);
if ($name === '') {
return ['id' => 0, 'created' => false];
}
$existing = $this->db->get('pp_shop_producer', 'id', ['name' => $name]);
if (!empty($existing)) {
return ['id' => (int)$existing, 'created' => false];
}
$this->db->insert('pp_shop_producer', [
'name' => $name,
'status' => 1,
'img' => null,
]);
$id = (int)$this->db->id();
if ($id <= 0) {
return ['id' => 0, 'created' => false];
}
return ['id' => $id, 'created' => true];
}
}