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

Update the seed to check to update roles & users #368

Open
RubenFricke opened this issue Jan 31, 2021 · 3 comments
Open

Update the seed to check to update roles & users #368

RubenFricke opened this issue Jan 31, 2021 · 3 comments
Labels
bug Something isn't working Refactor Friday This label is used to mark an issue for a planned refactor

Comments

@RubenFricke
Copy link
Member

RubenFricke commented Jan 31, 2021

Describe the bug
Users are not updated in when something changes in the seed and the application does not instantiate the database. So the seed will only execute when there are no users stored in the database. There already is some code that could help to accomplish this. It can be found in the HelperClass folder in the API layer.

Expected behavior
An possible solution could be to check if the user exists in the database. Update the user if it's any different than in the seed.

Additional context
The current logic to execute the seed in the startup

            {
                // seed roles
                context.AddRange(Seed.SeedRoles());
                context.SaveChanges();
            }
            List<Role> roles = context.Role.ToList();
            if(!context.User.Any())
            {
                // seed admin
                context.User.Add(Seed.SeedAdminUser(roles));
                context.SaveChanges();
            }
@RubenFricke RubenFricke added bug Something isn't working Refactor Friday This label is used to mark an issue for a planned refactor labels Jan 31, 2021
@RubenFricke
Copy link
Member Author

@niraymak Did you already fix this one with your User graduation branch? Or did you work on it partially? If so, update this issue accordingly.

@niraymak
Copy link
Member

Fixed it for roles, changed the issue.

@niraymak
Copy link
Member

Reserved for AD S3 students

@Zarthenix Zarthenix mentioned this issue Mar 31, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Refactor Friday This label is used to mark an issue for a planned refactor
Projects
None yet
Development

No branches or pull requests

2 participants