62 lines
1.7 KiB
Go
62 lines
1.7 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type User struct {
|
|
TelegramID int64 `db:"tg_id"`
|
|
Username string `db:"username"`
|
|
Name string `db:"name"`
|
|
StarsBalance int `db:"stars_balance"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
}
|
|
|
|
type Research struct {
|
|
ID uuid.UUID `db:"id"`
|
|
TelegramID int64 `db:"tg_id"`
|
|
Query string `db:"query"`
|
|
Mode string `db:"mode"` // fast | deep
|
|
Status string `db:"status"` // pending | processing | done | failed
|
|
StarsCost int `db:"stars_cost"`
|
|
Summary *string `db:"summary"`
|
|
ReportPath *string `db:"report_path"`
|
|
SourcesJSON []byte `db:"sources"`
|
|
ErrorMessage *string `db:"error_message"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
CompletedAt *time.Time `db:"completed_at"`
|
|
}
|
|
|
|
type Transaction struct {
|
|
ID uuid.UUID `db:"id"`
|
|
TelegramID int64 `db:"tg_id"`
|
|
Amount int `db:"amount"`
|
|
Type string `db:"type"` // purchase | research
|
|
Description string `db:"description"`
|
|
TelegramChargeID *string `db:"telegram_charge_id"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
}
|
|
|
|
type ResearchRequest struct {
|
|
UserTelegramID int64 `json:"tg_id"`
|
|
Query string `json:"query"`
|
|
Mode string `json:"mode"`
|
|
ResearchID string `json:"research_id"`
|
|
}
|
|
|
|
type ResearchResult struct {
|
|
ResearchID string `json:"research_id"`
|
|
Status string `json:"status"`
|
|
Summary string `json:"summary"`
|
|
ReportPath string `json:"report_path"`
|
|
Sources []Source `json:"sources"`
|
|
Error string `json:"error,omitempty"`
|
|
}
|
|
|
|
type Source struct {
|
|
Title string `json:"title"`
|
|
URL string `json:"url"`
|
|
}
|