Skip to content

Enhancement : New Endpoint to Retrieve Combined Lost and Found Items#89

Open
harsh15044 wants to merge 3 commits into
LambdaIITH:developfrom
harsh15044:fix-issue-15
Open

Enhancement : New Endpoint to Retrieve Combined Lost and Found Items#89
harsh15044 wants to merge 3 commits into
LambdaIITH:developfrom
harsh15044:fix-issue-15

Conversation

@harsh15044

Copy link
Copy Markdown
Collaborator

Fixes #15

Added a new API endpoint /lost_found/all that returns both lost and found items in a single response, sorted based on creation time. It has an optional query parameter max_limit that controls the numbers of items returned.

@adhitht
adhitht requested a review from Copilot September 6, 2025 17:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new combined API endpoint that retrieves both lost and found items in a single response, sorted by creation time. This enhancement provides a unified view of all lost and found items for easier browsing.

  • Added /lost_found/all endpoint with optional max_limit query parameter
  • Implemented combined retrieval logic that merges lost and found items
  • Added sorting by creation time with newest items first

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
backend-go/internal/router/routes.go Added new route group and endpoint for combined lost/found items
backend-go/internal/controller/lost.go Implemented GetCombinedAllItemsHandler function with sorting and limit functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread backend-go/internal/controller/lost.go Outdated
Comment thread backend-go/internal/controller/lost.go Outdated
Comment thread backend-go/internal/controller/lost.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend-go/internal/controller/lost.go Outdated
Comment thread backend-go/internal/controller/lost.go Outdated
Comment on lines +144 to +146
if limitStr := c.Query("max_limit"); limitStr != "" {
if limit, err := strconv.Atoi(limitStr); err == nil {
maxLimit = limit

Copilot AI Jan 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing input validation for max_limit parameter. If a user provides a negative value or zero, the code will accept it and could produce unexpected results. Consider adding validation to ensure max_limit is positive, and potentially also adding an upper bound to prevent resource exhaustion from extremely large values.

Suggested change
if limitStr := c.Query("max_limit"); limitStr != "" {
if limit, err := strconv.Atoi(limitStr); err == nil {
maxLimit = limit
const maxAllowedLimit = 1000
if limitStr := c.Query("max_limit"); limitStr != "" {
if limit, err := strconv.Atoi(limitStr); err == nil {
if limit > 0 {
if limit > maxAllowedLimit {
maxLimit = maxAllowedLimit
} else {
maxLimit = limit
}
}

Copilot uses AI. Check for mistakes.
Comment thread backend-go/internal/router/routes.go Outdated
Comment thread backend-go/internal/controller/lost.go Outdated
Comment thread backend-go/internal/controller/lost.go Outdated
Comment thread backend-go/internal/controller/lost.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add New Endpoint to Retrieve Combined Lost and Found Items

2 participants