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

Refactor session validation logic in Phase Service / AuthComponent #472

Merged
merged 10 commits into from
Oct 7, 2020

Conversation

anubh-v
Copy link
Contributor

@anubh-v anubh-v commented Sep 26, 2020

In this PR, I have added a new operator that asserts whether a SessionData object meets all our required constraints
(e.g. is there at least one open phase ?).

This operator can be used directly in the Observable pipelines.

Benefits of this new operator:

  • Previously, the validation was done in map operators along with other logic. Now, we can perform the validation as an independent step in the Observables' pipeline. Separating the map and validation logic should make the overall pipeline more readable.
  • The session validation logic can be easily tested, independently of the other code in PhaseService.

@anubh-v anubh-v changed the title Refactor validation logic in AuthComponent:setupSession for simplicity Refactor session validation logic in Phase Service / AuthComponent for simplicity Oct 3, 2020
@anubh-v anubh-v changed the title Refactor session validation logic in Phase Service / AuthComponent for simplicity Refactor session validation logic in Phase Service / AuthComponent Oct 3, 2020
@anubh-v anubh-v requested a review from JunWei96 October 3, 2020 13:53
Copy link
Contributor

@JunWei96 JunWei96 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. Agree that it is more readable.

src/custom-ops.ts Outdated Show resolved Hide resolved
src/app/core/models/session.model.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@JunWei96 JunWei96 left a comment

Choose a reason for hiding this comment

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

LGTM!

@JunWei96 JunWei96 merged commit 3b15b62 into CATcher-org:master Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants