feat: Add "version" and "os" fields to rice database

- The rice database now includes new fields:
  - `version`: Represents the version of the rice entry.
  - `os`: Represents the operating system associated with the rice entry.
- These fields are required for all new rice entries.

refactor: Stop uploading rice.json to GitHub
- The `rice.json` file is no longer uploaded to GitHub during rice creation or updates.
- This reduces redundancy as all metadata is now managed directly in the database (Supabase).

fix: Improve exception handling with proper HTTP status codes
- Enhanced exception handling to align with standard HTTP status codes:
  - `BadRequestException` for validation errors.
  - `ConflictException` for duplicate entries.
  - `NotFoundException` for missing resources.
  - Generic `InternalServerErrorException` for unexpected errors.
- This ensures the API returns meaningful and accurate responses.

feat: Enhance rice download to act as a standard HTTP GET
- The `findOne` method now returns the raw content of the rice file directly as the response body.
- Removes unnecessary JSON wrappers, allowing the endpoint to behave like a typical HTTP GET request.
- Improved usability for clients consuming the API.
This commit is contained in:
oscargonzalezmoreno@gmail.com 2024-12-27 11:24:39 +01:00
parent def257b9ba
commit d44ea66b40
11 changed files with 215 additions and 80 deletions

View file

@ -11,7 +11,9 @@ POST {{baseUrl}}/rices
Content-Type: application/json
{
"name": "cool-zenrice-aurora",
"name": "cool-zenrice-aurora2",
"version": "1.0.0",
"os": "EndeavourOS x86_64",
"content": "{'key':'value','description':'Example content'}"
}

View file

@ -1,4 +1,5 @@
@baseUrl = http://localhost:3000
@previous_slug = cool-zenrice-aurora-265e3881-f9de-4bbf-bb22-b9c37dbf04bc
@previous_slug = cool-zenrice-aurora-e99096ae-00da-4d54-9a47-53b20eb57647
GET {{baseUrl}}/rices/{{previous_slug}}

View file

@ -1,6 +1,6 @@
@baseUrl = http://localhost:3000
@previous_slug = cool-zenrice-aurora2-1d1e74b3-8d6d-40ea-bd4f-a6f4ad893f88
@previous_token = be4545f4-d92b-416c-8b3b-50cc9a49dee9
@previous_slug = cool-zenrice-aurora-ef732cbc-fdde-4f76-b4e3-cff0ec8b6f39
@previous_token = b406f962-5c51-43a9-8382-40e0983a46e7
# {
# "key": "value",

View file

@ -1,6 +1,6 @@
@baseUrl = http://localhost:3000
@previous_slug = cool-zenrice-aurora-e8abd40d-8657-4ddd-99c5-912cced67497
@previous_token = 2ce5c580-46e5-4a28-adff-30ce5662f29d
@previous_slug = cool-zenrice-aurora2-b970a742-789c-4349-8a4d-da63c8bbe77d
@previous_token = 03fbfdb4-d3a5-4d64-8740-feac7d32e7a8
DELETE {{baseUrl}}/rices/{{previous_slug}}
x-rices-token: {{previous_token}}