60 lines
1.1 KiB
Go
60 lines
1.1 KiB
Go
package main
|
|
|
|
import "time"
|
|
|
|
type User struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type UserWithAllowance struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
Allowance int `json:"allowance"`
|
|
}
|
|
|
|
type Allowance struct {
|
|
Allowance int `json:"allowance"`
|
|
Timestamp time.Time
|
|
}
|
|
|
|
type PostAllowance struct {
|
|
Allowance int `json:"allowance"`
|
|
}
|
|
|
|
// 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"`
|
|
}
|
|
|
|
type CreateTaskRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Reward int `json:"reward"`
|
|
Assigned *int `json:"assigned"`
|
|
}
|
|
|
|
type CreateTaskResponse struct {
|
|
ID int `json:"id"`
|
|
}
|