-
Notifications
You must be signed in to change notification settings - Fork 0
Initial repository setup with listing information and reservation request accept functionality #258
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
base: main
Are you sure you want to change the base?
Conversation
…in listing-information component
…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>
|
Implemented dynamic action buttons based on reservation request status in commit 815cd1f. Changes made: Status → Actions mapping:
Implementation details:
The UI now dynamically displays the appropriate action buttons based on the current status of each reservation request. The |
|
@copilot |
- 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>
Implemented Implementation details: 1. Application Service Layer (
2. GraphQL Layer:
3. UI Layer (
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. |
…p and improved data handling
…gs and error handling
…nd improve image handling in reservation requests
|
@copilot |
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:
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. |
…ng for reservation requests
… available port and improve error handling
…ove error handling in update process
…e directly and improve error handling for listing retrieval
jasonmorais
left a comment
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.
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.
...hrift/src/components/layouts/home/my-listings/components/my-listings-dashboard.container.tsx
Outdated
Show resolved
Hide resolved
...i-sharethrift/src/components/layouts/home/my-listings/components/requests-status-helpers.tsx
Show resolved
Hide resolved
...-sharethrift/src/components/layouts/home/my-listings/components/requests-table.container.tsx
Outdated
Show resolved
Hide resolved
...-sharethrift/src/components/layouts/home/my-listings/components/requests-table.container.tsx
Outdated
Show resolved
Hide resolved
.../sthrift/application-services/src/contexts/reservation-request/reservation-request/update.ts
Outdated
Show resolved
Hide resolved
packages/sthrift/graphql/src/schema/types/reservation-request/reservation-request.resolvers.ts
Outdated
Show resolved
Hide resolved
packages/sthrift/graphql/src/schema/types/reservation-request/reservation-request.resolvers.ts
Outdated
Show resolved
Hide resolved
...sources/domain/reservation-request/reservation-request/reservation-request.domain-adapter.ts
Show resolved
Hide resolved
packages/sthrift/persistence/src/datasources/readonly/mongo-data-source.ts
Outdated
Show resolved
Hide resolved
...rces/readonly/reservation-request/reservation-request/reservation-request.read-repository.ts
Outdated
Show resolved
Hide resolved
|
In: Make the following changes:
Constraints:
After completing the change:
|
…ment in MyListingsDashboardContainer
…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
…d filtering logic
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
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.
jasonmorais
left a comment
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.
Small comments for the most part
| id: string; | ||
| state?: string; | ||
| closeRequestedBySharer?: boolean; | ||
| closeRequestedByReserver?: boolean; |
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 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) { |
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 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) { |
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.
multiple actions in switch have no functionality linked to it
| onAccept={async (requestId: string) => { | ||
| await acceptRequest({ variables: { input: { id: requestId } } }); | ||
| }} | ||
| onReject={(_requestId: string) => { |
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.
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) { |
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.
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) { |
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.
Same idea here as the previous comment.
apps/ui-sharethrift/src/components/layouts/home/my-listings/components/all-listings-table.tsx
Fixed
Show fixed
Hide fixed
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.
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.
getActionButtonshelper to show correct actions per statushandleActionfunction with separate handler functions per actionupdate.tsapplication service (replaces separate accept.ts)💬 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:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: