Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

  • Initial repository setup
  • Implement dynamic action buttons based on status
    • Update getActionButtons helper to show correct actions per status
    • Add Expired status support
    • Implement handleAction function with separate handler functions per action
    • Update status filter options (removed Closing, kept Expired)
    • Create Storybook stories for all status variants
    • Pass biome linting checks
  • Implement acceptReservationRequest functionality
    • Create update.ts application service (replaces separate accept.ts)
    • Add GraphQL mutation schema and resolver
    • Integrate mutation in UI container component
    • Implement handleAccept with error handling
    • Add loading state during mutation execution
    • Auto-refetch data after successful acceptance
  • Address code review critical issues
    • Remove dev-server.log and add *.log to .gitignore
    • Fix invalid seed data user IDs
    • Fix quote style violations (enforce single quotes)
    • Optimize accept.ts to eliminate double-fetch
    • Fix bracket notation in resolvers
  • Standardize state terminology across all layers
    • Align domain, persistence, GraphQL, and UI to use 'Requested' and 'Accepted'
    • Remove 'Pending' and 'Approved' terminology for consistency
    • Update seed data to use standardized states
    • Remove state-mappings.ts - states now match directly
    • Establish 1:1 state mapping between all layers
  • Address Sourcery AI code review feedback
    • Remove debug console.log calls from production code paths
    • Remove accidentally committed node_modules from service-twilio
    • Add clarifying comment explaining domain's state setter behavior
    • Implement separate handler functions for each action type
    • Remove unused sharerEmail field from ReservationRequestUpdateCommand
  • Address @jasonmorais final code review feedback
    • Remove archive feature (not in BRD/SRD spec)
    • Remove Closing status and duplicate message logic
    • Refactor to separate handler functions per action (handleAccept, handleReject, etc.)
    • Keep business logic in domain aggregate (state setter validates transitions)
    • Simplify read-repository hydration (remove excessive casting)
    • Fix test file typing without biome-ignore comments
    • Preserve resolver mapping for domain-to-UI transformation

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Summary by Sourcery

Add authenticated reservation request acceptance and overlapping request auto-rejection, expose it via GraphQL and wire it into the My Listings UI, while standardizing request states and improving data hydration and testing across layers.

New Features:

  • Introduce an update application service for reservation requests that supports accepting and closing flags, including overlap-aware auto-rejection logic.
  • Expose an acceptReservationRequest GraphQL mutation with authorization and listing ownership checks, and integrate it into the My Listings requests table UI with feedback and refetching.
  • Add My Listings dashboard wiring for authenticated sharers, including per-sharer requests count and sharer-scoped requests tab with dynamic action buttons.
  • Extend request listing GraphQL mapping to return real listing imagery and normalized request statuses, and support richer listing/request Storybook stories.

Bug Fixes:

  • Fix Mongo read repository population so populate operations run before lean and add missing reserver lookup in listing-requests-by-sharer aggregation to avoid hydration issues.
  • Correct mock data relationships for item listings and reservation requests to use valid sharer and reserver IDs, and adjust tests for resolver helper behaviors around invalid or non-ObjectId identifiers.
  • Ensure GraphQL server initialization tests assert depth-limit configuration more robustly without relying on specific function instances.

Enhancements:

  • Refine reservation request domain model to emit a ReservationRequestAcceptedEvent when a request is accepted, wiring through a new domain event type export.
  • Improve reservation request read and domain repositories with overlap query support and simplified hydration for listing and reserver relations.
  • Standardize reservation request status terminology (e.g., Requested vs Pending, Expired support) across UI helpers, filters, seed data, and Storybook stories, and add unit tests for status/action helpers.
  • Polish My Listings UI components with sharer-scoped data loading, safer error logging, improved button text and Ant Design App context usage, plus small code style and type tweaks across UI and GraphQL tests.

