Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
RolePlayConfigController
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 show
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Http\Controllers\v2\RolePlay;
4
5use App\Http\Controllers\Controller;
6use App\Http\Services\RolePlay\RolePlaySessionDeletionService;
7use Illuminate\Http\JsonResponse;
8
9/**
10 * Exposes system-wide roleplay configuration values that the frontend
11 * needs at runtime (currently: the short-session deletion threshold).
12 *
13 * Backed by CMC-managed Parameter records so Vengreso admins can tune
14 * values without a deploy.
15 */
16class RolePlayConfigController extends Controller
17{
18    public function __construct(
19        private readonly RolePlaySessionDeletionService $sessionDeletion,
20    ) {}
21
22    /**
23     * Return public roleplay configuration for the authenticated user.
24     *
25     * @response 200 {"status": "success", "data": {"min_session_duration_seconds": 5}}
26     */
27    public function show(): JsonResponse
28    {
29        return response()->json([
30            'status' => 'success',
31            'data' => [
32                'min_session_duration_seconds' => $this->sessionDeletion->getThreshold(),
33            ],
34        ]);
35    }
36}