Skip to content
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

belindas-closet-android_3_175_add-functionality-delete-button #195

Merged
merged 3 commits into from
Nov 27, 2023

Conversation

intisarosman1
Copy link
Contributor

@intisarosman1 intisarosman1 commented Nov 25, 2023

Resolves #175

This PR makes it so that pressing the delete button on the frontend calls the "soft delete" API endpoint and hides the product.

For manual testing purposes, update the handbag in the 'Accessories' category to be a 24-character hex string as the id in Datasource.kt because MongoDB generates the ObjectId in this format (will otherwise throw an invalid id error).

test.delete.mp4

Note: There is currently a bug where archiving/deleting products deletes all products from that same category (issue #191), which has been addressed for deleting items in this code version while I collaborated with Hanan.

Related to User Story #102

@intisarosman1 intisarosman1 added enhancement New feature or request Sprint 3 labels Nov 25, 2023
@intisarosman1 intisarosman1 marked this pull request as draft November 25, 2023 08:59
- Fixed bug where deleting an item deletes all items from the same category
- Fixed bug where items with invalid id still delete (when they shouldn't
- Fixed non-admins being able to delete items
@intisarosman1 intisarosman1 marked this pull request as ready for review November 25, 2023 13:14
@intisarosman1 intisarosman1 requested a review from a team as a code owner November 25, 2023 13:14
Copy link
Contributor

@taylorpapke taylorpapke left a comment

Choose a reason for hiding this comment

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

Works as expected. Soft deletes a product 1 by 1 from view but you must place an objectID of a valid product under the handbag accessory (to test handbag only) in Datasource.kt. I will also note the following:

  • admin must be signed in.
  • this action will not set isHidden to true at this time.

@intisarosman1 intisarosman1 marked this pull request as draft November 26, 2023 06:54
*Something I overlooked*
@intisarosman1 intisarosman1 marked this pull request as ready for review November 26, 2023 06:57
@intisarosman1
Copy link
Contributor Author

intisarosman1 commented Nov 26, 2023

Works as expected. Soft deletes a product 1 by 1 from view but you must place an objectID of a valid product under the handbag accessory (to test handbag only) in Datasource.kt. I will also note the following:

  • admin must be signed in.
  • this action will not set isHidden to true at this time.

Glad you caught this! I fixed this error due to a mistake on my part while overlooking changes to the request to client.delete. I tested this by using the objectId of a product from my local database (in Datasource.kt) and it behaves as expected and Logcat confirms this.

@tinpham5614
Copy link
Contributor

tinpham5614 commented Nov 27, 2023

Tested it and it works. ✅

To organize our services better, I believe that the Archive and Delete services should be associated with the Product.
This can be achieved by creating a Product directory and moving the product services into it.
Additionally, we can move the DTOs for Archive and Delete requests and responses into the product_dto directory. This will help us keep our codebase organized and easier to work with.

data
___| network
_______________| auth
_______________| products
_______________| dto
____________________| auth_dto
____________________| product_dto

@intisarosman1 intisarosman1 merged commit c15f99d into main Nov 27, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Sprint 3
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Delete Product Functionality: Add Functionality from Backend to Frontend
3 participants