Skip to content

Commit

Permalink
Added required property to ContentPack
Browse files Browse the repository at this point in the history
  • Loading branch information
thommcgrath committed Apr 15, 2024
1 parent 9305cd2 commit d787acc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Website/api/v4/classes/ContentPack.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ContentPack extends DatabaseObject implements JsonSerializable {
protected bool $isIncludedInDeltas;
protected array $gameSpecific;
protected ?string $slug;
protected bool $required;

protected function __construct(BeaconRecordSet $row) {
$this->contentPackId = $row->Field('content_pack_id');
Expand All @@ -42,6 +43,7 @@ protected function __construct(BeaconRecordSet $row) {
$this->isIncludedInDeltas = filter_var($row->Field('include_in_deltas'), FILTER_VALIDATE_BOOL);
$this->gameSpecific = json_decode($row->Field('game_specific'), true);
$this->slug = $row->Field('slug');
$this->required = $row->Field('required');
}

public static function BuildDatabaseSchema(): DatabaseSchema {
Expand All @@ -61,7 +63,8 @@ public static function BuildDatabaseSchema(): DatabaseSchema {
new DatabaseObjectProperty('isOfficial', ['columnName' => 'is_official', 'editable' => DatabaseObjectProperty::kEditableNever]),
new DatabaseObjectProperty('isIncludedInDeltas', ['columnName' => 'include_in_deltas', 'editable' => DatabaseObjectProperty::kEditableNever]),
new DatabaseObjectProperty('gameSpecific', ['columnName' => 'game_specific', 'editable' => DatabaseObjectProperty::kEditableNever]),
new DatabaseObjectProperty('slug', ['editable' => DatabaseObjectProperty::kEditableAtCreation])
new DatabaseObjectProperty('slug', ['editable' => DatabaseObjectProperty::kEditableAtCreation]),
new DatabaseObjectProperty('required', ['editable' => DatabaseObjectProperty::kEditableNever]),
]);
}

Expand Down Expand Up @@ -222,6 +225,10 @@ public function Slug(): ?string {
return $this->slug;
}

public function Required(): bool {
return $this->required;
}

public function AttemptConfirmation(): bool {
if ($this->isConfirmed) {
return true;
Expand Down Expand Up @@ -291,7 +298,8 @@ public function jsonSerialize(): mixed {
'minVersion' => $this->minVersion,
'lastUpdate' => $this->lastUpdate,
'gameSpecific' => $this->gameSpecific,
'slug' => $this->slug
'slug' => $this->slug,
'required' => $this->required,
];
}
}
Expand Down

0 comments on commit d787acc

Please sign in to comment.