File manager - Edit - /var/www/html/spdc/api/app/Http/Controllers/MemberHealthQuestionnaireController.php
Back
<?php namespace App\Http\Controllers; use App\Http\Requests\MemberHealthQuestionnaireRequest; use App\Http\Services\MemberHealthQuestionnaireService; use Illuminate\Http\JsonResponse; class MemberHealthQuestionnaireController extends Controller { private MemberHealthQuestionnaireService $service; public function __construct() { $this->service = new MemberHealthQuestionnaireService(); } /** * @OA\Get( * path="/api/questionnaire/member-health", * summary="Get all member health questionnaires", * operationId="GetAllMemberHealthQuestionnaires", * security={{"bearerAuth":{}}}, * tags={"Member 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/member-health", * summary="Create a new member health questionnaire", * operationId="CreateMemberHealthQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Member Health Questionnaires"}, * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"member_family_id", "blood_type", "antigen", "hypertension", "diabetes", "another_cronic_disease", "another_cronic_disease_description", "regular_use_of_medicine", "regular_use_of_medicine_description", "is_medicine_on_shelter", "health_problems_currently", "health_problems_currently_description", "recent_surgery", "recent_surgery_description", "pregnant","pregnant_description", "wounded_in_contact_with_water", "wounded_in_contact_with_water_description"}, * @OA\Property( * property="member_family_id", * type="string", * example="9b6e0332-4ee2-46c4-84b7-4859b3b806fd", * description="ID do membro da familia" * ), * @OA\Property( * property="blood_type", * type="string", * example="A", * description="Tipo sanguineo do membro", * ), * @OA\Property( * property="antigen", * type="string", * example="POSITIVO", * description="Antigen description" * ), * @OA\Property( * property="hypertension", * type="boolean", * example=1, * description="Has hypertension or not" * ), * @OA\Property( * property="diabetes", * type="boolean", * example=0, * description="Has diabetes or not" * ), * @OA\Property( * property="another_cronic_disease", * type="boolean", * example=0, * description="Has another chronic disease or not" * ), * @OA\Property( * property="another_cronic_disease_description", * type="string", * example="Description of another chronic disease", * description="Description of another chronic disease if present" * ), * @OA\Property( * property="regular_use_of_medicine", * type="boolean", * example=1, * description="Regularly uses medicine or not" * ), * @OA\Property( * property="regular_use_of_medicine_description", * type="string", * example="Description of regular use of medicine", * description="Description of regular use of medicine if applicable" * ), * @OA\Property( * property="is_medicine_on_shelter", * type="boolean", * example=1, * description="Is medicine available at shelter or not" * ), * @OA\Property( * property="health_problems_currently", * type="boolean", * example=1, * description="Has current health problems or not" * ), * @OA\Property( * property="health_problems_currently_description", * type="string", * example="Description of current health problems", * description="Description of current health problems if present" * ), * @OA\Property( * property="recent_surgery", * type="boolean", * example=1, * description="Has undergone recent surgery or not" * ), * @OA\Property( * property="recent_surgery_description", * type="string", * example="Description of recent surgery", * description="Description of recent surgery if applicable" * ), * @OA\Property( * property="pregnant", * type="boolean", * example=0, * description="Is pregnant or not" * ), * @OA\Property( * property="pregnant_description", * type="string", * example="Description of pregnancy", * description="Description of pregnancy if applicable" * ), * @OA\Property( * property="wounded_in_contact_with_water", * type="boolean", * example=0, * description="Wounded in contact with water or not" * ), * @OA\Property( * property="wounded_in_contact_with_water_description", * type="string", * example="Description of water contact wound", * description="Description of water contact wound if applicable" * ) * ) * ) * ), * @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(MemberHealthQuestionnaireRequest $request): JsonResponse { $response = $this->service->store($request); return response()->json($response->data, $response->code); } /** * @OA\Get( * path="/api/questionnaire/member-health/{id}", * summary="Get a specific member health questionnaire", * operationId="GetMemberHealthQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Member Health Questionnaires"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the member 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="Member Health questionnaire not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Member 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/member-health/{id}", * summary="Update a member health questionnaire", * operationId="UpdateMemberHealthQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Member Health Questionnaires"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the member health questionnaire", * @OA\Schema(type="string") * ), * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"member_family_id", "blood_type", "antigen", "hypertension", "diabetes", "another_cronic_disease", "another_cronic_disease_description", "regular_use_of_medicine", "regular_use_of_medicine_description", "is_medicine_on_shelter", "health_problems_currently", "health_problems_currently_description", "recent_surgery", "recent_surgery_description", "pregnant","pregnant_description", "wounded_in_contact_with_water", "wounded_in_contact_with_water_description"}, * @OA\Property( * property="member_family_id", * type="string", * example="9b6e0332-4ee2-46c4-84b7-4859b3b806fd", * description="ID do membro da familia" * ), * @OA\Property( * property="blood_type", * type="string", * example="A", * description="Tipo sanguineo do membro", * ), * @OA\Property( * property="antigen", * type="string", * example="POSITIVO", * description="Antigen description" * ), * @OA\Property( * property="hypertension", * type="boolean", * example=1, * description="Has hypertension or not" * ), * @OA\Property( * property="diabetes", * type="boolean", * example=0, * description="Has diabetes or not" * ), * @OA\Property( * property="another_cronic_disease", * type="boolean", * example=0, * description="Has another chronic disease or not" * ), * @OA\Property( * property="another_cronic_disease_description", * type="string", * example="Description of another chronic disease", * description="Description of another chronic disease if present" * ), * @OA\Property( * property="regular_use_of_medicine", * type="boolean", * example=1, * description="Regularly uses medicine or not" * ), * @OA\Property( * property="regular_use_of_medicine_description", * type="string", * example="Description of regular use of medicine", * description="Description of regular use of medicine if applicable" * ), * @OA\Property( * property="is_medicine_on_shelter", * type="boolean", * example=1, * description="Is medicine available at shelter or not" * ), * @OA\Property( * property="health_problems_currently", * type="boolean", * example=1, * description="Has current health problems or not" * ), * @OA\Property( * property="health_problems_currently_description", * type="string", * example="Description of current health problems", * description="Description of current health problems if present" * ), * @OA\Property( * property="recent_surgery", * type="boolean", * example=1, * description="Has undergone recent surgery or not" * ), * @OA\Property( * property="recent_surgery_description", * type="string", * example="Description of recent surgery", * description="Description of recent surgery if applicable" * ), * @OA\Property( * property="pregnant", * type="boolean", * example=0, * description="Is pregnant or not" * ), * @OA\Property( * property="pregnant_description", * type="string", * example="Description of pregnancy", * description="Description of pregnancy if applicable" * ), * @OA\Property( * property="wounded_in_contact_with_water", * type="boolean", * example=0, * description="Wounded in contact with water or not" * ), * @OA\Property( * property="wounded_in_contact_with_water_description", * type="string", * example="Description of water contact wound", * description="Description of water contact wound if applicable" * ) * ) * ) * ), * @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="Member Health questionnaire not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Member Health questionnaire not found") * ) * ) * ) */ public function update(MemberHealthQuestionnaireRequest $request, string $id): JsonResponse { $response = $this->service->update($request, $id); return response()->json($response->data, $response->code); } /** * @OA\Delete( * path="/api/questionnaire/member-health/{id}", * summary="Delete a member health questionnaire", * operationId="DeleteMemberHealthQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Member Health Questionnaires"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the member 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="Member Health questionnaire not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Member 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