feat: implement filament and spool preset services with CRUD operations

- Add `FilamentService` for managing filament inventory, including creation, retrieval, updating, and deletion of filaments.
- Introduce `SpoolPresetService` for handling spool presets, allowing users to create, update, and delete their custom presets.
- Create domain models for `Filament` and `SpoolPreset` with necessary fields and methods.
- Define repository interfaces for filament and spool preset persistence.
- Implement application configuration management from environment variables.
- Set up error handling with a centralized `AppError` type.
- Build the Axum router with public and protected routes for user authentication and resource management.
This commit is contained in:
2026-03-14 09:38:28 -03:00
parent c90d2f920b
commit abdc2fe8ce
67 changed files with 7832 additions and 0 deletions
@@ -0,0 +1,9 @@
# Secrets
.env*
# Dependencies
node_modules
# OS files
.DS_Store
Thumbs.db
@@ -0,0 +1,20 @@
info:
name: Forgot Password
type: http
seq: 5
http:
method: POST
url: http://0.0.0.0:8080/api/v1/auth/forgot-password
body:
type: json
data: |-
{
"email": "felipe@felipecncloud.com"
}
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,21 @@
info:
name: Login
type: http
seq: 2
http:
method: POST
url: http://0.0.0.0:8080/api/v1/auth/login
body:
type: json
data: |-
{
"email": "felipe@felipecncloud.com",
"password": "12345678"
}
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,24 @@
info:
name: Logout
type: http
seq: 2
http:
method: POST
url: http://0.0.0.0:8080/api/v1/auth/logout
body:
type: json
data: |-
{
"email": "felipe@felipecncloud.com",
"password": "l11f06c10"
}
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,20 @@
info:
name: OAuth Google
type: http
seq: 8
http:
method: POST
url: http://0.0.0.0:8080/api/v1/auth/oauth/google
body:
type: json
data: |-
{
"id_token": "{{google_id_token}}"
}
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,20 @@
info:
name: Refresh Token
type: http
seq: 4
http:
method: POST
url: http://0.0.0.0:8080/api/v1/auth/refresh
body:
type: json
data: |-
{
"refresh_token": "{{refresh_token}}"
}
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,21 @@
info:
name: Register
type: http
seq: 1
http:
method: POST
url: http://0.0.0.0:8080/api/v1/auth/register
body:
type: json
data: |-
{
"email": "felipe@felipecncloud.com",
"password": "12345678"
}
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,21 @@
info:
name: Reset Password
type: http
seq: 7
http:
method: POST
url: http://0.0.0.0:8080/api/v1/auth/reset-password
body:
type: json
data: |-
{
"token": "{{reset_token}}",
"new_password": "novaSenha123"
}
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,20 @@
info:
name: Verify Email
type: http
seq: 6
http:
method: POST
url: http://0.0.0.0:8080/api/v1/auth/verify-email
body:
type: json
data: |-
{
"token": "{{email_verify_token}}"
}
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,6 @@
info:
name: Auth
type: folder
seq: 2
request: {}
@@ -0,0 +1,17 @@
info:
name: Dashboard
type: http
seq: 1
http:
method: GET
url: http://0.0.0.0:8080/api/v1/dashboard
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,32 @@
info:
name: Create Filament
type: http
seq: 2
http:
method: POST
url: http://0.0.0.0:8080/api/v1/filaments
body:
type: json
data: |-
{
"material": "PLA",
"brand": "Bambu",
"model": "PLA Basic",
"color_hex": "#FF5733",
"spool_preset_id": "{{preset_id}}",
"total_weight_g": 1250,
"temp_hotend_c": 220,
"temp_bed_c": 60,
"flow_factor_pct": 1.0,
"notes": "Filamento de teste"
}
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,17 @@
info:
name: Delete Filament
type: http
seq: 5
http:
method: DELETE
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}}
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,24 @@
info:
name: Export Label SVG
type: http
seq: 7
http:
method: GET
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}}/label.svg
params:
- name: width_mm
value: "80"
enabled: true
- name: height_mm
value: "30"
enabled: true
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,17 @@
info:
name: Get Filament
type: http
seq: 3
http:
method: GET
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}}
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,22 @@
info:
name: Get QR Code
type: http
seq: 6
http:
method: GET
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}}/qrcode
auth:
type: bearer
token: "{{access_token}}"
runtime:
variables:
- name: filament_id
value: e1edc611-f020-4234-94e5-db5e1393dbf2
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,36 @@
info:
name: List Filaments
type: http
seq: 1
http:
method: GET
url: http://0.0.0.0:8080/api/v1/filaments
params:
- name: page
value: "1"
enabled: true
- name: per_page
value: "20"
enabled: true
- name: material
value: PLA
enabled: false
- name: brand
value: Bambu
enabled: false
- name: search
value: ""
enabled: false
- name: stock_level
value: low
enabled: false
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,32 @@
info:
name: Update Filament
type: http
seq: 4
http:
method: PUT
url: http://0.0.0.0:8080/api/v1/filaments/{{filament_id}}
body:
type: json
data: |-
{
"material": "PETG",
"brand": "Bambu",
"model": "PETG Basic",
"color_hex": "#33A1FF",
"spool_preset_id": "{{preset_id}}",
"total_weight_g": 1000,
"temp_hotend_c": 240,
"temp_bed_c": 70,
"flow_factor_pct": 1.0,
"notes": "Atualizado"
}
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,6 @@
info:
name: Filaments
type: folder
seq: 3
request: {}
@@ -0,0 +1,24 @@
info:
name: Create Spool Preset
type: http
seq: 2
http:
method: POST
url: http://0.0.0.0:8080/api/v1/spool-presets
body:
type: json
data: |-
{
"name": "Carretel Customizado 300g",
"spool_weight_g": 300
}
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,17 @@
info:
name: Delete Spool Preset
type: http
seq: 4
http:
method: DELETE
url: http://0.0.0.0:8080/api/v1/spool-presets/{{preset_id}}
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,17 @@
info:
name: List Spool Presets
type: http
seq: 1
http:
method: GET
url: http://0.0.0.0:8080/api/v1/spool-presets
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,24 @@
info:
name: Update Spool Preset
type: http
seq: 3
http:
method: PUT
url: http://0.0.0.0:8080/api/v1/spool-presets/{{preset_id}}
body:
type: json
data: |-
{
"name": "Carretel Customizado 350g",
"spool_weight_g": 350
}
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,6 @@
info:
name: SpoolPresets
type: folder
seq: 4
request: {}
@@ -0,0 +1,17 @@
info:
name: Get Me
type: http
seq: 1
http:
method: GET
url: http://0.0.0.0:8080/api/v1/users/me
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,23 @@
info:
name: Update Me
type: http
seq: 2
http:
method: PUT
url: http://0.0.0.0:8080/api/v1/users/me
body:
type: json
data: |-
{
"email": "felipe@felipecncloud.com"
}
auth:
type: bearer
token: "{{access_token}}"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
@@ -0,0 +1,6 @@
info:
name: Users
type: folder
seq: 5
request: {}
@@ -0,0 +1,10 @@
name: route
variables:
- secret: true
name: access_token
- secret: true
name: refresh_token
- name: preset_id
value: 0ffa808d-af09-4bc6-9a40-43df3a4c6dd0
- name: filament_id
value: e1edc611-f020-4234-94e5-db5e1393dbf2
@@ -0,0 +1,10 @@
opencollection: 1.0.0
info:
name: MewoSpool
bundled: false
extensions:
bruno:
ignore:
- node_modules
- .git