#18 - membership

This commit was merged in pull request #23.
This commit is contained in:
Martin Slachta
2026-06-17 11:15:09 +02:00
parent df5f9b1df4
commit c754e18a82
25 changed files with 885 additions and 35 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
class RsvMembershipKey {
public ?int $id;
public int $program_id;
public string $key_value;
public static function schema(): array {
return [
'type' => 'object',
'properties' => [
'id' => ['type' => 'integer', 'readonly' => true],
'program_id' => ['type' => 'integer', 'required' => true],
'key_value' => ['type' => 'string', 'required' => true, 'minLength' => 1],
],
];
}
public static function from_array(array $data): self {
return new self(
intval($data['id'] ?? null),
intval($data['program_id'] ?? 0),
$data['key_value'] ?? ''
);
}
public function __construct(?int $id, int $program_id, string $key_value) {
$this->id = $id;
$this->program_id = $program_id;
$this->key_value = $key_value;
}
public function to_array() {
return [
'id' => $this->id,
'program_id' => $this->program_id,
'key_value' => $this->key_value,
];
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
class RsvMembershipProgram {
public ?int $id;
public string $name;
public bool $active;
public static function schema(): array {
return [
'type' => 'object',
'properties' => [
'id' => ['type' => 'integer', 'readonly' => true],
'name' => ['type' => 'string', 'required' => true, 'minLength' => 1],
'active' => ['type' => 'boolean', 'default' => true],
],
];
}
public static function from_array(array $data): self {
return new self(
intval($data['id'] ?? null),
$data['name'] ?? '',
boolval($data['active'] ?? true)
);
}
public function __construct(?int $id, string $name, bool $active = true) {
$this->id = $id;
$this->name = $name;
$this->active = $active;
}
public function to_array() {
return [
'id' => $this->id,
'name' => $this->name,
'active' => $this->active,
];
}
}
@@ -6,6 +6,8 @@ class RsvTimetableReservation {
public DateTime $start_utc; // UTC, 'Y-m-d H:i:s'
public DateTime $end_utc; // UTC, 'Y-m-d H:i:s'
public ?int $is_confirmed = null;
public static function schema(): array {
return [
'type' => 'object',