Skip to content

Conversation

@smarcet
Copy link
Collaborator

@smarcet smarcet commented Oct 7, 2025

ref : https://app.clickup.com/t/86b6z7ema
GET api/v1/summits/{id}/orders/me

  • tickets_owner_email
  • tickets_number

GET api/v1/summits/{id}/orders/all/tickets/me

  • order_number
  • number
  • order_owner_email

GET api/v1/summits/all/orders/{order_id}/tickets

  • number
  • owner_email

@smarcet smarcet requested a review from Copilot October 7, 2025 17:06
Copy link
Contributor

Copilot AI left a comment

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 new filter capabilities to the orders and tickets endpoints to enhance search functionality. The implementation adds support for filtering by ticket owner email, ticket numbers, order numbers, and order owner email across multiple API endpoints.

  • Added filter mappings for tickets_owner_email and tickets_number in the order repository
  • Enhanced ticket repository with order_owner_email filter support
  • Extended API controllers to support new filter parameters with proper validation

Reviewed Changes

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

File Description
app/Repositories/Summit/DoctrineSummitOrderRepository.php Added filter mappings for tickets_owner_email and tickets_number using EXISTS subqueries
app/Repositories/Summit/DoctrineSummitAttendeeTicketRepository.php Added order_owner_email filter mapping and updated alias requirements
app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTicketApiController.php Added '@@' operator support for number and order_number filters
app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrdersApiController.php Added new filter parameters with validation for tickets_number, tickets_owner_email, number, and owner_email

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

JOIN to1:i.owner to1_o:i
LEFT JOIN to1_o:i.member to1_o_m:i
WHERE to1:i.order = e AND COALESCE(LOWER(to1_o:i.email), LOWER(to1_o_m:i.email)) :operator :value )',SummitAttendeeTicket::class),
'tickets_number' => sprintf('EXISTS ( SELECT 1 FROM %s to1:i where to1:i.order = e )',SummitAttendeeTicket::class),
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

The tickets_number filter is incomplete. It only checks for existence of tickets but doesn't filter by the actual ticket number. The WHERE clause should include a condition to match the ticket number against the filter value, similar to how tickets_owner_email is implemented.

Suggested change
'tickets_number' => sprintf('EXISTS ( SELECT 1 FROM %s to1:i where to1:i.order = e )',SummitAttendeeTicket::class),
'tickets_number' => sprintf('EXISTS ( SELECT 1 FROM %s to1:i WHERE to1:i.order = e AND to1:i.number :operator :value )',SummitAttendeeTicket::class),

Copilot uses AI. Check for mistakes.
Comment on lines 76 to 79
'tickets_owner_email' => sprintf('EXISTS ( SELECT 1 FROM %s to1:i
JOIN to1:i.owner to1_o:i
LEFT JOIN to1_o:i.member to1_o_m:i
WHERE to1:i.order = e AND COALESCE(LOWER(to1_o:i.email), LOWER(to1_o_m:i.email)) :operator :value )',SummitAttendeeTicket::class),
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

[nitpick] The query spans multiple lines but lacks proper indentation and formatting consistency. Consider reformatting for better readability, especially aligning the JOIN clauses and WHERE conditions.

Suggested change
'tickets_owner_email' => sprintf('EXISTS ( SELECT 1 FROM %s to1:i
JOIN to1:i.owner to1_o:i
LEFT JOIN to1_o:i.member to1_o_m:i
WHERE to1:i.order = e AND COALESCE(LOWER(to1_o:i.email), LOWER(to1_o_m:i.email)) :operator :value )',SummitAttendeeTicket::class),
'tickets_owner_email' => sprintf(
'EXISTS (
SELECT 1 FROM %s to1:i
JOIN to1:i.owner to1_o:i
LEFT JOIN to1_o:i.member to1_o_m:i
WHERE to1:i.order = e
AND COALESCE(LOWER(to1_o:i.email), LOWER(to1_o_m:i.email)) :operator :value
)',
SummitAttendeeTicket::class
),

Copilot uses AI. Check for mistakes.
GET   api/v1/summits/{id}/orders/me
* tickets_owner_email
* tickets_number

GET api/v1/summits/{id}/orders/all/tickets/me
* order_number
* number
* order_owner_email

GET  api/v1/summits/all/orders/{order_id}/tickets
* number
* owner_email
@smarcet smarcet force-pushed the feature/orders-tickets-endpoint-new-filters branch from 19a752f to 60c2879 Compare October 9, 2025 17:20
@smarcet smarcet force-pushed the feature/orders-tickets-endpoint-new-filters branch from 2bed1f0 to 412e652 Compare October 9, 2025 18:16
@smarcet smarcet merged commit 222b139 into main Oct 9, 2025
3 checks passed
smarcet added a commit that referenced this pull request Oct 11, 2025
* feat: add new filters to orders/tickets endpoints

GET   api/v1/summits/{id}/orders/me
* tickets_owner_email
* tickets_number

GET api/v1/summits/{id}/orders/all/tickets/me
* order_number
* number
* order_owner_email

GET  api/v1/summits/all/orders/{order_id}/tickets
* number
* owner_email

* fix: add missing filter order_owner_email

* fix: query missing class

* chore: fix filter
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.

2 participants