Implement POST task (#28)
Closes #21 Reviewed-on: #28
This commit was merged in pull request #28.
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user