Documentation
¶
Index ¶
- type Attachment
- type AttachmentId
- type Attachments
- type BlacklistEntry
- type Board
- type BoardCreationData
- type BoardMetadata
- type BoardName
- type BoardShortName
- type ConfirmationData
- type Credentials
- type Email
- type Emails
- type File
- type FileCommonMetadata
- type FileId
- type InviteCode
- type InviteCodeWithPlaintext
- type Message
- type MessageCreationData
- type MessageMetadata
- type MsgId
- type MsgText
- type Password
- type PendingFile
- type ReferralActionStats
- type Replies
- type Reply
- type SanitizedImage
- type SanitizedVideo
- type SaveUserData
- type Thread
- type ThreadCreationData
- type ThreadId
- type ThreadMetadata
- type ThreadPagination
- type ThreadTitle
- type User
- type UserId
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
Id AttachmentId `json:"id,omitempty"`
Board BoardShortName `json:"board,omitempty"`
ThreadId ThreadId `json:"thread_id,omitempty"`
MessageId MsgId `json:"message_id,omitempty"`
FileId FileId `json:"file_id,omitempty"`
File *File `json:"file,omitempty"` // Optional: populated when fetching with file details
}
Attachment represents an attachment linking a message to a file
type AttachmentId ¶
type AttachmentId = int64
type BlacklistEntry ¶
type Board ¶
type Board struct {
BoardMetadata
Threads []*Thread
Page int `json:"page,omitempty"`
}
type BoardCreationData ¶
type BoardCreationData struct {
Name BoardName `json:"name" validate:"required"`
ShortName BoardShortName `json:"short_name" validate:"required"`
AllowedEmails *Emails `json:"allowed_emails,omitempty"`
}
to iterate thru layers: handler -> service -> storage
type BoardMetadata ¶
type BoardShortName ¶
type BoardShortName = string
type ConfirmationData ¶
type Credentials ¶
type Emails ¶
type Emails = pq.StringArray
type File ¶
type File struct {
FileCommonMetadata // Sanitized file metadata
Id FileId `json:"id,omitempty"` // Database ID
FilePath string `json:"file_path,omitempty"` // Full path on disk
OriginalFilename string `json:"original_filename,omitempty"` // User's uploaded filename (before sanitization)
OriginalMimeType string `json:"original_mime_type,omitempty"` // MIME type before sanitization (always present)
ThumbnailPath *string `json:"thumbnail_path,omitempty"` // Path to generated thumbnail (images only)
}
File represents a file stored in the system
func (*File) ThumbnailURL ¶
ThumbnailURL returns the public URL for the thumbnail, or empty string if none.
type FileCommonMetadata ¶
type FileCommonMetadata struct {
Filename string `json:"filename,omitempty"`
SizeBytes int64 `json:"size_bytes,omitempty"`
MimeType string `json:"mime_type,omitempty"`
ImageWidth *int `json:"image_width,omitempty"`
ImageHeight *int `json:"image_height,omitempty"`
}
FileCommonMetadata contains common file metadata fields shared between PendingFile (uploaded) and File (stored). Following the MessageMetadata pattern.
func (*FileCommonMetadata) IsImage ¶
func (fcm *FileCommonMetadata) IsImage() bool
IsImage returns true if the file is an image
func (*FileCommonMetadata) IsVideo ¶
func (fcm *FileCommonMetadata) IsVideo() bool
IsVideo returns true if the file is a video
type InviteCode ¶
type InviteCode struct {
CodeHash string
CreatedBy UserId
CreatedAt time.Time
ExpiresAt time.Time
UsedBy *UserId // nil if unused
UsedAt *time.Time // nil if unused
}
InviteCode represents an invite code in the system
type InviteCodeWithPlaintext ¶
type InviteCodeWithPlaintext struct {
PlainCode string
InviteCode
}
InviteCodeWithPlaintext is returned when generating a new invite It contains the plain-text code that should only be shown once to the creator
type Message ¶
type Message struct {
MessageMetadata
Text string
Attachments Attachments
}
type MessageCreationData ¶
type MessageCreationData struct {
Board BoardShortName
ThreadId MsgId
Author User
Text MsgText
ShowEmailDomain bool
CreatedAt *time.Time
PendingFiles []*PendingFile // Files to be saved after message creation
ReplyTo *Replies
}
to iterate thru layers: handler -> service -> storage
type MessageMetadata ¶
type MessageMetadata struct {
Board BoardShortName
ThreadId ThreadId
Id MsgId // Per-thread sequential (1, 2, 3...) - id=1 is OP
Author User
ShowEmailDomain bool
Page int // Page number where this message appears (calculated from Id)
Replies Replies
CreatedAt time.Time
ModifiedAt time.Time
}
func (*MessageMetadata) IsOp ¶
func (m *MessageMetadata) IsOp() bool
IsOp returns true if this message is the opening post (first message in thread)
type PendingFile ¶
type PendingFile struct {
FileCommonMetadata
Data io.Reader `json:"-"`
}
PendingFile represents a file upload being processed (moved from domain/message.go)
type ReferralActionStats ¶ added in v0.3.2
type ReferralActionStats struct {
Source string `json:"source"`
Action string `json:"action"`
Count int `json:"count"`
}
ReferralActionStats contains aggregated counts per source and action type.
type SanitizedImage ¶
type SanitizedImage struct {
FileCommonMetadata
Image any // Decoded image.Image (any to avoid image import here)
Format string // Image format from image.Decode ("png", "jpeg", "gif")
}
SanitizedImage represents a sanitized image file ready to be saved. Images are decoded in-memory (metadata stripped) and ready for encoding/thumbnailing.
type SanitizedVideo ¶
type SanitizedVideo struct {
FileCommonMetadata
TempFilePath string // Path to sanitized video on disk (always present)
Thumbnail []byte // Scaled first-frame JPEG (nil if extraction failed)
}
SanitizedVideo represents a sanitized video file ready to be moved. Videos are processed to disk to avoid memory overhead and moved via MoveFile.
type SaveUserData ¶
SaveUserData contains the data needed to create a new user
type Thread ¶
type Thread struct {
ThreadMetadata
Messages []*Message `json:"messages"`
Pagination *ThreadPagination `json:"pagination,omitempty"`
}
type ThreadCreationData ¶
type ThreadCreationData struct {
Title ThreadTitle
Board BoardShortName
IsPinned bool
OpMessage MessageCreationData
}
to iterate thru layers: handler -> service -> storage
type ThreadMetadata ¶
type ThreadMetadata struct {
Id ThreadId
Title ThreadTitle
Board BoardShortName
MessageCount int
LastBumped time.Time
LastModifiedAt time.Time
IsPinned bool
}
type ThreadPagination ¶
type ThreadTitle ¶
type ThreadTitle = string