this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

update SQL field names from review

+16 -15
+1 -1
cmd/relay/relay/account.go
··· 256 256 } 257 257 258 258 func (r *Relay) UpsertAccountRepo(uid uint64, rev syntax.TID, commitCID, commitDataCID string) error { 259 - return r.db.Exec("INSERT INTO account_repo (uid, rev, commit_cid, commit_data) VALUES (?, ?, ?, ?) ON CONFLICT (uid) DO UPDATE SET rev = EXCLUDED.rev, commit_cid = EXCLUDED.commit_cid, commit_data = EXCLUDED.commit_data", uid, rev, commitCID, commitDataCID).Error 259 + return r.db.Exec("INSERT INTO account_repo (uid, rev, commit_cid, commit_data_cid) VALUES (?, ?, ?, ?) ON CONFLICT (uid) DO UPDATE SET rev = EXCLUDED.rev, commit_cid = EXCLUDED.commit_cid, commit_data_cid = EXCLUDED.commit_data_cid", uid, rev, commitCID, commitDataCID).Error 260 260 } 261 261 262 262 // This implements the `diskpersist.UidSource` interface
+2 -2
cmd/relay/relay/ingest.go
··· 142 142 return err 143 143 } 144 144 145 - err = r.UpsertAccountRepo(acc.UID, syntax.TID(newRepo.Rev), newRepo.CommitCID, newRepo.CommitData) 145 + err = r.UpsertAccountRepo(acc.UID, syntax.TID(newRepo.Rev), newRepo.CommitCID, newRepo.CommitDataCID) 146 146 if err != nil { 147 147 return fmt.Errorf("failed to upsert account repo (%s): %w", acc.DID, err) 148 148 } ··· 187 187 return err 188 188 } 189 189 190 - err = r.UpsertAccountRepo(acc.UID, syntax.TID(newRepo.Rev), newRepo.CommitCID, newRepo.CommitData) 190 + err = r.UpsertAccountRepo(acc.UID, syntax.TID(newRepo.Rev), newRepo.CommitCID, newRepo.CommitDataCID) 191 191 if err != nil { 192 192 return fmt.Errorf("failed to upsert account repo (%s): %w", acc.DID, err) 193 193 }
+5 -4
cmd/relay/relay/models/models.go
··· 2 2 3 3 import ( 4 4 "time" 5 - 6 - "gorm.io/gorm" 7 5 ) 8 6 9 7 type DomainBan struct { 10 - gorm.Model 8 + ID uint64 `gorm:"column:id;primarykey"` 9 + // CreatedAt is automatically managed by gorm (by convention) 10 + CreatedAt time.Time 11 + 11 12 Domain string `gorm:"unique"` 12 13 } 13 14 ··· 95 96 CommitCID string `gorm:"column:commit_cid;not null"` 96 97 97 98 // The CID of the top of the repo MST, which is the 'data' field within the commit block. This becomes 'prevData' 98 - CommitData string `gorm:"column:commit_data;not null"` 99 + CommitDataCID string `gorm:"column:commit_data_cid;not null"` 99 100 } 100 101 101 102 func (AccountRepo) TableName() string {
+8 -8
cmd/relay/relay/verify.go
··· 74 74 } 75 75 76 76 resp := models.AccountRepo{ 77 - Rev: commit.Rev, 78 - CommitCID: commitCID.String(), 79 - CommitData: commit.Data.String(), 77 + Rev: commit.Rev, 78 + CommitCID: commitCID.String(), 79 + CommitDataCID: commit.Data.String(), 80 80 } 81 81 return &resp, nil 82 82 } ··· 138 138 return fmt.Errorf("missing prevData field") 139 139 } 140 140 if prevRepo != nil { 141 - if evt.PrevData.String() != prevRepo.CommitData { 142 - logger.Warn("commit with miss-matching prevData", "prevData", evt.PrevData, "prevRepo.CommitData", prevRepo.CommitData) 141 + if evt.PrevData.String() != prevRepo.CommitDataCID { 142 + logger.Warn("commit with miss-matching prevData", "prevData", evt.PrevData, "prevRepo.CommitDataCID", prevRepo.CommitDataCID) 143 143 } 144 144 if evt.Since != nil && *evt.Since != prevRepo.Rev { 145 145 logger.Warn("commit with miss-matching since", "since", evt.Since, "prevRepo.Rev", prevRepo.Rev) ··· 200 200 } 201 201 202 202 resp := models.AccountRepo{ 203 - Rev: commit.Rev, 204 - CommitCID: commitCID.String(), 205 - CommitData: commit.Data.String(), 203 + Rev: commit.Rev, 204 + CommitCID: commitCID.String(), 205 + CommitDataCID: commit.Data.String(), 206 206 } 207 207 return &resp, nil 208 208 }