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

Add group filter to stories #98

Merged
merged 8 commits into from
Aug 15, 2023
Merged

Conversation

YaleChen299
Copy link
Contributor

@YaleChen299 YaleChen299 commented Aug 11, 2023

Missing Permission check.
Current behaviour of the model function is:

  • if groupID is given, filter by groupID,
  • if the groupID is nil, gets all stories.

In the controller, the current routing and middle ware guarantees that the list all route will have a valid groupID.

Part of #15.

@github-actions
Copy link

github-actions bot commented Aug 11, 2023

Coverage Status

coverage: 49.36% (-1.3%) from 50.642% when pulling 2741bea on add_group_filter_to_stories into ba486fb on main.

@RichDom2185
Copy link
Member

Blocked by #97 (depends on the same migration file).

Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

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

Direction looks good. Just one question: does setting to nil actually filter WHERE group_id IS NULL? Or does it simply ignore the field, can we test this behaviour?

@RichDom2185
Copy link
Member

Direction looks good. Just one question: does setting to nil actually filter WHERE group_id IS NULL? Or does it simply ignore the field, can we test this behaviour?

I'm asking because when setting values, we need to explicitly use an NULL expression in gorm (nil fields are simply ignored, e.g. see #85).

@YaleChen299 YaleChen299 marked this pull request as ready for review August 13, 2023 16:00
@YaleChen299
Copy link
Contributor Author

YaleChen299 commented Aug 13, 2023

Direction looks good. Just one question: does setting to nil actually filter WHERE group_id IS NULL? Or does it simply ignore the field, can we test this behaviour?

I'm asking because when setting values, we need to explicitly use an NULL expression in gorm (nil fields are simply ignored, e.g. see #85).

I think i have tests for that, when i use the struct where, with group id as null, it will explicit find those stories without groups.

Actually, let me refine the tests. I might not cover the case well.

Edit: passing nil will get all the stories.

@RichDom2185
Copy link
Member

Edit: passing nil will get all the stories.

Ok, I will update the PR description.

Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

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

LGTM for now, thanks!

@RichDom2185 RichDom2185 enabled auto-merge (squash) August 15, 2023 10:51
@RichDom2185 RichDom2185 merged commit 07065b2 into main Aug 15, 2023
2 checks passed
@RichDom2185 RichDom2185 deleted the add_group_filter_to_stories branch August 15, 2023 10:51
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.

2 participants