feat: Enhance user update handling and introduce NullString type for optional fields
This commit is contained in:
+11
-3
@@ -34,6 +34,14 @@ SOLVE TASKS AS FAST AS POSSIBLE. EACH REQUEST COSTS THE USER MONEY.
|
||||
- make run: Start the development server
|
||||
9. CUSTOM RULES
|
||||
- Add custom rules to .clinerules if:
|
||||
- Unexpected behavior is encountered
|
||||
- Specific conditions require warnings
|
||||
- New patterns emerge that need documentation
|
||||
- Unexpected behavior is encountered
|
||||
- Specific conditions require warnings
|
||||
- New patterns emerge that need documentation
|
||||
10.Implement a REST API update handling in Go using Gin that ensures the following behavior:
|
||||
- The update request is received as JSON.
|
||||
- If a field is present in the JSON and set to null, the corresponding value in the database should be removed.
|
||||
- If a field is missing in the JSON, it should not be modified.
|
||||
- If a field is present in the JSON and not null, it should be updated.
|
||||
- Use either a struct or a map to handle the JSON data.
|
||||
- Ensure the update logic is robust and does not unintentionally remove or overwrite fields.
|
||||
- Optional: Handle error cases like invalid JSON and return appropriate HTTP status codes.
|
||||
Reference in New Issue
Block a user