enBloc-org / kindly

Open source repository for the development of Kindly
GNU General Public License v3.0
18 stars 21 forks source link

#260/feat: Allow Users to mark their Items as 'Given Away' #337

Closed YuraPetrovskyi closed 1 month ago

YuraPetrovskyi commented 2 months ago

Checklist:

Description

Relates #260 #254

Files changed

DonatedItemsList.tsx

GiveAwayConfirmationModal.tsx (New)

ItemCard.tsx

ItemDetailsPage.tsx

ReserveForUserModal.tsx

supabase/migrations/20240913135301_add_given_away_to_column.sql (New)

-Added migration to include given_away_to column in the items table to track the user receiving the donated item.

supabase/models/filtering-items/searchItems.ts

supabase/models/messaging/findConversationByItemAndUsers.ts (New)

types/supabaseTypes.ts

Tests

All tests have been conducted manually, and no errors have been identified.

netlify[bot] commented 2 months ago

Deploy request for cool-creponne-3e1272 pending review.

Visit the deploys page to approve it

Name Link
Latest commit 0af188ced229da21ecc254570d641ff63374decc
camelPhonso commented 2 months ago

Hi @YuraPetrovskyi could you run npx cypress open on your branch and check what's causing a fail in one of our authorisation tests? The workflow is flagging it

Screenshot 2024-09-20 at 07 52 04

camelPhonso commented 2 months ago

closes #260

YuraPetrovskyi commented 2 months ago

Hi @camelPhonso . I fail the new user authorization test. Incidentally, I cannot register a new user, and I use previously created users. When trying to create a new user, I do not receive a confirmation email. A user is created in the database, but it is impossible to log in later under this name. Not sure if my code changes have any effect on this. I must say that I made some corrections in supabaseTypes.ts ( I changed id: String to id: string, email: String to email: string ), but I checked where they are used and I think my changes do not change the logic of the program. What should my next steps be, what do you recommend? I can roll back the changes regarding supabaseTypes.ts and make the appropriate changes in my code, what do you say? (I have already tried different options, it does not affect authorization)

camelPhonso commented 2 months ago

Hi @camelPhonso . I fail the new user authorization test. Incidentally, I cannot register a new user, and I use previously created users. When trying to create a new user, I do not receive a confirmation email. A user is created in the database, but it is impossible to log in later under this name. Not sure if my code changes have any effect on this. I must say that I made some corrections in supabaseTypes.ts ( I changed id: String to id: string, email: String to email: string ), but I checked where they are used and I think my changes do not change the logic of the program. What should my next steps be, what do you recommend? I can roll back the changes regarding supabaseTypes.ts and make the appropriate changes in my code, what do you say? (I have already tried different options, it does not affect authorization)

I remember there being a discussion on the discord about 'String' vs 'string' in one of our types that was causing some trouble. In any case, unless there's a specific reason why we think it's better to refactor this I wouldn't be changing the types anyway so it's worth reverting those and running tests again. If they still fail maybe share the error message you get so we can figure out what's causing it

YuraPetrovskyi commented 2 months ago

Hi @camelPhonso . I turned back the data types and a miracle happened 🤪🙃

YuraPetrovskyi commented 2 months ago

Hi @camelPhonso , it seems I'm done with the main work) and have completed all your comments except for the test. Could you please clarify what I need to do for the test? Whether to create a new test in cypress or to make changes to some existing one, since I do not know deeply about these thing🤪🤦‍♂️🤷‍♀️🙏

YuraPetrovskyi commented 2 months ago

Locally, the test works for me, but previously I created the 'give_away' item and made the reservation, and then the test "went like clockwork" 🙃

camelPhonso commented 1 month ago

Hi @camelPhonso , it seems I'm done with the main work) and have completed all your comments except for the test. Could you please clarify what I need to do for the test? Whether to create a new test in cypress or to make changes to some existing one, since I do not know deeply about these thing🤪🤦‍♂️🤷‍♀️🙏

ok so it seems like your test is running into issues because it assumes the shoes have been marked as reserved, but when we start with the seed data that's not the case.

The shoes are used in the resrved.cy.js suite so we should leave those as they are but the best thing to do would be to have one of the other items reserved and then run the test to give away on that one.

To do this, the best way is to follow these steps:

YuraPetrovskyi commented 1 month ago

To do this, the best way is to follow these steps:

  • npx supabase db reset to start with clean data again
  • log in as the refugee and request an item - maybe the summer dress
  • log in as the donor and mark the summer dress as reserved
  • do a data dump to update our seed data
  • then adjust your test to target the summer dress and mark it as given away

Thanks @camelPhonso for the advice👍 now everything is working 🥳

OlenaReukova commented 1 month ago

@YuraPetrovskyi , Looks great 👍The test ran successfully, and the giveaway functionality works as expected.

YuraPetrovskyi commented 1 month ago

Another smashing contribution 🙌 Thanks Yurii

I am very happy🥳🤩 Thanks @camelPhonso for the tips and for the right direction💪it was great to work on this assignment👍