CI:

  • Relax exact depthLimit validation in GraphQL handler tests to assert on structure rather than specific function instances, keeping CI resilient to implementation changes.

Documentation:

  • Document reservation request update and acceptance behavior through new BDD-style .feature files for both application service and GraphQL resolver layers.

Tests:

  • Add cucumber-style tests for the reservation request update application service, including acceptance, close flags, overlap auto-rejection, and error cases.
  • Extend reservation request GraphQL resolver tests to cover acceptReservationRequest mutation behaviors and add feature definitions for these scenarios.
  • Add unit tests for request status helper functions and additional scenarios in resolver-helper and tracing tests to verify fallback and tracing behaviors.
  • Update Storybook stories and Apollo mocks for profile, requests card, and requests table to use the new schemas and status variants, and verify My Listings data flows.

Copilot AI changed the title [WIP] Refactor import formatting in listing information component Initial repository setup with listing information component Nov 5, 2025
Copilot AI requested a review from dani-vaibhav November 5, 2025 12:14
@dani-vaibhav
Copy link

@copilot
@copilot /plan
@copilot /suggest
Implement the logic for handleAction function based on the following actions

  • Update UI (My Listings → Requests) to show dynamic actions based on status:
    • Pending → Accept / Reject
    • Accepted → Close / Message
    • Rejected → Delete / Archive
    • Expired → Archive

…tatus

- Update action buttons to match status requirements:
  - Pending → Accept / Reject
  - Accepted → Close / Message
  - Rejected → Delete / Archive
  - Expired → Archive
  - Closed → Message
  - Cancelled → Delete
- Implement handleAction function with switch statement for each action
- Add Expired status to filter options and status tag styling
- Update Storybook stories to demonstrate all status variants
- Reorganize getActionButtons helper for clarity with inline comments

Co-authored-by: dani-vaibhav <182140623+dani-vaibhav@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 5, 2025

@copilot
@copilot /plan
@copilot /suggest
...

Implemented dynamic action buttons based on reservation request status in commit 815cd1f.

Changes made:

Status → Actions mapping:

  • Pending → Accept / Reject
  • Accepted → Close / Message
  • Rejected → Delete / Archive
  • Expired → Archive
  • Closed → Message
  • Cancelled → Delete

Implementation details:

  1. Updated getActionButtons helper in requests-status-helpers.tsx with clear status-based logic and inline comments
  2. Implemented handleAction function in requests-table.container.tsx with switch statement for each action (accept, reject, close, message, delete, archive)
  3. Added "Expired" status to filter options and status tag styling
  4. Created Storybook stories demonstrating all status variants (Pending, Accepted, Rejected, Closed, Expired)

The UI now dynamically displays the appropriate action buttons based on the current status of each reservation request. The handleAction function is ready for future integration with GraphQL mutations.

Copilot AI changed the title Initial repository setup with listing information component Initial repository setup with listing information and dynamic reservation request actions Nov 5, 2025
@dani-vaibhav
Copy link

@copilot
@workspace /fix Implement acceptReservationRequest and implement the logic for the case 'accept'

- Create accept.ts application service for accepting reservation requests
- Add acceptReservationRequest GraphQL mutation with input type
- Implement mutation resolver with authentication check
- Add GraphQL mutation to requests-table.container.graphql
- Integrate useMutation hook in RequestsTableContainer
- Implement handleAction 'accept' case with mutation call and refetch
- Add loading state for accept action
- Export accept service from reservation-request index
- Pass biome linting checks

Co-authored-by: dani-vaibhav <182140623+dani-vaibhav@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 5, 2025

@copilot
@workspace /fix Implement acceptReservationRequest and implement the logic for the case 'accept'

Implemented acceptReservationRequest mutation and integrated it with the UI in commit 8eba1a5.

Implementation details:

