Skip to content

Commit

Permalink
Merge pull request #119 from Thomas-More-Digital-Innovation/sva-vrage…
Browse files Browse the repository at this point in the history
…nlijst-actief

Sva vragenlijst actief
  • Loading branch information
SensvanAert authored Oct 26, 2023
2 parents 86b4c16 + 00a56f6 commit 99565ff
Show file tree
Hide file tree
Showing 2 changed files with 279 additions and 0 deletions.
275 changes: 275 additions & 0 deletions code/webapp/app/Http/Controllers/Api/QuestionListController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\StoreQuestionListRequest;
use App\Models\QuestionList;
use Illuminate\Http\Request;

/**
* @OA\Schema(
* schema="QuestionList",
* @OA\Property(
* property="id",
* type="integer",
* format="int64",
* example=1
* ),
* @OA\Property(
* property="questionList",
* type="string",
* example="QuestionList 1"
* ),
* @OA\Property(
* property="answer",
* type="string",
* example="Answer 1"
* ),
* @OA\Property(
* property="created_at",
* type="string",
* format="date-time",
* example="2021-05-01 12:00:00"
* ),
* @OA\Property(
* property="updated_at",
* type="string",
* format="date-time",
* example="2021-05-01 12:00:00"
* ),
* )
* @OA\Get(
* path="/api/questionLists",
* tags={"questionLists"},
* summary="Get list of questionLists",
* description="Returns list of questionLists",
* operationId="questionListsIndex",
* @OA\Parameter(
* name="Authorization",
* description="Bearer {token}",
* in="header",
* required=true,
* ),
* @OA\Response(
* response=200,
* description="successful operation",
* @OA\JsonContent(
* @OA\Property(
* property="status",
* type="boolean",
* example=true
* ),
* @OA\Property(
* property="questionLists",
* type="array",
* @OA\Items(ref="#/components/schemas/QuestionList")
* )
* )
* ),
* @OA\Response(
* response=401,
* description="Unauthorized",
* )
* )
* @OA\Post(
* path="/api/questionLists",
* tags={"questionLists"},
* summary="Create new questionList",
* description="Create new questionList",
* operationId="questionListsStore",
* @OA\Parameter(
* name="Authorization",
* description="Bearer {token}",
* in="header",
* required=true,
* ),
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(ref="#/components/schemas/QuestionList")
* ),
* @OA\Response(
* response=200,
* description="successful operation",
* @OA\JsonContent(
* @OA\Property(
* property="status",
* type="boolean",
* example=true
* ),
* @OA\Property(
* property="questionList",
* ref="#/components/schemas/QuestionList"
* )
* )
* ),
* @OA\Response(
* response=401,
* description="Unauthorized"
* ),
* )
* @OA\Patch(
* path="/api/questionLists/{id}",
* tags={"questionLists"},
* summary="Update QuestionList",
* description="Update QuestionList",
* operationId="questionListsUpdate",
* @OA\Parameter(
* name="Authorization",
* description="Bearer {token}",
* in="header",
* required=true,
* ),
* @OA\Parameter(
* name="id",
* description="QuestionList id",
* in="path",
* required=true,
* ),
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(ref="#/components/schemas/QuestionList")
* ),
* @OA\Response(
* response=200,
* description="successful operation",
* @OA\JsonContent(
* @OA\Property(
* property="status",
* type="boolean",
* example=true
* ),
* @OA\Property(
* property="questionList",
* ref="#/components/schemas/QuestionList"
* ),
* ),
* ),
* @OA\Response(
* response=401,
* description="Unauthorized"
* ),
* )
* @OA\Delete(
* path="/api/questionLists/{id}",
* tags={"questionLists"},
* summary="Delete question",
* description="Delete question",
* operationId="questionsDestroy",
* @OA\Parameter(
* name="Authorization",
* description="Bearer {token}",
* in="header",
* required=true,
* ),
* @OA\Parameter(
* name="id",
* description="Question id",
* in="path",
* required=true,
* ),
* @OA\Response(
* response=200,
* description="successful operation",
* @OA\JsonContent(
* @OA\Property(
* property="status",
* type="boolean",
* example=true
* ),
* @OA\Property(
* property="question",
* ref="#/components/schemas/Question"
* ),
* ),
* ),
* @OA\Response(
* response=401,
* description="Unauthorized"
* ),
* )
*/

class QuestionListController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$questionLists = QuestionList::all();

return response()->json([
"status" => true,
"questionLists" => [$questionLists],
]);
}

/**
* Display the specified resource.
*
* @param \App\Models\QuestionList $questionList
* @return \Illuminate\Http\Response
*/
public function show(QuestionList $questionList)
{
//
}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(StoreQuestionRequest $request)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param \App\Models\QuestionList $questionList
* @return \Illuminate\Http\Response
*/
public function edit(QuestionList $questionList)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\QuestionList $questionList
* @return \Illuminate\Http\Response
*/
public function update(StoreQuestionListRequest $request, QuestionList $questionList)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param \App\Models\QuestionList $questionList
* @return \Illuminate\Http\Response
*/
public function destroy(QuestionList $questionList)
{
//
}
}
4 changes: 4 additions & 0 deletions code/webapp/routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Http\Controllers\Api\SectionController;
use App\Http\Controllers\Api\RoleController;
use App\Http\Controllers\Api\QuestionController;
use App\Http\Controllers\Api\QuestionListController;
use App\Http\Controllers\Api\AnswerController;
use App\Http\Controllers\Api\UserController;
use App\Http\Controllers\Api\DepartmentListController;
Expand Down Expand Up @@ -45,6 +46,7 @@
"section" => SectionController::class,
"role" => RoleController::class,
"question" => QuestionController::class,
"questionList" => QuestionListController::class,
"treeParts" => TreePartController::class,
"answer" => AnswerController::class,
"users" => UserController::class,
Expand All @@ -57,6 +59,8 @@
Route::get("infoContent", [InfoContentController::class, "index"]);
Route::get("section", [SectionController::class, "index"]);
Route::get("treeParts", [TreePartController::class, "index"]);
Route::get("question", [QuestionController::class, "index"]);
Route::get("questionList", [QuestionListController::class, "index"]);

Route::post("/auth/register", [AuthController::class, "createUser"]);
Route::post("/auth/login", [AuthController::class, "loginUser"]);

0 comments on commit 99565ff

Please sign in to comment.