-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Edit Listing page with update, pause, delete, and cancel operations #263
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
…leteItemListing Co-authored-by: dani-vaibhav <182140623+dani-vaibhav@users.noreply.github.com>
Co-authored-by: dani-vaibhav <182140623+dani-vaibhav@users.noreply.github.com>
Co-authored-by: dani-vaibhav <182140623+dani-vaibhav@users.noreply.github.com>
…le Container - Implemented unit tests for the Edit Listing feature covering form fields, date picker, submission, navigation, button visibility, validation rules, API integration, user interactions, image handling, and form reset scenarios. - Created tests for All Listings Table Container focusing on edit button navigation, listing data display, action handlers, query variables, table columns, error handling, pagination, filtering, search, and sorting.
- Created executable scripts for `tsc` and `tsserver` in the Twilio service package. - Set up environment variable `NODE_PATH` to include necessary TypeScript module paths. - Ensured compatibility with Windows environments by handling path conversion.
- Cleaned up test imports by removing unused 'vi' from vitest. - Standardized formatting and spacing in test cases for better readability. - Enhanced error handling in mock payment server to retry on port conflicts. - Updated test cases to ensure proper validation and error messages for various scenarios. - Improved date handling and validation in form submission tests.
… inline fragments for PersonalUser and AdminUser
|
@sourcery-ai review |
|
Sorry @jason-t-hankins, your pull request is larger than the review limit of 150000 diff characters |
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.
Pull request overview
This PR implements a comprehensive Edit Listing feature for Sharers to modify their listings with full CRUD operations. The implementation spans backend GraphQL mutations, application services, domain logic, and a complete frontend UI with proper authentication and ownership verification.
Key Changes:
- Added GraphQL mutations for update, pause, delete, and cancel operations on listings
- Extended backend services to support partial field updates and new pause functionality
- Implemented ownership verification to ensure only listing owners can perform actions
- Created responsive Edit Listing UI with conditional action buttons based on listing state
- Fixed resolver helpers to properly populate user data with userType information
Reviewed changes
Copilot reviewed 53 out of 56 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/sthrift/graphql/src/schema/types/listing/item-listing.graphql |
Added UpdateItemListingInput and new mutations (update, pause) |
packages/sthrift/graphql/src/schema/types/listing/item-listing.resolvers.ts |
Implemented mutations with authentication and ownership checks |
packages/sthrift/application-services/src/contexts/listing/item/update.ts |
Extended to accept all listing fields and return entity reference |
packages/sthrift/application-services/src/contexts/listing/item/pause.ts |
New service for pausing listings with UoW transaction |
packages/sthrift/graphql/src/schema/resolver-helper.ts |
Fixed PopulateUserFromField to always return full user object with userType |
apps/ui-sharethrift/src/components/layouts/home/components/edit-listing/ |
Complete Edit Listing UI with container, form, and stories |
apps/ui-sharethrift/src/components/layouts/home/my-listings/Index.tsx |
Added route for Edit Listing page |
pnpm-lock.yaml, package.json |
Updated Storybook to 9.1.17, added node-forge override |
.gitignore |
Fixed to properly exclude **/node_modules and **/dist |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
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.
not fully done but wanted to leave you some feedback to work on tomorrow so you have something to do
...arethrift/src/components/layouts/home/components/create-listing/create-listing.container.tsx
Show resolved
Hide resolved
...i-sharethrift/src/components/layouts/home/components/edit-listing/edit-listing.container.tsx
Outdated
Show resolved
Hide resolved
...i-sharethrift/src/components/layouts/home/components/edit-listing/edit-listing.container.tsx
Outdated
Show resolved
Hide resolved
apps/ui-sharethrift/src/components/layouts/home/components/edit-listing/edit-listing.tsx
Show resolved
Hide resolved
apps/ui-sharethrift/src/components/layouts/home/components/edit-listing/edit-listing.tsx
Outdated
Show resolved
Hide resolved
apps/ui-sharethrift/src/components/layouts/home/components/edit-listing/edit-listing.tsx
Show resolved
Hide resolved
apps/ui-sharethrift/src/components/layouts/home/components/edit-listing/edit-listing.tsx
Show resolved
Hide resolved
| <Routes> | ||
| <Route path="" element={<MyListingsMain />} /> | ||
| <Route path="user/:userId" element={<MyListingsMain />} /> | ||
| <Route path=":listingId/edit" element={<EditListing />} /> |
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.
We have this weird route that both link to the same component
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.
I think Vaibhav added this before I joined on the edit listing effort. I think the intention may be for admins to be able to view user's listings and be able to eventually edit them in the same way. We could either leave it for now or just remove the two excess paths from each
…ies in the child edit-listing
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.
Pull request overview
Copilot reviewed 50 out of 53 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Implements the Edit Listing page for Sharers to modify active and draft listings. The page supports full CRUD operations with state transitions per business rules.
Backend Changes
Application Services
update.tsto accept all listing fields (title, description, category, location, sharingPeriod, images) instead of just admin flagspause.tsservice for pausing listings (moves to Paused state)voidtoItemListingEntityReferencefor cache consistencyGraphQL Schema
UpdateItemListingInputwith optional fields for partial updatesupdateItemListing,pauseItemListing,deleteItemListingItemListingfor Apollo cache updatesResolvers
updateItemListingdeleteItemListinguses soft delete pattern (setsisDeleted: true)Resolver Helpers
PopulateUserFromFieldto return the full user object withuserTypeaugmented, preserving all user fields for clientsFrontend Changes
Components
edit-listing.container.tsx: GraphQL integration with 5 mutations (update, pause, delete, cancel), pre-populates form from queryedit-listing.tsx: Two-column layout (image gallery left, form right), confirmation modals for destructive actionsedit-listing-form.tsx: Conditionally renders Pause (Published only) and Cancel Listing (Published/Drafted/Paused) buttons based on listing stateRoute Integration
/my-listings/user/:userId/:listingId/editImageGalleryfrom create-listing componentUsage
State transitions follow domain rules: Published → Paused, Published/Drafted/Paused → Cancelled, any → Deleted.
Other Fixes
Updated
.gitignoreto properly exclude**/node_modulesand**/distpatternsRemoved accidentally committed build artifacts from
packages/sthrift/service-twilioFixes Listing - Edit Listing #221
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Summary by Sourcery
Add full Edit Listing functionality for item listings, including frontend page, GraphQL mutations, backend application services, and supporting infrastructure updates.
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests: