File manager - Edit - /var/www/html/spdc/api/app/Http/Controllers/MemberVaccineQuestionnaireController.php
Back
<?php namespace App\Http\Controllers; use App\Http\Requests\MemberVaccineQuestionnaireRequest; use App\Http\Services\MemberVaccineQuestionnaireService; use Illuminate\Http\JsonResponse; class MemberVaccineQuestionnaireController extends Controller { private MemberVaccineQuestionnaireService $service; public function __construct() { $this->service = new MemberVaccineQuestionnaireService(); } /** * @OA\Get( * path="/api/questionnaire/member-vaccine", * summary="Get all member vaccine questionnaires", * operationId="GetAllMemberVaccineQuestionnaires", * security={{"bearerAuth":{}}}, * tags={"Member vaccine 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-vaccine", * summary="Create a new member vaccine questionnaire", * operationId="CreateMemberVaccineQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Member vaccine Questionnaires"}, * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"member_family_id", "dt_dtpa", "hepatitis_a", "influenza", "covid_19", "triple_viral"}, * @OA\Property( * property="member_family_id", * type="string", * example="9b6e0239-a7b6-4ce8-a56c-da800fb28f70", * description="ID do membro da familia" * ), * @OA\Property( * property="dt_dtpa", * type="string", * example="2022-03-15", * description="Data da vacina DTPA" * ), * @OA\Property( * property="hepatitis_a", * type="boolean", * example=true, * description="Indica se foi vacinado para Hepatite A" * ), * @OA\Property( * property="influenza", * type="boolean", * example=false, * description="Indica se foi vacinado para Influenza" * ), * @OA\Property( * property="covid_19", * type="boolean", * example=true, * description="Indica se foi vacinado para COVID-19" * ), * @OA\Property( * property="triple_viral", * type="boolean", * example=true, * description="Indica se foi vacinado para TrÃplice Viral" * ) * ) * ) * ), * @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(MemberVaccineQuestionnaireRequest $request): JsonResponse { $response = $this->service->store($request); return response()->json($response->data, $response->code); } /** * @OA\Get( * path="/api/questionnaire/member-vaccine/{id}", * summary="Get a specific member vaccine questionnaire", * operationId="GetMemberVaccineQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Member vaccine Questionnaires"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the member vaccine 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 vaccine questionnaire not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Member vaccine 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-vaccine/{id}", * summary="Update a member vaccine questionnaire", * operationId="UpdateMemberVaccineQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Member vaccine Questionnaires"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the member vaccine questionnaire", * @OA\Schema(type="string") * ), * @OA\RequestBody( * required=true, * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * required={"member_family_id", "dt_dtpa", "hepatitis_a", "influenza", "covid_19", "triple_viral"}, * @OA\Property( * property="member_family_id", * type="string", * example="9b6e0239-a7b6-4ce8-a56c-da800fb28f70", * description="ID do membro da familia" * ), * @OA\Property( * property="dt_dtpa", * type="string", * example="2022-03-15", * description="Data da vacina DTPA" * ), * @OA\Property( * property="hepatitis_a", * type="boolean", * example=true, * description="Indica se foi vacinado para Hepatite A" * ), * @OA\Property( * property="influenza", * type="boolean", * example=false, * description="Indica se foi vacinado para Influenza" * ), * @OA\Property( * property="covid_19", * type="boolean", * example=true, * description="Indica se foi vacinado para COVID-19" * ), * @OA\Property( * property="triple_viral", * type="boolean", * example=true, * description="Indica se foi vacinado para TrÃplice Viral" * ) * ), * ), * ), * @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=401, * description="Unauthorized", * @OA\JsonContent( * @OA\Property(property="data", type="json", example="{}"), * @OA\Property(property="message", type="string", example="Unauthorized."), * ) * ), * ) */ public function update(MemberVaccineQuestionnaireRequest $request, string $id): JsonResponse { $response = $this->service->update($request, $id); return response()->json($response->data, $response->code); } /** * @OA\Delete( * path="/api/questionnaire/member-vaccine/{id}", * summary="Delete a member vaccine questionnaire", * operationId="DeleteMemberVaccineQuestionnaire", * security={{"bearerAuth":{}}}, * tags={"Member vaccine Questionnaires"}, * @OA\Parameter( * name="id", * in="path", * required=true, * description="ID of the member vaccine 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 vaccine questionnaire not found", * @OA\JsonContent( * @OA\Property(property="message", type="string", example="Member vaccine 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.03 |
proxy
|
phpinfo
|
Settings