-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Implement pause listing functionality #284
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
Draft
arif-u-ahmed
wants to merge
12
commits into
main
Choose a base branch
from
feature/pause-listing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add pause application service following cancel pattern - Add pauseItemListing GraphQL mutation and resolver - Update UI components with pause button and confirmation modal - Filter paused listings from reservers' search results - Add state mapping for domain to UI status conversion Implements pause listing feature per issue #42 requirements. Allows sharers to pause active listings, removing them from search results while retaining reservation history.
Contributor
Reviewer's GuideThis PR adds a ‘pause listing’ feature by introducing a new application service with transaction scoping, extending the GraphQL API with a pauseItemListing mutation and filtering logic, and integrating the pause action into the client UI with state mapping and confirmation dialogs. Sequence diagram for pausing a listing via GraphQL mutationsequenceDiagram
actor User
participant UI
participant GraphQL
participant ApplicationService
participant DataSource
User->>UI: Clicks "Pause" button
UI->>GraphQL: pauseItemListing(id)
GraphQL->>ApplicationService: pause({ id })
ApplicationService->>DataSource: withScopedTransaction(repo)
DataSource->>ApplicationService: getById(id)
ApplicationService->>DataSource: listing.pause() & repo.save(listing)
DataSource-->>ApplicationService: Paused listing entity
ApplicationService-->>GraphQL: Paused listing entity
GraphQL-->>UI: Paused listing entity
UI-->>User: Show success message
Class diagram for ItemListingApplicationService and pause commandclassDiagram
class ItemListingApplicationService {
+cancel(command)
+pause(command)
+queryPaged(command)
+update(command)
// ... other methods
}
class ItemListingPauseCommand {
+id: string
}
ItemListingApplicationService --> ItemListingPauseCommand
class ItemListing {
+pause()
+state: string
// ... other fields and methods
}
ItemListingApplicationService --> ItemListing
ItemListingPauseCommand --> ItemListing
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
- Add GraphQL resolver tests for pauseItemListing mutation - Add application service unit tests for pause functionality - Add container component tests with state mapping verification - Update Storybook stories with pause action scenarios - Add feature file scenarios for pause listing resolver Completes test coverage requirements per instruction markdowns.
…w build configurations and scripts.
Resolved conflicts in pnpm-lock.yaml: - Kept rimraf@^6.1.0 (security upgrade from feature branch) - Kept only glob@11.1.0 (removed glob@10.4.5 per feature branch security override)
Resolved conflicts in: - application-services/src/contexts/listing/item/index.ts * Merged pause, delete, update, and unblock methods - graphql/src/schema/types/listing/item-listing.graphql * Added pauseItemListing alongside cancelItemListing and deleteItemListing * Updated cancelItemListing and deleteItemListing to return ItemListingMutationResult - graphql/src/schema/types/listing/item-listing.resolvers.ts * Added pauseItemListing mutation resolver * Fixed cancelItemListing and deleteItemListing to return proper mutation result structure * Kept filtering of paused listings in itemListings query - graphql/src/schema/types/listing/item-listing.resolvers.test.ts * Merged mock context to include all methods (pause, deleteListings, unblock) * Added pause listing test scenarios - ui-sharethrift/src/components/layouts/home/my-listings/components/all-listings-table.container.graphql * Merged pauseItemListing, cancelItemListing, and deleteItemListing mutations - ui-sharethrift/src/components/layouts/home/my-listings/components/all-listings-table.container.tsx * Integrated pause, cancel, and delete mutations * Kept mapDomainStateToUIStatus helper for state mapping Regenerated GraphQL types via pnpm run gen
- Removed unused mapDomainStateToUIStatus function causing TS6133 error - Function was not being used anywhere in the component - Fixes Azure Pipeline build failure
- Inline immediately returned variable in pauseItemListing resolver - Add ownership verification to pause listing functionality - Only the listing owner (sharer) can pause their listing - Prevents unauthorized users from pausing listings - Optimize paused listing filtering by pushing to database layer - Move filter from in-memory to MongoDB query using $nin operator - Improves performance by avoiding loading all listings into memory - Add excludeStates parameter to ItemListingQueryAllCommand Security: Implements authorization check for pause action Performance: Database-level filtering instead of application-level
…atures - Update queryAll expectations to include excludeStates: ['Paused'] - Update pause expectations to include userEmail parameter - Fixes tests after implementing Sourcery code review suggestions
Resolved conflicts by merging both pause listing and delete listing features: - Kept pause listing functionality from feature branch - Integrated delete listing and other updates from main - Updated dependencies to match main branch versions - Merged test scripts and build configurations - Preserved both pause and delete mutations in GraphQL schema - Combined handlers for both actions in UI components Conflicts resolved in: - Package files (root, apps, packages) - GraphQL schema and resolvers - Application service layer - UI components and containers - Test files - pnpm-lock.yaml (accepted from main)
…ure/pause-listing Resolved conflicts from remote changes: - Updated pause mutation to include userEmail parameter - Improved paused listing filtering to use database-level exclusion - Merged formatting and code style updates - Integrated query-all with excludeStates support All pause listing functionality preserved and enhanced.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements pause listing functionality for sharers, allowing them to pause active listings which removes them from search results while retaining reservation history.
Changes
pause.ts) following cancel patternpauseItemListingGraphQL mutation and resolveritemListingsqueryImplementation Details
Testing
Related
Closes #42
Checklist
Summary by Sourcery
Enable sharers to pause active listings by adding backend service, GraphQL mutation, and UI controls while filtering paused listings from search results and standardizing status display.
New Features:
Bug Fixes:
Enhancements: