Commit 2d50f56f authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

Fix api doc generation

parent 77df5f2e
......@@ -58,9 +58,7 @@ class DoorsController extends ApiController
$getDoors->query($this->request->input('query'), $presenter);
return $this->respondWithData($presenter->getViewModel([
'query' => $this->request->input('query'),
]));
return $this->respondWithData($presenter->getViewModel($this->request->all()));
}
/**
......
......@@ -57,11 +57,6 @@ class EntriesController extends ApiController
$presenter
);
return $this->respondWithData($presenter->getViewModel([
'start' => $this->request->input('start'),
'end' => $this->request->input('end'),
'door_id' => $this->request->input('door_id'),
'user_id' => $this->request->input('user_id'),
]));
return $this->respondWithData($presenter->getViewModel($this->request->all()));
}
}
......@@ -119,9 +119,7 @@ class GroupsController extends ApiController
$useCase->search($this->request->input('query'), $presenter);
return $this->respondWithData($presenter->getViewModel([
'query' => $this->request->input('query'),
]));
return $this->respondWithData($presenter->getViewModel($this->request->all()));
}
/**
......
......@@ -169,9 +169,9 @@ class MeController extends ApiController
* overrides, and special exclusion rules.
*
* @authenticated
* @urlParam door_id required The door to see events for. Example: 1
* @urlParam start required The start date to view events for. Example: 2020-04-03 12:43:22
* @urlParam end required The end date to see events for. Example: 2020-04-04 12:43:22
* @queryParam door_id required The door to see events for. Example: 1
* @queryParam start required The start date to view events for. Example: 2020-04-03 12:43:22
* @queryParam end required The end date to see events for. Example: 2020-04-05 12:43:22
* @param \Source\UseCases\Door\ScheduleEvents\ScheduleEvents $scheduleEvents
* @return \Illuminate\Http\JsonResponse
* @throws \Illuminate\Validation\ValidationException
......@@ -238,8 +238,8 @@ class MeController extends ApiController
* @authenticated
* @paginated
* @queryParam query The query to search for. Example: CSP313
* @queryParam resolved Whether the request is marked as resolved or not. Example: false
* @queryParam replied Whether the request has been replied to or not. Example: false
* @queryParam resolved Whether the request is marked as resolved or not. Example: 0
* @queryParam replied Whether the request has been replied to or not. Example: 0
*
* @param \Source\UseCases\Requests\GetRequests\GetRequestsUseCase $getRequestsUseCase
* @return \Illuminate\Http\JsonResponse
......
......@@ -169,11 +169,6 @@ class OverridesController extends ApiController
$presenter
);
return $this->respondWithData($presenter->getViewModel([
'start' => $this->request->input('start'),
'end' => $this->request->input('end'),
'door_id' => $this->request->input('door_id'),
'user_id' => $this->request->input('user_id'),
]));
return $this->respondWithData($presenter->getViewModel($this->request->all()));
}
}
......@@ -23,7 +23,7 @@ class RequestsController extends ApiController
*
* @authenticated
* @urlParam requestId required The id of the request to modify. Example 1
* @bodyParam resolved string Whether the access request should be resolved or not.
* @bodyParam resolved string Whether the access request should be resolved or not. Example: 0
*
* @param string $requestId
* @param \Source\UseCases\Requests\InteractWithRequest\InteractWithRequestUseCase $interactWithRequestUseCase
......@@ -67,7 +67,7 @@ class RequestsController extends ApiController
$presenter = new ApiPresenter();
$interactWithRequestUseCase->reply($requestId, $this->request->boolean('resolved'), $presenter);
$interactWithRequestUseCase->reply($requestId, $this->request->input('reply'), $presenter);
return new JsonResponse($presenter->getViewModel());
}
......@@ -80,8 +80,8 @@ class RequestsController extends ApiController
* @authenticated
* @paginated
* @queryParam query The query to search for. Example: CSP313
* @queryParam resolved Whether the request is marked as resolved or not. Example: false
* @queryParam replied Whether the request has been replied to or not. Example: false
* @queryParam resolved Whether the request is marked as resolved or not. Example: 0
* @queryParam replied Whether the request has been replied to or not. Example: 0
* @queryParam user_id The user id to filter requests for. Example: 1
*
* @param \Source\UseCases\Requests\GetRequests\GetRequestsUseCase $requestsUseCase
......
......@@ -5,9 +5,9 @@ namespace App\Http\Controllers\Api;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Source\Authorization\Permissions;
use Source\UseCases\Door\ScheduleEvents\ScheduleEvents;
use Source\UseCases\Door\ScheduleEvents\EventsPresenter;
use Source\UseCases\Schedules\ScheduleGet\ScheduleGetUseCase;
use Source\UseCases\Door\ScheduleEvents\ScheduleEventsUseCase;
use Source\UseCases\Schedules\SchedulesGet\SchedulesGetUseCase;
use Source\UseCases\Schedules\APIPresenter as ScheduleApiPresenter;
use Source\UseCases\Schedules\ScheduleCreate\ScheduleCreateUseCase;
......@@ -134,12 +134,7 @@ class SchedulesController extends ApiController
$presenter
);
return $this->respondWithData($presenter->getViewModel([
'group_id' => $this->request->input('group_id'),
'type' => $this->request->input('type'),
'start' => $this->request->input('start'),
'end' => $this->request->input('end'),
]));
return $this->respondWithData($presenter->getViewModel($this->request->all()));
}
/**
......@@ -192,19 +187,18 @@ class SchedulesController extends ApiController
* overrides and special exclusion rules. In other words, this is what the doors actually do.
*
* @authenticated
* @urlParam door_id required The door to see events for. Example: 1
* @urlParam user_id The user to see access schedules for. Example: 2
* @urlParam start required The start date to view events for. Example: 2020-04-03 12:43:22
* @urlParam end required The end date to see events for. Example: 2020-04-04 12:43:22
* @queryParam door_id required The door to see events for. Example: 1
* @queryParam user_id The user to see access schedules for. Example: 2
* @queryParam start required The start date to view events for. Example: 2020-04-03 12:43:22
* @queryParam end required The end date to see events for. Example: 2020-04-05 12:43:22
*
* @param \Source\UseCases\Door\ScheduleEvents\ScheduleEvents $scheduleEvents
* @param \Source\UseCases\Door\ScheduleEvents\ScheduleEventsUseCase $scheduleEvents
* @return \Illuminate\Http\JsonResponse
* @throws \Illuminate\Validation\ValidationException
* @throws \Source\Exceptions\AuthorizationException
* @throws \Source\Exceptions\EntityNotFoundException
* @throws \Exception
*/
public function events(ScheduleEvents $scheduleEvents): JsonResponse
public function events(ScheduleEventsUseCase $scheduleEvents): JsonResponse
{
$this->authorizer->protectOne([Permissions::MANAGE_DOORS, Permissions::MANAGE_USERS, Permissions::LOGS_READ]);
......
......@@ -58,10 +58,7 @@ class TokensController extends ApiController
$presenter
);
return $this->respondWithData($presenter->getViewModel([
'user_id' => $this->request->input('user_id'),
'valid_at' => $this->request->input('valid_at'),
]));
return $this->respondWithData($presenter->getViewModel($this->request->all()));
}
/**
......
......@@ -60,9 +60,7 @@ class UsersController extends ApiController
$getAllUsers->search($this->request->input('query'), $presenter);
return $this->respondWithData($presenter->getViewModel([
'query' => $this->request->input('query'),
]));
return $this->respondWithData($presenter->getViewModel($this->request->all()));
}
/**
......
......@@ -79,8 +79,8 @@ Route::group(['middleware' => 'auth:api'], static function () {
], static function () {
Route::get('/', [SchedulesController::class, 'index'])->name('schedules.index');
Route::post('/', [SchedulesController::class, 'create'])->name('schedules.create');
Route::get('{scheduleId}', [SchedulesController::class, 'get'])->name('schedules.get');
Route::get('/events', [SchedulesController::class, 'events'])->name('schedules.events');
Route::get('{scheduleId}', [SchedulesController::class, 'get'])->name('schedules.get');
Route::patch('{scheduleId}', [SchedulesController::class, 'update'])->name('schedules.update');
});
......@@ -109,7 +109,7 @@ Route::group(['middleware' => 'auth:api'], static function () {
Route::group([
'prefix' => 'requests',
], static function () {
Route::post('{requestId}//resolve', [RequestsController::class, 'resolve'])->name('requests.resolve');
Route::post('{requestId}/resolve', [RequestsController::class, 'resolve'])->name('requests.resolve');
Route::post('{requestId}/reply', [RequestsController::class, 'reply'])->name('requests.reply');
Route::get('/', [RequestsController::class, 'index'])->name('requests.index');
});
......
......@@ -14,24 +14,25 @@ class LocalSchedulesRepository extends InMemorySchedulesRepository
*/
public function __construct()
{
$now = new Carbon('2020-01-05');
$this->create(new Schedule(
1,
LocalGroupsRepository::getEngineeringLabAccessGroup()->getId(),
Schedule::TYPE_USER_ACCESS,
'RRULE:FREQ=HOURLY;INTERVAL=10',
"DTSTART;TZID=America/Los_Angeles:20200105T000000\nRRULE:FREQ=HOURLY;INTERVAL=10",
60,
'Engineering lab user access schedule, every other minute for a minute',
Carbon::now()
$now
));
$this->create(new Schedule(
2,
LocalGroupsRepository::getComputerScienceMajorGroup()->getId(),
Schedule::TYPE_OPEN_MODE,
'RRULE:FREQ=MINUTELY;INTERVAL=50',
"DTSTART;TZID=America/Los_Angeles:20200105T000000\nRRULE:FREQ=MINUTELY;INTERVAL=50",
60 * 10,
'Computer science lab open mode schedule, every 20 minutes for 10 minutes',
Carbon::now()
$now
));
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment