Skip to content

Feature/deal repository crud - #7

Open
Sakhila2001 wants to merge 11 commits into
mainfrom
feature/deal-repository-crud
Open

Feature/deal repository crud#7
Sakhila2001 wants to merge 11 commits into
mainfrom
feature/deal-repository-crud

Conversation

@Sakhila2001

Copy link
Copy Markdown
Collaborator

This PR implements full CRUD functionality for the Deal module, following the repository pattern and transactional data handling.

Features implemented:

  • Deal creation, updating, listing, showing, and deletion
  • Deal-level image handling via ImageService (store, replace, delete)
  • Support for associating multiple products with a deal
  • Soft-deleted pivot handling using SoftDeletePivotSyncService for product associations
  • Active deal listing with eager-loaded relationships: products, brand, subcategory, variants, storages
  • Clean transactional operations to ensure data consistency

Architecture & Design:

  • Repository pattern for all deal operations

Dedicated helper services for:

  • Image handling (ImageService)
  • Product pivot sync with soft-delete support (SoftDeletePivotSyncService)
  • Uses database transactions for store and update to maintain atomicity
  • Soft deletes are respected throughout queries and pivot handling
  • Eager loading of related models for efficient API responses

Testing done:

POST /api/admin/deals (store)
PUT /api/admin/deals/{deal} (update)
GET /api/admin/deals (index)
GET /api/admin/deals/{deal} (show)
DELETE /api/admin/deals/{deal} (destroy)

Verified:

  • Deal creation, updates, and deletion work correctly
  • Images are stored, replaced, and deleted as expected
  • Products associated with deals are synced properly, respecting soft deletes
  • Transactions rollback correctly on failure
  • Eager-loaded relationships return correct data for products, brand, subcategory, variants, and storages

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.

1 participant