Implement POST task (#28)

Closes #21

Reviewed-on: #28
This commit was merged in pull request #28.
This commit is contained in:
2025-05-09 11:27:31 +02:00
parent 0668228139
commit ec635ba8ff
6 changed files with 282 additions and 131 deletions

View File

@@ -10,11 +10,12 @@ type Allowance struct {
Goals []Goal `json:"goals"`
}
type Schema struct {
Id int `json:"id"`
// Task represents a task in the system.
type Task struct {
ID int `json:"id"`
Name string `json:"name"`
Reward int `json:"reward"`
Assigned *int `json:"assigned"`
Assigned *int `json:"assigned"` // Pointer to allow null
}
type Goal struct {
@@ -34,3 +35,15 @@ type CreateGoalRequest struct {
type CreateGoalResponse struct {
ID int `json:"id"`
}
// CreateTaskRequest represents the request body for creating a new task.
type CreateTaskRequest struct {
Name string `json:"name" binding:"required"`
Reward int `json:"reward"`
Assigned *int `json:"assigned"`
}
// CreateTaskResponse represents the response body after creating a new task.
type CreateTaskResponse struct {
ID int `json:"id"`
}