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

Reusable enums / Inter-table enums #20

Open
Osiris-Team opened this issue Nov 29, 2023 · 0 comments
Open

Reusable enums / Inter-table enums #20

Osiris-Team opened this issue Nov 29, 2023 · 0 comments

Comments

@Osiris-Team
Copy link
Owner

Osiris-Team commented Nov 29, 2023

To prevent ugly stuff like this:

            Review.Rating rating = values[i];
            List<ReviewRating> reviewRatings = ReviewRating.whereReviewId().is(review.id)
                    .and(ReviewRating.whereRating().is(ReviewRating.Rating.valueOf(rating.name()))).get();

Instead, it could look like this if the enum was imported instead of redefined in the other table:

            Review.Rating rating = values[i];
            List<ReviewRating> reviewRatings = ReviewRating.whereReviewId().is(review.id)
                    .and(ReviewRating.whereRating().is(rating).get();

Details: We have a enum named Rating defined twice in the Review table and the ReviewRating table even though its exactly the same enum used.

@Osiris-Team Osiris-Team changed the title Reusable enums Reusable enums / Inter-table enums Mar 7, 2024
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

No branches or pull requests

1 participant