Files
rsspipe/internal/models/models.go
T

119 lines
4.3 KiB
Go

package models
import (
"time"
)
// User represents the single admin user
type User struct {
ID string `json:"id"`
Username string `json:"username"`
PasswordHash string `json:"-"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// Category represents a folder/tag grouping for feeds
type Category struct {
ID string `json:"id"`
Title string `json:"title"`
ParentID *string `json:"parent_id,omitempty"`
SortOrder int `json:"sort_order"`
FeedCount int `json:"feed_count,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
// Feed represents a subscribed RSS/Atom/JSON feed
type Feed struct {
ID string `json:"id"`
Title string `json:"title"`
FeedURL string `json:"feed_url"`
SiteURL string `json:"site_url"`
CategoryID *string `json:"category_id,omitempty"`
CategoryTitle string `json:"category_title,omitempty"`
IsVirtualDigest bool `json:"is_virtual_digest"`
RefreshIntervalMinutes int `json:"refresh_interval_minutes"`
TimeoutSeconds int `json:"timeout_seconds"`
ETag string `json:"etag,omitempty"`
LastModified string `json:"last_modified,omitempty"`
LastFetchedAt *time.Time `json:"last_fetched_at,omitempty"`
FetchError string `json:"fetch_error,omitempty"`
UnreadCount int `json:"unread_count"`
TotalCount int `json:"total_count"`
CreatedAt time.Time `json:"created_at"`
}
// FeedEntry represents an individual article or digest entry
type FeedEntry struct {
ID string `json:"id"`
FeedID string `json:"feed_id"`
FeedTitle string `json:"feed_title"`
FeedSiteURL string `json:"feed_site_url,omitempty"`
GUID string `json:"guid"`
URL string `json:"url"`
Title string `json:"title"`
Author string `json:"author,omitempty"`
Content string `json:"content"`
RawContent string `json:"raw_content,omitempty"`
PublishedAt time.Time `json:"published_at"`
IsRead bool `json:"is_read"`
IsStarred bool `json:"is_starred"`
ShareUUID *string `json:"share_uuid,omitempty"`
Metadata map[string]interface{} `json:"metadata"`
CreatedAt time.Time `json:"created_at"`
}
// Stats represents dashboard aggregate counts
type Stats struct {
TotalFeeds int `json:"total_feeds"`
TotalUnread int `json:"total_unread"`
TotalStarred int `json:"total_starred"`
TotalCategories int `json:"total_categories"`
}
// LoginRequest is the body for POST /api/auth/login
type LoginRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
// LoginResponse is the response returned on successful auth
type LoginResponse struct {
Token string `json:"token"`
User User `json:"user"`
}
// CreateFeedRequest is the body for POST /api/feeds
type CreateFeedRequest struct {
FeedURL string `json:"feed_url"`
CategoryID *string `json:"category_id,omitempty"`
Title *string `json:"title,omitempty"`
RefreshIntervalMinutes *int `json:"refresh_interval_minutes,omitempty"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"`
}
// UpdateFeedRequest is the body for PUT /api/feeds/{id}
type UpdateFeedRequest struct {
Title *string `json:"title,omitempty"`
CategoryID *string `json:"category_id,omitempty"`
RefreshIntervalMinutes *int `json:"refresh_interval_minutes,omitempty"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"`
}
// UpdateEntryReadRequest
type UpdateEntryReadRequest struct {
IsRead bool `json:"is_read"`
}
// UpdateEntryStarRequest
type UpdateEntryStarRequest struct {
IsStarred bool `json:"is_starred"`
}
// MarkAllReadRequest
type MarkAllReadRequest struct {
FeedID *string `json:"feed_id,omitempty"`
CategoryID *string `json:"category_id,omitempty"`
Before *string `json:"before,omitempty"`
}