2024-09-15 10:24:36 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Auto-generate string names for the various constants
|
|
|
|
//go:generate stringer -type InboundJobSource
|
|
|
|
|
|
|
|
type InboundJobSource uint8
|
|
|
|
|
|
|
|
// TODO: Adjust and expand these constants later, depending on sources
|
|
|
|
const (
|
|
|
|
InJobSourceAccInbox InboundJobSource = iota
|
|
|
|
InJobSourceServerInbox
|
|
|
|
InJobSourceApiMasto
|
|
|
|
InJobSourceApiLinstrom
|
|
|
|
)
|
|
|
|
|
|
|
|
// Store inbound jobs from api and ap in the db until they finished processing
|
|
|
|
// Ensures data consistency in case the server is forced to restart unexpectedly
|
|
|
|
// No DeletedAt field since don't want completed jobs to linger in the db for any longer than necessary
|
|
|
|
type InboundJob struct {
|
|
|
|
ID uint `gorm:"primarykey"`
|
|
|
|
CreatedAt time.Time
|
|
|
|
// Raw data, could be json or gob data, check source for how to interpret
|
2024-09-16 13:49:03 +00:00
|
|
|
RawData []byte `gorm:"->;<-create"`
|
2024-09-15 10:24:36 +00:00
|
|
|
// Where this job is coming from. Important for figuring out how to decode the raw data and what to do with it
|
2024-09-16 13:49:03 +00:00
|
|
|
Source InboundJobSource `gorm:"->;<-create"`
|
2024-09-15 10:24:36 +00:00
|
|
|
|
|
|
|
// Section: Various data
|
|
|
|
// TODO: Expand based on needs
|
|
|
|
|
|
|
|
// If from an inbox, include the owner id here
|
2024-09-16 13:49:03 +00:00
|
|
|
InboxOwner *string `gorm:"->;<-create"`
|
2024-09-15 10:24:36 +00:00
|
|
|
}
|