shahanneda / supertonic

https://getsupertonic.com
0 stars 0 forks source link

Add a new API endpoint for renaming a recording. #11

Open shahanneda opened 1 year ago

shahanneda commented 1 year ago

Add a new API endpoint for renaming a recording. You'll have to make changes to server/src/users/user.service.ts and server/src/users/user.controller.ts.

sweep-ai[bot] commented 1 year ago

Here's the PR! https://github.com/shahanneda/supertonic/pull/13


Step 1: 🔍 Code Search

I found the following snippets in your repository. I will now analyze this snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/shahanneda/supertonic/blob/268b1fe898cdb9b33ea73d474468f2194a8a8872/server/src/users/user.service.ts#L1-L84 https://github.com/shahanneda/supertonic/blob/268b1fe898cdb9b33ea73d474468f2194a8a8872/server/src/users/user.controller.ts#L1-L120 https://github.com/shahanneda/supertonic/blob/268b1fe898cdb9b33ea73d474468f2194a8a8872/client/generated/services/UserService.ts#L1-L62 https://github.com/shahanneda/supertonic/blob/268b1fe898cdb9b33ea73d474468f2194a8a8872/client/generated/services/SheetMusicService.ts#L1-L108 https://github.com/shahanneda/supertonic/blob/268b1fe898cdb9b33ea73d474468f2194a8a8872/server/src/sheet-music/sheet-music.controller.ts#L1-L124

Step 2: 🧐 Snippet Analysis

From looking through the relevant snippets, I decided to make the following modifications:

File Path Proposed Changes
server/src/users/user.service.ts Add a new method renameRecording that takes in the recording id and the new name as parameters. This method should use the Prisma service to update the name of the recording in the database.
server/src/users/user.controller.ts Add a new API endpoint (PATCH /recordings/:id) that calls the renameRecording method in the UserService. This endpoint should take in the recording id as a path parameter and the new name as a request body parameter.

Step 3: 📝 Planning

I have created a plan for writing the pull request. I am now working on executing my plan and coding the required changes to address this issue. Here is the planned pull request:

Add API endpoint for renaming a recording sweep/feature/renaming-endpoint

Description

This PR adds a new API endpoint for renaming a recording in the Supertonic application. The endpoint allows users to update the name of a recording by providing the recording ID and the new name.

Changes Made

  • Added a new method renameRecording in the UserService class (server/src/users/user.service.ts) to handle the renaming of a recording. This method interacts with the Prisma service to update the name of the recording in the database.
  • Added a new API endpoint (PATCH /recordings/:id) in the UserController class (server/src/users/user.controller.ts) that calls the renameRecording method in the UserService. This endpoint takes in the recording ID as a path parameter and the new name as a request body parameter.

How to Test

  1. Start the Supertonic application.
  2. Use an API testing tool (e.g., Postman) to send a PATCH request to the /recordings/:id endpoint, where :id is the ID of the recording you want to rename.
  3. In the request body, include the new name for the recording.
  4. Verify that the recording name is updated in the database.

Related Issue

Add a new API endpoint for renaming a recording


Step 4: ⌨️ Coding

I have finished coding the issue. I am now reviewing it for completeness.


Step 5: 🔁 Code Review

Success! 🚀


I'm a bot that handles simple bugs and feature requests but I might make mistakes. Please be kind! Join Our Discord