feat: add Telegram bot with notifications and scheduler

This commit is contained in:
Cosmo
2026-02-06 13:16:50 +00:00
parent 5a40127edd
commit 9e467b0448
19 changed files with 1007 additions and 110 deletions

View File

@@ -1,17 +1,28 @@
package model
import (
"database/sql"
"time"
)
type User struct {
ID int64 `db:"id" json:"id"`
Email string `db:"email" json:"email"`
Username string `db:"username" json:"username"`
PasswordHash string `db:"password_hash" json:"-"`
EmailVerified bool `db:"email_verified" json:"email_verified"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
ID int64 `db:"id" json:"id"`
Email string `db:"email" json:"email"`
Username string `db:"username" json:"username"`
PasswordHash string `db:"password_hash" json:"-"`
EmailVerified bool `db:"email_verified" json:"email_verified"`
TelegramChatID sql.NullInt64 `db:"telegram_chat_id" json:"-"`
TelegramChatIDValue *int64 `db:"-" json:"telegram_chat_id"`
NotificationsEnabled bool `db:"notifications_enabled" json:"notifications_enabled"`
Timezone string `db:"timezone" json:"timezone"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}
func (u *User) ProcessForJSON() {
if u.TelegramChatID.Valid {
u.TelegramChatIDValue = &u.TelegramChatID.Int64
}
}
type RegisterRequest struct {
@@ -26,7 +37,10 @@ type LoginRequest struct {
}
type UpdateProfileRequest struct {
Username string `json:"username,omitempty"`
Username *string `json:"username,omitempty"`
TelegramChatID *int64 `json:"telegram_chat_id,omitempty"`
NotificationsEnabled *bool `json:"notifications_enabled,omitempty"`
Timezone *string `json:"timezone,omitempty"`
}
type ChangePasswordRequest struct {