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

Feat Sync team deletion #8217

Open
wants to merge 11 commits into
base: 1.6.x
Choose a base branch
from
Open

Feat Sync team deletion #8217

wants to merge 11 commits into from

Conversation

byawitz
Copy link
Member

@byawitz byawitz commented May 29, 2024

What does this PR do?

Changed team and organization deleting logic to the API instead of queuing it to the deleting worker

Test Plan

Tested against local 1.5.5 instance,

  1. All of the projects were pulled using the CLI and pushed into a new Organization with different project IDs.
  2. A few resources and files were added manually
  3. Delete organization, delete everything.

Related PRs and Issues

Close #7939

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@byawitz byawitz added the product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services. label May 29, 2024
@byawitz byawitz self-assigned this May 29, 2024
@stnguyen90 stnguyen90 requested a review from Meldiron May 30, 2024 21:12
Copy link
Contributor

@Meldiron Meldiron left a comment

Choose a reason for hiding this comment

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

Looks good. Now that it's sync, let's update tests for sync behaviour. We either don't have test for this, or it's async (with sleep)

@byawitz
Copy link
Member Author

byawitz commented May 31, 2024

@stnguyen90
Copy link
Contributor

@Meldiron, checked, the test is without sleep

https://github.com/appwrite/appwrite/blob/main/tests/e2e/Services/Teams/TeamsBase.php#L371-L388

@byawitz, but that tests doesn't verify the memberships are deleted synchronously. Maybe you can add a users list memberships? Or at least manually test?

@byawitz
Copy link
Member Author

byawitz commented Jun 5, 2024

The test returns 404, which means the teams were deleted, and there's no way to delete them in an async way.

What should the test be different?

@stnguyen90
Copy link
Contributor

The test returns 404, which means the teams were deleted, and there's no way to delete them in an async way.

Even without your change, the current test returns 404 so the current test doesn't actually test anything about memberships?

What should the test be different?

A test that verifies the memberships are deleted would be great. I'm not totally sure on how to test, though. Maybe users.listMemberships()?

@byawitz
Copy link
Member Author

byawitz commented Jun 25, 2024

The tests check if the team for a given ID exists. When the endpoint returns 404, it means the team no longer exists.

Do you mean to add a whole new test for userMemberships?

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

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

Do you mean to add a whole new test for userMemberships

@byawitz, something like that. The goal is to test and make sure the memberships are deleted when the team is deleted.

@byawitz
Copy link
Member Author

byawitz commented Jun 26, 2024

Test added here

@stnguyen90 stnguyen90 self-requested a review June 28, 2024 04:23
->inject('dbForProject')
->inject('queueForEvents')
->inject('dbForConsole')
Copy link
Contributor

Choose a reason for hiding this comment

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

dbForConsole isn't needed anymore, right?

@@ -76,6 +76,7 @@ services:
- appwrite-config:/storage/config:rw
- appwrite-certificates:/storage/certificates:rw
- appwrite-functions:/storage/functions:rw
- appwrite-builds:/storage/builds:rw
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change needed?

@@ -65,6 +65,7 @@ $image = $this->getParam('image', '');
- appwrite-config:/storage/config:rw
- appwrite-certificates:/storage/certificates:rw
- appwrite-functions:/storage/functions:rw
- appwrite-builds:/storage/builds:rw
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.
Projects
Status: Code Review
Development

Successfully merging this pull request may close these issues.

None yet

4 participants