From 1a9aeb7fb3b7cda901a027c3354dc514c9cc3c80 Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Wed, 4 Jun 2025 15:37:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=8F=E9=A1=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/BranchControlController.php | 8 ++------ app/Models/Room.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/BranchControlController.php b/app/Http/Controllers/BranchControlController.php index d41dbac..3a90372 100644 --- a/app/Http/Controllers/BranchControlController.php +++ b/app/Http/Controllers/BranchControlController.php @@ -36,12 +36,7 @@ class BranchControlController extends Controller * @OA\Property( * property="rooms", * type="object", - * additionalProperties=@OA\Schema( - * @OA\Property(property="is_online", type="boolean", example=true), - * @OA\Property(property="status", ref="#/components/schemas/RoomStatus"), - * @OA\Property(property="started_at", type="string", format="date-time", example="2025-06-04 10:00:00Z"), - * @OA\Property(property="ended_at", type="string", format="date-time", example="2025-06-04 12:00:00Z") - * ) + * additionalProperties={"$ref": "#/components/schemas/RoomInfo"} * ) * )) * ) @@ -62,6 +57,7 @@ class BranchControlController extends Controller * ), * ) */ + public function Branches(Request $request): JsonResponse { $branches = Branch::with('rooms')->get()->map(function ($branch) { diff --git a/app/Models/Room.php b/app/Models/Room.php index e36006b..09094ab 100644 --- a/app/Models/Room.php +++ b/app/Models/Room.php @@ -21,6 +21,16 @@ use App\Traits\LogsModelActivity; * @OA\Property(property="ended_at", type="string", format="date-time", example=null), * ) */ +/** + * @OA\Schema( + * schema="RoomInfo", + * type="object", + * @OA\Property(property="is_online", type="boolean", example=true), + * @OA\Property(property="status", ref="#/components/schemas/RoomStatus"), + * @OA\Property(property="started_at", type="string", format="date-time", example="2025-06-04T10:00:00Z"), + * @OA\Property(property="ended_at", type="string", format="date-time", example="2025-06-04T12:00:00Z") + * ) + */ class Room extends Model { /** @use HasFactory<\Database\Factories\ArtistFactory> */