Skip to content

Commit

Permalink
Merge pull request #46 from art-institute-of-chicago/drift/refactor-a…
Browse files Browse the repository at this point in the history
…pi-backed-fields

Return default `null` artwork when missing `datahub_id`
  • Loading branch information
nikhiltri authored Jun 6, 2024
2 parents 87a1fcf + 0d6c85b commit 2999dc0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/Models/Artwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ public function getArtworkApiData(): stdClass
array_pad([], count(Artwork::ARTWORK_API_FIELDS), null)
);

if (! $this->datahub_id) {
return $nullArtwork;
}

return $this->getApiData(
self::ARTWORK_API_FIELDS,
"/api/v1/artworks/{$this->datahub_id}",
Expand Down

0 comments on commit 2999dc0

Please sign in to comment.