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 default USER's role when creating a new user #55

Open
chrispinkney opened this issue Mar 6, 2024 · 0 comments
Open

Add default USER's role when creating a new user #55

chrispinkney opened this issue Mar 6, 2024 · 0 comments
Assignees
Labels
api API related issue

Comments

@chrispinkney
Copy link
Member

i.e.,

model User {
  ...
  role    Role    @default(USER)
  ...
}
  async createUser(createUser: CreateUserDto) {
    return await this.prisma.user.create({
      data: {
        ...createUser,
        id: uuidv4(),
        role: Role.USER, // <-- remove/change this to let prisma assign a role?
      },
    });
  }
@chrispinkney chrispinkney added the api API related issue label Mar 6, 2024
@chrispinkney chrispinkney changed the title Set User's role to USER by default in prisma schema and remove hardcoded assignment Allow prisma to assign a default User's role to USER by via schema (and remove hardcoded assignment) Mar 6, 2024
@manekenpix manekenpix changed the title Allow prisma to assign a default User's role to USER by via schema (and remove hardcoded assignment) Add default USER role when creating a new user Mar 12, 2024
@manekenpix manekenpix changed the title Add default USER role when creating a new user Add default USER's role when creating a new user Mar 12, 2024
@chrispinkney chrispinkney self-assigned this Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API related issue
Projects
None yet
Development

No branches or pull requests

1 participant