feat: add Telegram bot with notifications and scheduler
This commit is contained in:
@@ -1,22 +1,31 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Habit struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
UserID int64 `db:"user_id" json:"user_id"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Description string `db:"description" json:"description"`
|
||||
Color string `db:"color" json:"color"`
|
||||
Icon string `db:"icon" json:"icon"`
|
||||
Frequency string `db:"frequency" json:"frequency"` // daily, weekly, custom
|
||||
TargetDays []int `db:"-" json:"target_days"` // 0=Sun, 1=Mon, etc.
|
||||
TargetCount int `db:"target_count" json:"target_count"`
|
||||
IsArchived bool `db:"is_archived" json:"is_archived"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
UserID int64 `db:"user_id" json:"user_id"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Description string `db:"description" json:"description"`
|
||||
Color string `db:"color" json:"color"`
|
||||
Icon string `db:"icon" json:"icon"`
|
||||
Frequency string `db:"frequency" json:"frequency"` // daily, weekly, custom
|
||||
TargetDays []int `db:"-" json:"target_days"` // 0=Sun, 1=Mon, etc.
|
||||
TargetCount int `db:"target_count" json:"target_count"`
|
||||
ReminderTime sql.NullString `db:"reminder_time" json:"-"`
|
||||
ReminderTimeStr *string `db:"-" json:"reminder_time"`
|
||||
IsArchived bool `db:"is_archived" json:"is_archived"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
||||
}
|
||||
|
||||
func (h *Habit) ProcessForJSON() {
|
||||
if h.ReminderTime.Valid {
|
||||
h.ReminderTimeStr = &h.ReminderTime.String
|
||||
}
|
||||
}
|
||||
|
||||
type HabitLog struct {
|
||||
@@ -30,24 +39,26 @@ type HabitLog struct {
|
||||
}
|
||||
|
||||
type CreateHabitRequest struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Color string `json:"color,omitempty"`
|
||||
Icon string `json:"icon,omitempty"`
|
||||
Frequency string `json:"frequency,omitempty"`
|
||||
TargetDays []int `json:"target_days,omitempty"`
|
||||
TargetCount int `json:"target_count,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Color string `json:"color,omitempty"`
|
||||
Icon string `json:"icon,omitempty"`
|
||||
Frequency string `json:"frequency,omitempty"`
|
||||
TargetDays []int `json:"target_days,omitempty"`
|
||||
TargetCount int `json:"target_count,omitempty"`
|
||||
ReminderTime *string `json:"reminder_time,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateHabitRequest struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Color *string `json:"color,omitempty"`
|
||||
Icon *string `json:"icon,omitempty"`
|
||||
Frequency *string `json:"frequency,omitempty"`
|
||||
TargetDays []int `json:"target_days,omitempty"`
|
||||
TargetCount *int `json:"target_count,omitempty"`
|
||||
IsArchived *bool `json:"is_archived,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Color *string `json:"color,omitempty"`
|
||||
Icon *string `json:"icon,omitempty"`
|
||||
Frequency *string `json:"frequency,omitempty"`
|
||||
TargetDays []int `json:"target_days,omitempty"`
|
||||
TargetCount *int `json:"target_count,omitempty"`
|
||||
ReminderTime *string `json:"reminder_time,omitempty"`
|
||||
IsArchived *bool `json:"is_archived,omitempty"`
|
||||
}
|
||||
|
||||
type LogHabitRequest struct {
|
||||
|
||||
Reference in New Issue
Block a user