50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
package main
|
|
|
|
type User struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type Allowance struct {
|
|
Allowance int `json:"allowance"`
|
|
Goals []Goal `json:"goals"`
|
|
}
|
|
|
|
// 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"` // Pointer to allow null
|
|
}
|
|
|
|
type Goal struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
Target int `json:"target"`
|
|
Progress int `json:"progress"`
|
|
Weight int `json:"weight"`
|
|
}
|
|
|
|
type CreateGoalRequest struct {
|
|
Name string `json:"name"`
|
|
Target int `json:"target"`
|
|
Weight int `json:"weight"`
|
|
}
|
|
|
|
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"`
|
|
}
|