···55)
6677type DomainBan struct {
88- ID uint64 `gorm:"column:id;primarykey"`
88+ ID uint64 `gorm:"column:id;primarykey" json:"id"`
99 // CreatedAt is automatically managed by gorm (by convention)
1010- CreatedAt time.Time
1010+ CreatedAt time.Time `json:"createdAt"`
11111212- Domain string `gorm:"unique"`
1212+ Domain string `gorm:"unique" json:"domain"`
1313}
14141515type HostStatus string
···2323)
24242525type Host struct {
2626- ID uint64 `gorm:"column:id;primarykey"`
2626+ ID uint64 `gorm:"column:id;primarykey" json:"id"`
27272828 // these fields are automatically managed by gorm (by convention)
2929- CreatedAt time.Time
3030- UpdatedAt time.Time
2929+ CreatedAt time.Time `json:"createdAt"`
3030+ UpdatedAt time.Time `json:"updatedAt"`
31313232 // hostname, without URL scheme. if localhost, must include a port number; otherwise must not include port
3333- Hostname string `gorm:"column:hostname;uniqueIndex;not null"`
3333+ Hostname string `gorm:"column:hostname;uniqueIndex;not null" json:"hostname"`
34343535 // indicates ws:// not wss://
3636- NoSSL bool `gorm:"column:no_ssl;default:false"`
3636+ NoSSL bool `gorm:"column:no_ssl;default:false" json:"noSSL"`
37373838 // maximum number of active accounts
3939- AccountLimit int64 `gorm:"column:account_limit"`
3939+ AccountLimit int64 `gorm:"column:account_limit" json:"accountLimit"`
40404141 // indicates this is a highly trusted host (PDS), and different rate limits apply
4242- Trusted bool `gorm:"column:trusted;default:false"`
4242+ Trusted bool `gorm:"column:trusted;default:false" json:"trusted"`
43434444- Status HostStatus `gorm:"column:status;default:active"`
4444+ Status HostStatus `gorm:"column:status;default:active" json:"status"`
45454646 // the last sequence number persisted for this host. updated periodically, and at shutdown. negative number indicates no sequence recorded
4747- LastSeq int64 `gorm:"column:last_seq;default:-1"`
4747+ LastSeq int64 `gorm:"column:last_seq;default:-1" json:"lastSeq"`
48484949 // represents the number of accounts on the host, minus any in "deleted" state
5050- AccountCount int64 `gorm:"column:account_count;default:0"`
5050+ AccountCount int64 `gorm:"column:account_count;default:0" json:"accountCount"`
5151}
52525353func (Host) TableName() string {
···7373)
74747575type Account struct {
7676- UID uint64 `gorm:"column:uid;primarykey"`
7777- DID string `gorm:"column:did;uniqueIndex;not null"`
7676+ UID uint64 `gorm:"column:uid;primarykey" json:"uid"`
7777+ DID string `gorm:"column:did;uniqueIndex;not null" json:"did"`
78787979 // this is a reference to the ID field on Host; but it is not an explicit foreign key
8080- HostID uint64 `gorm:"column:host_id;not null"`
8181- Status AccountStatus `gorm:"column:status;not null;default:active"`
8282- UpstreamStatus AccountStatus `gorm:"column:upstream_status;not null;default:active"`
8080+ HostID uint64 `gorm:"column:host_id;not null" json:"hostID"`
8181+ Status AccountStatus `gorm:"column:status;not null;default:active" json:"status"`
8282+ UpstreamStatus AccountStatus `gorm:"column:upstream_status;not null;default:active" json:"upstreamStatus"`
8383}
84848585func (Account) TableName() string {
···8989// This is a small extension table to `Account`, which holds fast-changing fields updated on every firehose event.
9090type AccountRepo struct {
9191 // references Account.UID, but not set up as a foreign key
9292- UID uint64 `gorm:"column:uid;primarykey"`
9393- Rev string `gorm:"column:rev;not null"`
9292+ UID uint64 `gorm:"column:uid;primarykey" json:"uid"`
9393+ Rev string `gorm:"column:rev;not null" json:"rev"`
94949595 // The CID of the entire signed commit block. Sometimes called the "head"
9696- CommitCID string `gorm:"column:commit_cid;not null"`
9696+ CommitCID string `gorm:"column:commit_cid;not null" json:"commitCID"`
97979898 // The CID of the top of the repo MST, which is the 'data' field within the commit block. This becomes 'prevData'
9999- CommitDataCID string `gorm:"column:commit_data_cid;not null"`
9999+ CommitDataCID string `gorm:"column:commit_data_cid;not null" json:"commitDataCID"`
100100}
101101102102func (AccountRepo) TableName() string {