-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding the endpoint to filter by month and week #31
base: master
Are you sure you want to change the base?
Conversation
Task linked: CU-20y76fa Add filters to Petitions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job man! Just left you a little comment
routes/api.php
Outdated
Route::get('/petitions/filter-month', [PetitionController::class, 'filterByMonth']); | ||
Route::get('/petitions/filter-week', [PetitionController::class, 'filterByWeek']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be all at the same endpoint, like:
/petitions?time="week"
or
/petitions?time="month"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Route::get('/petitions', [PetitionController::class, 'index']); | ||
Route::get('/petitions/filter', [PetitionController::class, 'filter']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This filter stuff should be done at the endpoint /petitions
and the params should be time_period
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if ($time_period === "week") { | ||
$byweek = Petition::whereBetween('created_at', [Carbon::now()->startOfWeek(), Carbon::now()->endOfWeek()])->get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing pagination on this responses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ODYWBDAIWBTOTKY
… into CU-20y76fa
About
Filtering by month and week.