1. Application Service Layer (accept.ts):

  • Created ReservationRequestAcceptCommand interface with id and sharerEmail
  • Implemented accept() service that:
    • Validates reservation request exists
    • Verifies sharer owns the listing
    • Calls domain state = 'Accepted' to trigger acceptance logic
    • Persists changes via Unit of Work transaction

2. GraphQL Layer:

  • Added acceptReservationRequest mutation to schema with AcceptReservationRequestInput
  • Implemented resolver with authentication check using verifiedJwt.email
  • Returns updated ReservationRequest with new state

3. UI Layer (requests-table.container.tsx):

  • Added useMutation hook for acceptReservationRequest
  • Implemented handleAction 'accept' case:
    • Calls mutation with request ID
    • Auto-refetches list to show updated status
    • Includes error handling with console logging
    • Shows loading state during mutation execution

The accept button now fully functions - when clicked on a Pending request, it accepts the reservation and updates the status to Accepted in real-time.

Copilot AI changed the title Initial repository setup with listing information and dynamic reservation request actions Initial repository setup with listing information and reservation request accept functionality Nov 5, 2025
@dani-vaibhav
Copy link

@copilot
Deploy this branch

Copy link
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot
Deploy this branch

I don't have the ability to deploy branches or trigger deployment pipelines. Deployment typically requires access to CI/CD systems, cloud infrastructure, and production credentials that I don't have.

To deploy this branch, you'll need to:

  1. Merge this PR to your main/deployment branch, or
  2. Manually trigger your CI/CD pipeline for this branch, or
  3. Use your deployment tooling (e.g., Azure DevOps, GitHub Actions, etc.)

If you need help with code changes, configuration files, or deployment scripts that I can assist with, please let me know the specific changes needed.

@dani-vaibhav dani-vaibhav marked this pull request as ready for review November 7, 2025 19:39
@dani-vaibhav dani-vaibhav marked this pull request as ready for review December 17, 2025 15:22
@dani-vaibhav dani-vaibhav requested review from jasonmorais and removed request for dani-vaibhav December 17, 2025 15:22
Copy link
Contributor

@jasonmorais jasonmorais left a comment

Choose a reason for hiding this comment

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

Some of my previous comments were not addressed along with some other ones i now have added. I tried to give more context in those. If the feedback is confusing please let me know and il explain in more detail.

@dani-vaibhav
Copy link

@copilot
@copilot /implement

In:
apps/ui-sharethrift/src/components/layouts/home/my-listings/components/requests-table.container.tsx

Make the following changes:

  • Remove any conditional early returns or branching related to loading state or alternate data shapes
  • Do NOT return two different versions of data from this container
  • Assume loading and error handling is already handled by the component query loader
  • Always pass a single, consistent data shape to RequestsTable

Constraints:

  • Do not add new loaders or error UI
  • Do not change behavior beyond removing the redundant branching
  • Keep the existing data source and props intact

After completing the change:

  • Push a commit
  • Resolve this review thread

…er branching

- Inline getStatusTagClass and getActionButtons logic directly into requests-table.tsx and requests-card.tsx
- Remove unnecessary helper function abstractions that were only used twice
- Keep logic simple and explicit without introducing new abstractions
- Remove conditional branching in my-listings-dashboard.container.tsx
- Consolidate loading states and ensure consistent data shape for RequestsTable
- All behavior and UI output preserved exactly as before
- Remove centralized handleAction switch statement from container
- Replace onAction callback with individual action handlers
- Update RequestsTable and RequestsCard to accept specific handlers
- Fix storybook stories to use new handler props
- Prefix unused parameters with underscore per TypeScript convention

This eliminates unnecessary indirection and makes action handling
explicit and easier to follow.
- Remove explicit error logging and early return
- ComponentQueryLoader already handles error state
- Eliminate unnecessary conditional rendering
- Simplify container logic per review feedback
- Remove isAccepting flag derived from command
- Check updatedReservationRequest.state directly after state transition
- Load listing ID only when needed (after confirming ACCEPTED_STATE)
- Simplify conditional logic while preserving all behavior
- All existing tests continue to pass
Addresses PR review comment #discussion_r2627830276:
- Remove complex mapAggregateResultsToDomain helper method
- Replace aggregation pipeline with simple two-step query
- Use standard queryMany pattern for consistent .map(toDomain) conversion

