abstract-activity-ability.php
3 months ago
get-activity.php
3 months ago
list-activities.php
3 months ago
abstract-activity-ability.php
33 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; |
| 4 | } |
| 5 | |
| 6 | abstract class LatePointAbstractActivityAbility extends LatePointAbstractAbility { |
| 7 | |
| 8 | public function serialize_activity( OsActivityModel $a ): array { |
| 9 | return [ |
| 10 | 'id' => (int) $a->id, |
| 11 | 'description' => $a->description ?? '', |
| 12 | 'agent_id' => (int) $a->agent_id, |
| 13 | 'booking_id' => (int) $a->booking_id, |
| 14 | 'code' => $a->code ?? '', |
| 15 | 'created_at' => ! empty( $a->created_at ) ? date( 'c', strtotime( $a->created_at ) ) : '', |
| 16 | ]; |
| 17 | } |
| 18 | |
| 19 | protected function activity_output_schema(): array { |
| 20 | return [ |
| 21 | 'type' => 'object', |
| 22 | 'properties' => [ |
| 23 | 'id' => [ 'type' => 'integer' ], |
| 24 | 'description' => [ 'type' => 'string' ], |
| 25 | 'agent_id' => [ 'type' => 'integer' ], |
| 26 | 'booking_id' => [ 'type' => 'integer' ], |
| 27 | 'code' => [ 'type' => 'string' ], |
| 28 | 'created_at' => [ 'type' => 'string' ], |
| 29 | ], |
| 30 | ]; |
| 31 | } |
| 32 | } |
| 33 |