An atproto PDS written in Go

also use right response for create/put

+2
server/handle_repo_create_record.go
···
return helpers.ServerError(e, nil)
}
+
results[0].Type = nil
+
return e.JSON(200, results[0])
}
+2
server/handle_repo_put_record.go
···
return helpers.ServerError(e, nil)
}
+
results[0].Type = nil
+
return e.JSON(200, results[0])
}
+4 -4
server/repo.go
···
}
type ApplyWriteResult struct {
-
Type string `json:"$type,omitempty"`
+
Type *string `json:"$type,omitempty"`
Uri string `json:"uri"`
Cid string `json:"cid"`
Commit *RepoCommit `json:"commit,omitempty"`
···
Value: d,
})
results = append(results, ApplyWriteResult{
-
Type: OpTypeCreate.String(),
+
Type: to.StringPtr(OpTypeCreate.String()),
Uri: "at://" + urepo.Did + "/" + op.Collection + "/" + *op.Rkey,
Cid: nc.String(),
ValidationStatus: to.StringPtr("valid"), // TODO: obviously this might not be true atm lol
···
Value: d,
})
results = append(results, ApplyWriteResult{
-
Type: OpTypeUpdate.String(),
+
Type: to.StringPtr(OpTypeUpdate.String()),
Uri: "at://" + urepo.Did + "/" + op.Collection + "/" + *op.Rkey,
Cid: nc.String(),
ValidationStatus: to.StringPtr("valid"), // TODO: obviously this might not be true atm lol
···
}
for i := range results {
-
results[i].Type = results[i].Type + "Result"
+
results[i].Type = to.StringPtr(*results[i].Type + "Result")
results[i].Commit = &RepoCommit{
Cid: newroot.String(),
Rev: rev,