W05 Assignment: Pagination and Searching
Overview
- Purpose: Demonstrate your knowledge of this week's concepts.
- Task: Complete one required feature set and submit the required deliverables.
This week, your team will improve the Kizuna Rail API by adding pagination, searching, filtering, and sorting to selected list endpoints.
Each person must complete two pull requests that are for the same feature set. The first pull request will add pagination. The second pull request will build on that work by adding searching, filtering, querying, or sorting for that same route.
Your pull requests for this assignment will be reviewed by teammates at the beginning of Week 06.
Select One Route or Feature
Coordinate with your team so each person has responsibility for a different route or feature. Feel free to help one another as needed. For your selected feature set, create two related GitHub issues and two related pull requests.
Feature Set Options
Feature Set 1: Trip List
Add paging and filtering capabilities to the trip list EJS page (/trips). The list should be populated and updated by client-side JavaScript that calls the /api/trips web service.
- Pull Request 1: Add paginated trip list so clients can request trips in smaller result sets. Update the page to display the pagination controls and step through the results 10 at a time.
- Pull Request 2: Add the ability to filter by Region or Season, using the existing dropdown menus. Also add keyword search that looks for any match in the trip descriptions or names. The results should be displayed in a paginated format.
Feature Set 2: User Admin
Add paging and filtering capabilities to the user admin EJS page (/users). The list should be populated and updated by client-side JavaScript that calls the /api/users web service.
- Pull Request 1: Add a paginated user list so clients can request users in smaller result sets. Update the page to display the pagination controls and step through the results 10 at a time. By default, the list should be sorted by username.
- Pull Request 2: Add a role filter and keyword search for user display names, usernames, or email addresses. The results should be displayed in a paginated format.
Feature Set 3: Booking Admin
Add paging and filtering capabilities to the booking admin EJS page (/bookings). The list should be populated and updated by client-side JavaScript that calls the /api/bookings web service.
- Pull Request 1: Add a paginated booking list so clients can request bookings in smaller result sets. Update the page to display the pagination controls and step through the results 10 at a time. By default, the list should be sorted by booking date.
- Pull Request 2: Add filtering by ticket class and booking date range. The results should be displayed in a paginated format.
Feature Set 4: Trains
Add paging and querying capabilities to the trains EJS page (/trains). The list should be populated and updated by client-side JavaScript that calls the /api/trains web service.
- Pull Request 1: Add a paginated train list so clients can request trains in smaller result sets. Update the page to display the pagination controls and step through the results 10 at a time.
- Pull Request 2: Add keyword search, filtering, or sorting that matches the train data and is useful to people using the page. The results should be displayed in a paginated format.
Feature Set 5: Trips Admin
Add paging and filtering capabilities to the trips admin EJS page (/trips-admin). The list should be populated and updated by client-side JavaScript that calls the /api/trips web service.
This feature set is closely integrated with Feature Set 1 because both use /api/trips. If you choose this feature set, coordinate with the person working on the /trips page before changing the shared API.
- Pull Request 1: Add a paginated trips admin list so clients can request trips in smaller result sets. Update the page to display the pagination controls and step through the results 10 at a time.
- Pull Request 2: Add filtering by Region or Season and keyword search for trip names or descriptions. The results should be displayed in a paginated format. Coordinate with the Feature Set 1 owner so the shared API behavior supports both pages.
Pull Request Workflow
For each of your two pull requests, use the same process you have practiced in earlier assignments.
Determine the spec
Decide exactly what the feature should do, including the route, query parameters, expected response shape, validation behavior, and Swagger documentation that will be needed.
Metadata in Results
For each API response that involves search, filtering, or pagination, make sure the response includes metadata about the query results, such as the search filters, the total number of items, the current page, and the number of items per page.
Create the plan
Create any GitHub issues needed for the work before you begin coding. The issue should describe the feature clearly enough that a teammate could understand what problem you are solving and how you plan to solve it.
Every pull request must have at least one related GitHub issue.
Implement the plan
Create a separate branch for the issue, implement the planned changes, test the feature, run the ESLint check and correct any reported errors, and then make sure the code is ready for teammate review.
Using AI while coding
You are welcome to use AI to help write code, but you should understand every line of code you submit clearly enough to explain to someone else why it is there and what it is doing. If you do not understand something, ask AI follow-up questions until you do.
Create a walk-through video
Record a short video that helps your reviewer understand what changed and why it was built that way.
Each video should be about 2 minutes long and no longer than 3 minutes.
- Explain the feature.
- Demonstrate the feature working.
- Show the code that makes the feature work and explain what each section of the code does.
- Discuss at least two decisions that needed to be made when the code was written. For each decision, identify the alternative choices and explain why you selected the approach you used.
Explain your understanding
Your explanation should help your teammates understand what the code does and why it is there.
In order to receive credit for this assignment, the video must clearly demonstrate that you understand the concepts and the code. If it does not, you will need to create a new video and resubmit.
Create the pull request
Create the pull request, reference the related GitHub issue, include a link to your walk-through video, and share the pull request in your Microsoft Teams channel when it is ready for review.
Requirements
Each feature must include the following:
- A GitHub issue with clear documentation of the spec and testing criteria.
- An API response that includes the results as well as metadata for the pagination or query that was run.
- Validation and error handling for pagination, sort, filter, and query parameters.
- Updated Swagger documentation for the route.
- A walk-through video that demonstrates the feature and explains the code and decisions made.
- A pull request that references the related GitHub issue and includes a link to the walk-through video.
Reflection
After both pull requests are complete, create a reflection document that describes your pagination and query work. Your reflection should include links to both pull requests you submitted for your selected route or feature.
Do not use AI for this reflection
The purpose of this document is to help you reflect on your own work and describe the choices you made. This reflection should be written in your own words.
Create your reflection document as follows:
- Download the Week 05 reflection template.
- Open the template in VS Code.
- Answer each question in your own words.
- Make sure the document includes links to both pull requests you submitted.
- Save the completed document as a
.txtor.mdfile to upload to Canvas.
Submission
Return to Canvas to upload your completed reflection document.
Other Links:
- Return to: Week Overview | Course Home