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

BC-5832- Add deleting creator ID reference from the files entities (the legacy files, rewritten from FeathersJS) in the main user deletion use case #4662

Merged
merged 10 commits into from
Jan 9, 2024

Conversation

sszafGCA
Copy link
Contributor

@sszafGCA sszafGCA commented Dec 21, 2023

Description

Added deletion of creator id reference from file entity. Modified service method to wrap it up with other updates to make sure that one file was not counted twice as updated.

Links to Tickets or other pull requests

Changes

Datasecurity

Deployment

New Repos, NPM pakages or vendor scripts

Approval for review

  • DEV: If api was changed - generate-client:server was executed in vue frontend and changes were tested and put in a PR with the same branch name.
  • QA: In addition to review, the code has been manually tested (if manual testing is possible)
  • All points were discussed with the ticket creator, support-team or product owner. The code upholds all quality guidelines from the PR-template.

Notice: Please remove the WIP label if the PR is ready to review, otherwise nobody will review it.

@sszafGCA sszafGCA self-assigned this Dec 21, 2023
Copy link
Contributor

@bn-pass bn-pass left a comment

Choose a reason for hiding this comment

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

Just a small improvements, looks good to me overall.

apps/server/src/modules/files/entity/file.entity.ts Outdated Show resolved Hide resolved
apps/server/src/modules/files/entity/file.entity.ts Outdated Show resolved Hide resolved
Comment on lines +171 to +178
for (let i = 0; i < entities.length; i += 1) {
expect(entities[i].permissions).not.toContain(userPermission);
if (i === 1 || i === 3) {
expect(entities[i]._creatorId).toBe(undefined);
}
expect(entities[i].permissions).toContain(anotherUserPermission);
expect(entities[i].permissions).toContain(yetAnotherUserPermission);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should a test have so much logic?

Copy link
Contributor Author

@sszafGCA sszafGCA Jan 8, 2024

Choose a reason for hiding this comment

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

this test was already existing I just added to it needed data to cover all posibilities after code modification

Copy link
Contributor

Choose a reason for hiding this comment

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

I already understood. But still I was expecting more separate tests than for and if statements in the tests. For me, the for and if statements are things to test again.

@virgilchiriac
Copy link
Contributor

pls find a short concise summary for this PR (normally 50 characters (details can be added in body according to guidelines)

@sszafGCA sszafGCA requested a review from SevenWaysDP January 8, 2024 10:15
Comment on lines +171 to +178
for (let i = 0; i < entities.length; i += 1) {
expect(entities[i].permissions).not.toContain(userPermission);
if (i === 1 || i === 3) {
expect(entities[i]._creatorId).toBe(undefined);
}
expect(entities[i].permissions).toContain(anotherUserPermission);
expect(entities[i].permissions).toContain(yetAnotherUserPermission);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I already understood. But still I was expecting more separate tests than for and if statements in the tests. For me, the for and if statements are things to test again.

@sszafGCA sszafGCA enabled auto-merge (squash) January 9, 2024 10:41
Copy link

sonarqubecloud bot commented Jan 9, 2024

@sszafGCA sszafGCA merged commit e6193d3 into main Jan 9, 2024
44 of 45 checks passed
@sszafGCA sszafGCA deleted the BC-5832-delete-creatorId-from-file-entity branch January 9, 2024 11:06
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.

4 participants