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

merge(sql_refactor): better sql; #9

Merged
merged 11 commits into from
Mar 21, 2024
Merged

merge(sql_refactor): better sql; #9

merged 11 commits into from
Mar 21, 2024

Conversation

5-pebbles
Copy link
Owner

Changes:

  • Migrations are now run with refinery.
    I changed the format to use , at the start of lines, this makes it harder to accidentally leave a trailing , on the last line.

  • Permissions are now case insensitive & I changed the case used in responses from camelCase to PascalCase.

  • Changed the name of session to token and moved POST /login to POST /token & DELETE /session to DELETE /token.

  • Moved DangerousUser to User and it no longer stores sensitive information only the permissions and username.

  • I also refactored a bunch of internal stuff, but I am not going to write that down because I am the only one who is ever going to read this -_-

This PR might be a bit too big...

feat(sql): mv migrations to dir run by refinery.

feat(database)!: permissions now case insensitive.

feat(migrations): add migrations of permissions and sessions.

refactor(login): moved api::user::DangerousUserLogin.

refactor(api): mv user_login -> session_write.

feat(tokens)!: mv /login -> /token & /session -> /token.

refactor(tokens)!: DangerousUser -> User & use token table.

feat(sql): junction tables & better sql.

fix(dependencies): rm unused dependency sqlvec.

fix(dependencies): rm unused dependency rusqlite-from-row.

BREAKING CHANGE: permissions serialized as PascalCase.
I added migrations for the `sessions` & `permissions` tables
& one to add all permissions to their table
& one to create the permission junction table `user_permissions`
mv DangerousUserLogin -> database::users::DangerousLogin.
& changed cookie name to token form session.

BREAKING CHANGE: mv login api endpoint to POST token.
I refactore & renamed the DangerousUser struct.
The sessions table has been replaced with tokens table in the db.
& The tokens table is now being used for token storage
BREAKING CHANGE: `user.sessions` column replaced by table `tokens` in db.
@5-pebbles 5-pebbles self-assigned this Mar 20, 2024
@5-pebbles 5-pebbles linked an issue Mar 20, 2024 that may be closed by this pull request
src/api/music/albums.rs Show resolved Hide resolved
src/database/users.rs Show resolved Hide resolved
tests/app_tests.rs Show resolved Hide resolved
@5-pebbles
Copy link
Owner Author

I need to fix some warnings before merging but I will get to that tomorrow.

@5-pebbles 5-pebbles merged commit 844e79e into main Mar 21, 2024
1 check passed
@5-pebbles 5-pebbles deleted the sql_refactor branch March 21, 2024 13:45
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

Successfully merging this pull request may close these issues.

Permissions & Sessions Sql Refactor
1 participant