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 database to project #47

Merged
merged 10 commits into from
Sep 16, 2024
Merged

Add database to project #47

merged 10 commits into from
Sep 16, 2024

Conversation

CalPinSW
Copy link
Owner

@CalPinSW CalPinSW commented Sep 4, 2024

Adds database setup and connections to project. Includes new musicbrainz connection for getting information on album genres if available (since Spotify appears to have none).
Adds a basic settings page to the frontend for populating user data.

@CalPinSW
Copy link
Owner Author

CalPinSW commented Sep 4, 2024

@JackMead Realise some refactoring might be due here. Thought I'd save that for a following PR to reduce the number of changes you have to muddle through.

@JackMead
Copy link
Contributor

JackMead commented Sep 6, 2024

(Note to self to also review format-on-save)

Copy link
Contributor

@JackMead JackMead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not done a thorough review but it looks great! Well done finding the time to get all of this together, and it's really nice seeing it start to build out some real advantageous new functionality 😄

Some more detailed thoughts on comments below, and:

  • As we chatted about, I think some pulling it into controller/service/maybe even repository level structure would help separate out the different concerns
  • As mentioned below, some guidance for how to run migrations would be good
    • And also I fell into a trap trying to run it with Docker without the latest CSS being generated, so potentially worth making sure the dev container at least compiles the latest css (or even runs that in hot-reload mode too?)

@@ -1,15 +1,19 @@
from flask import Flask, make_response
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On autoformatting:

  • I can't remember the exact details we discussed, but what I see is that auto-formatting works in JS but not in Python, which I think matches what you see
  • First I checked that I do have a Python formatter installed, I actively added the Black-formatter extension from Microsoft but there was a default one already
  • But looking at the Black formatter output (in the "output" tab of the terminal)

2024-09-13 11:09:15.445 [info] The language client requires VS Code version ^1.82.0 but received version 1.79.2

Updating my VSCode (and it was about time I did!) fixed the issue, so maybe you're seeing the same?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact it's actually the JS side that's not working for me 😁 . I'll have a bit more of a look into it. Aware that trying to get it in in this PR might cause a lot of unnecessary formatting changes to clutter up the actual changes.

from time import sleep


def database_controller(spotify: SpotifyClient, musicbrainz: MusicbrainzClient):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor, but conceptually this name bugs me because it's very much exposing internal details as API details... but I can't immediately offer better! The conceptual tie between the things we own vs Spotify is strong

I'll leave this as a thought, but I wouldn't worry about changing it

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it doesn't quite seem right. I think once I've got the database management happening independently I can get rid of it entirely. Will leave as is for now though.

@@ -0,0 +1,98 @@
from typing import List
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm definitely not properly reviewing all of these models just fyi 😄 )

backend/pyproject.toml Outdated Show resolved Hide resolved
backend/src/database/migrations/init.py Show resolved Hide resolved
@CalPinSW CalPinSW merged commit 2dc0a74 into main Sep 16, 2024
2 checks passed
@CalPinSW CalPinSW deleted the add-database-to-project branch September 16, 2024 07:39
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.

2 participants