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

Create a function createRolesTable to create a Roles table: roles #181

Closed
jaytula opened this issue Sep 25, 2021 · 0 comments · Fixed by #195
Closed

Create a function createRolesTable to create a Roles table: roles #181

jaytula opened this issue Sep 25, 2021 · 0 comments · Fixed by #195
Assignees
Labels
Back End Focused on Back End (Express / Postgres / Docker) Enhancement Improves or adds something

Comments

@jaytula
Copy link
Contributor

jaytula commented Sep 25, 2021

We'll need a roles table if we're going to have users with different permissions.

The roles table should have two fields:

  • rid for role id
  • name for the role name

This should be similar to the createUsersTable and it should also be run in db-setup.ts. Some things to note:

  • Currently quiz_db.sql sets up all the tables and is setup to run once when used with the docker-compose.yml setup. We could choose to maintain this and re-create this SQL dump but existing docker containers won't update themselves. Therefore running npm run db-setup is necessary if the database schema expectation changes.
  • Probably best to create the function in db/roles.ts
  • Create tests to check proper creation of table in tests/roles.test.ts. See users.test.ts.
    • Handle the case for when the table already exists
@ZumDeWald ZumDeWald added Back End Focused on Back End (Express / Postgres / Docker) Enhancement Improves or adds something hacktoberfest-accepted Accept for Hacktoberfest, will merge after review and removed hacktoberfest-accepted Accept for Hacktoberfest, will merge after review labels Sep 29, 2021
@ghost ghost assigned ghost and ZumDeWald and unassigned ghost Oct 1, 2021
ZumDeWald added a commit that referenced this issue Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Back End Focused on Back End (Express / Postgres / Docker) Enhancement Improves or adds something
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants