File manager - Edit - /var/www/html/spdc/api/app/Http/Controllers/FamilyHealthQuestionnaireController.php
Back
<?php namespace App\Http\Controllers; use App\Http\Requests\FamilyHealthQuestionnaireRequest; use App\Http\Services\FamilyHealthQuestionnaireService; use Illuminate\Http\JsonResponse; class FamilyHealthQuestionnaireController extends Controller { private FamilyHealthQuestionnaireService $service; public function __construct() { $this->service = new FamilyHealthQuestionnaireService(); } /** * @OA\Get( * path="/api/questionnaire/family-health", * summary="Get all family health questionnaires", * operationId="GetAllFamilyHealthQuestionnaires", * security={{"bearerAuth":{}}}, * tags={"Family Health Questionnaires"}, * @OA\Response( * response="200", * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ) * ) */ public function index(): JsonResponse { $response = $this->service->index(); return response()->json($response->data, $response->code); } /** * @OA\Post( * path="/api/questionnaire/family-health", * summary="Create a new family health questionnaire", * operationId="CreateFamilyHealthQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Family Health Questionnaires"}, * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"family_id", "contact_with_water_or_mud", "presence_of_rats", "trash_on_water", "pests_near_residence", "residence_situation", "description"}, * @OA\Property( * property="family_id", * type="string", * example="9b6e0239-a7b6-4ce8-a56c-da800fb28f70", * description="ID da familia" * ), * @OA\Property( * property="contact_with_water_or_mud", * type="boolean", * example="0", * description="Entraram em contato com agua ou lama?" * ), * @OA\Property( * property="presence_of_rats", * type="boolean", * example="1", * description="Presença de roedores?", * ), * @OA\Property( * property="trash_on_water", * type="boolean", * example="1", * description="Tinha lixo junto da água?", * ), * @OA\Property( * property="pests_near_residence", * type="boolean", * example="1", * description="Já viram serpentes, aranhas e escorpiões próximo a residência?", * ), * @OA\Property( * property="residence_situation", * type="string", * example="ALAGADO|RISCO|AVARIA PARCIAL|AVARIA TOTAL", * description="Situação imóvel (alagado, situação, risco, avaria parcial, avaria total)", * ), * @OA\Property( * property="description", * type="string", * example="Description", * description="Descrição (outras informações relevantes sobre o evento e/ou família)", * ), * ) * ) * ), * @OA\Response( * response="201", * description="Created", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success.") * ) * ), * @OA\Response( * response="401", * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Unauthorized.") * ) * ), * @OA\Response( * response="400", * description="Bad request", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Bad request") * ) * ) * ) */ public function store(FamilyHealthQuestionnaireRequest $request): JsonResponse { $response = $this->service->store($request); return response()->json($response->data, $response->code); } /** * @OA\Get( * path="/api/questionnaire/family-health/{id}", * summary="Get a specific family health questionnaire", * operationId="GetFamilyHealthQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Family Health Questionnaires"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the family health questionnaire", * @OA\Schema(type="string") * ), * @OA\Response( * response="200", * description="Successful operation", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="404", * description="Family Health questionnaire not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Family Health questionnaire not found") * ) * ) * ) */ public function show(string $id): JsonResponse { $response = $this->service->show($id); return response()->json($response->data, $response->code); } /** * @OA\Put( * path="/api/questionnaire/family-health/{id}", * summary="Update a family health questionnaire", * operationId="UpdateFamilyHealthQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Family Health Questionnaires"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the family health questionnaire", * @OA\Schema(type="string") * ), * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"family_id", "contact_with_water_or_mud", "presence_of_rats", "trash_on_water", "pests_near_residence", "residence_situation", "description"}, * @OA\Property( * property="family_id", * type="string", * example="9b6e0239-a7b6-4ce8-a56c-da800fb28f70", * description="ID da familia" * ), * @OA\Property( * property="contact_with_water_or_mud", * type="boolean", * example="0", * description="Entraram em contato com agua ou lama?" * ), * @OA\Property( * property="presence_of_rats", * type="boolean", * example="1", * description="Presença de roedores?", * ), * @OA\Property( * property="trash_on_water", * type="boolean", * example="1", * description="Tinha lixo junto da água?", * ), * @OA\Property( * property="pests_near_residence", * type="boolean", * example="1", * description="Já viram serpentes, aranhas e escorpiões próximo a residência?", * ), * @OA\Property( * property="residence_situation", * type="string", * example="ALAGADO|RISCO|AVARIA PARCIAL|AVARIA TOTAL", * description="Situação imóvel (alagado, situação, risco, avaria parcial, avaria total)", * ), * @OA\Property( * property="description", * type="string", * example="Description", * description="Descrição (outras informações relevantes sobre o evento e/ou família)", * ), * ) * ), * ), * @OA\Response( * response=200, * description="OK", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response=404, * description="Family Health questionnaire not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Family Health questionnaire not found") * ) * ), * @OA\Response( * response=401, * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Unauthorized."), * ) * ), * ) */ public function update(FamilyHealthQuestionnaireRequest $request, string $id): JsonResponse { $response = $this->service->update($request, $id); return response()->json($response->data, $response->code); } /** * @OA\Delete( * path="/api/questionnaire/family-health/{id}", * summary="Delete a family health questionnaire", * operationId="DeleteFamilyHealthQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Family Health Questionnaires"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the family health questionnaire", * @OA\Schema(type="string") * ), * @OA\Response( * response="200", * description="Successful operation", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Success."), * ) * ), * @OA\Response( * response="404", * description="Family Health questionnaire not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Family Health questionnaire not found") * ) * ) * ) */ public function destroy(string $id): JsonResponse { $response = $this->service->delete($id); return response()->json($response->data, $response->code); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings