1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6namespace App\Transformers;
7
8use App\Models\BeatmapDiscussionPost;
9
10class BeatmapDiscussionPostTransformer extends TransformerAbstract
11{
12 protected array $availableIncludes = [
13 'beatmap_discussion',
14 ];
15
16 protected $requiredPermission = 'BeatmapDiscussionPostShow';
17
18 public function transform(BeatmapDiscussionPost $post)
19 {
20 return [
21 'beatmapset_discussion_id' => $post->beatmap_discussion_id,
22 'created_at' => json_time($post->created_at),
23 'deleted_at' => json_time($post->deleted_at),
24 'deleted_by_id' => $post->deleted_by_id,
25 'id' => $post->id,
26 'last_editor_id' => $post->last_editor_id,
27 'message' => $post->message,
28 'system' => $post->system,
29 'updated_at' => json_time($post->updated_at),
30 'user_id' => $post->user_id,
31 ];
32 }
33
34 public function includeBeatmapDiscussion(BeatmapDiscussionPost $post)
35 {
36 return $this->item(
37 $post->beatmapDiscussion,
38 new BeatmapDiscussionTransformer()
39 );
40 }
41}