Skip to content

Commit f7afb1d

Browse files
authored
Merge pull request Open-SGF#130 from jugglingdev/setup-fix
Setup fix - composer setup and Neon API variable private method
2 parents 84f20fd + a85ed7b commit f7afb1d

7 files changed

Lines changed: 2419 additions & 2206 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
- All project contributors should run these commands every week to ensure your local project is using the current project dependencies.
2525
- `composer install`
26+
- `composer setup`
2627
- `npm install`
2728
- `npm run build`
2829

app/Console/Commands/PollNeonParticipants.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public function handle()
4444
{
4545

4646
$participantIds = $this->neonApi->getTodaysParticipantIds();
47+
48+
Log::info('Found '.count($participantIds).' participant records to check for updates.');
4749

4850
foreach ($participantIds as $participantId) {
4951
// Get the full participant record

app/Services/Integrations/NeonApiService.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,30 @@
1010

1111
class NeonApiService
1212
{
13-
protected string $baseUrl;
14-
15-
protected string $apiKey;
13+
protected ?string $baseUrl;
14+
protected ?string $apiKey;
1615

1716
public function __construct()
1817
{
1918
$this->baseUrl = config('services.neon.base_url');
2019
$this->apiKey = config('services.neon.api_key');
2120
}
2221

22+
private function ensureConfigured(): void
23+
{
24+
if (!$this->baseUrl) {
25+
throw new \RuntimeException('NEON_BASE_URL is not configured.');
26+
}
27+
28+
if (!$this->apiKey) {
29+
throw new \RuntimeException('NEON_API_KEY is not configured.');
30+
}
31+
}
32+
2333
private function fetch(string $endpoint, array $fields = [], ?int $personId = null, bool $useWhereClause = true): array
2434
{
35+
$this->ensureConfigured();
36+
2537
$url = "{$this->baseUrl}/data/{$endpoint}";
2638

2739
$params = [
@@ -64,7 +76,7 @@ private function fetch(string $endpoint, array $fields = [], ?int $personId = nu
6476

6577
public function getTodaysParticipantIds(): array {
6678
$todaysDate = Carbon::today('America/Chicago')->format('Y-m-d');
67-
// $todaysDate = '2026-02-24';
79+
// $todaysDate = '2024-02-24'; // for testing
6880
Log::info("Collecting participant records that have been added or updated today - {$todaysDate}....");
6981
$toReturn = $this->getParticipantIdsByDate($todaysDate);
7082
$count = count($toReturn);

app/Services/PdfIntakeFormService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function generate(ParticipantUpdateData $participant): string
3939
$data = $participant->toPdfArray();
4040

4141
// Load and fill the PDF
42-
$pdf = new Pdf(storage_path("app/{$this->pdfTemplatePath}"));
42+
$pdf = new Pdf(storage_path("{$this->pdfTemplatePath}"));
4343
$pdf->fillForm($data)
4444
->needAppearances()
4545
->flatten()

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
}
4949
},
5050
"scripts": {
51+
"setup": [
52+
"@php artisan config:clear",
53+
"@php artisan cache:clear"
54+
],
5155
"post-autoload-dump": [
5256
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
5357
"@php artisan package:discover --ansi"

0 commit comments

Comments
 (0)