AntonioMrtz / SpotifyElectron

Spotify Electron is a cross-platform music streaming desktop app made with Electron-React frontend and Python-FastAPI-AWS Backend. The goal is to reproduce the original Spotify functionality while adding new ones like uploading songs.
https://antoniomrtz.github.io/SpotifyElectron_Web/
Other
37 stars 9 forks source link

Promote User to Artist #129

Open AntonioMrtz opened 4 months ago

AntonioMrtz commented 4 months ago

Create an endpoint for PATCH /users/:id/promote that accepts the name of an existing user and:

AntonioMrtz commented 4 months ago

Endpoint promote user to artist

xiomaraR commented 3 months ago

@AntonioMrtz Thanks for suggesting this issue! Iā€™d like to work on it.

AntonioMrtz commented 3 months ago

@xiomaraR All yours, just tell me if you need anything :)

AntonioMrtz commented 2 months ago

Hi @xiomaraR , how is it going? This weekend I made some major changes related to JWT Authentication. One of the last tasks I had pending about developer experience on the app was to re-enable Swagger docs for backend. Because of the JWT Middleware we had before request had to be made using frontend or Postman, the authentication field all protected endpoints had didn't work as expected. I think I will create a new docs page about tips/help on how to develop the app such as debugging, use of swagger etc.

But for now you can use Swagger docs for making backend requests, Im sure it will improve developer experience and ease the testing/develop. For using Swagger requests on protected endpoints you will need:

Let me know if its useful or if you have any questions about the task. šŸ˜ƒ

xiomaraR commented 2 months ago

Hey @AntonioMrtz so I couldn't find a method in user_service or anywhere else that creates artist from user, so I tried to create one. Will you let me know if I'm on the right track? I wasn't sure of the best way to fetch the user data


def upgrade_user_to_artist(user_name: str) -> None:
    """Promote a user to an artist then deletes user

    Args:
        user_name (str): user name

    Raises:
        UserServiceException: unexpected error upgrading user
    """
    try:

        user = user_repository.get_user(user_name)
        if artist_service.create_artist(user.name, user.photo, user.password):
            base_user_service.delete_user(user_name)
    except Exception as exception:
        user_service_logger.exception(
            f"Unexpected error upgrading {user_name} to artist"
        )
        raise UserServiceException from exception
AntonioMrtz commented 2 months ago

Hi @xiomaraR. Yeah, theres no create artist from user method, the goal was to create the structure for it in this issue. The code looks good but theres a few things you can improve:

Let me know if you need anything. I will be happy to answer šŸ˜€

AntonioMrtz commented 2 weeks ago

Hi @xiomaraR are u still working on this issue? :)