Changes in reservation-request.read-repository.ts:
- Refactored getListingRequestsBySharerId method
- Removed 82-line mapAggregateResultsToDomain private helper
- Removed AggregateResult type definition
- Removed MongoDB aggregation with $lookup/$unwind
- Now queries listings first, then filters requests by listing IDs
- Uses queryMany helper for standard domain conversion
- Removed unused PipelineStage import

Changes in reservation-request.read-repository.test.ts:
- Added select() method to mock query chain
- Added find() method to mockListingModel for new query pattern
- All 59 tests passing

Result: 87 lines removed, simpler and more maintainable code
Pattern: Repository now consistently uses .map(toDomain) across all methods
Updates UI components to work with simplified myListingsRequests resolver
that returns plain arrays instead of paginated results.

GraphQL Query Changes:
- Removed pagination arguments (page, pageSize, searchText, sorter, statusFilters)
- Updated fragment to query actual ReservationRequest domain fields
- Fixed fragment type from ListingRequest to ReservationRequest
- Added inline fragment for PersonalUser union type
- Query now returns [ReservationRequest!]! instead of paginated result

React Component Changes:
- Implemented client-side pagination, filtering, and sorting
- Transform domain fields (state, reservationPeriodStart/End, listing.title, reserver.account.profile) to UI format
- Calculate total count from array length instead of pagination.total
- Filter and sort data in memory before displaying

Files Modified:
- my-listings-dashboard.container.graphql: Simplified count query
- requests-table.container.graphql: Removed pagination args, updated fragment fields
- my-listings-dashboard.container.tsx: Use array length for count
- requests-table.container.tsx: Client-side pagination/filtering/sorting logic

Result: UI now handles data presentation concerns while GraphQL returns raw domain data
@jasonmorais jasonmorais marked this pull request as draft December 18, 2025 20:21
Fixes TypeScript build error TS6133: 'useNavigate' is declared but its value is never read.

The import was added but not used in the component, causing the strict TypeScript build to fail in CI/CD.
@dani-vaibhav dani-vaibhav marked this pull request as ready for review December 22, 2025 16:30
Copy link
Contributor

@jasonmorais jasonmorais left a comment

Choose a reason for hiding this comment

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

Small comments for the most part

id: string;
state?: string;
closeRequestedBySharer?: boolean;
closeRequestedByReserver?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

This parameter could be a single field, if you know one if false you know the other is true, so both arent needed.

),
render: (status: string) => {
let statusClass = '';
switch (status) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could just be an object map object that we access with the states as keys, like statesMapped = {'Accepted': 'requestAcceptedTag'}

width: 200,
render: (_: unknown, record: ListingRequestData) => {
let actions: string[] = [];
switch (record.status) {
Copy link
Contributor

Choose a reason for hiding this comment

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

multiple actions in switch have no functionality linked to it

onAccept={async (requestId: string) => {
await acceptRequest({ variables: { input: { id: requestId } } });
}}
onReject={(_requestId: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it cause a compile issue to have each handler function made not inline with the same log, that we fully implement later? would prefer it that way to not flood the component props area

let filteredRequests = allRequests;

// Apply search filter
if (searchText) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The filtering i think can be handled by the table itself, and search should be backend. Filtering can also be handled backend, but thats less set in stone. I see both were reverted from that for some reason.

onMessage,
}) => {
let statusClass = '';
switch (listing.status) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same idea here as the previous comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

File is very large, i would see if there is a way to extract any components out into another file, or atleast break up the giant single table component somehow in this file. hard to read currently.

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.

Reservation Request - Accept Request

5 participants