forked from hailey.at/cocoon
An atproto PDS written in Go

also use right response for create/put

+2
server/handle_repo_create_record.go
··· 55 55 return helpers.ServerError(e, nil) 56 56 } 57 57 58 + results[0].Type = nil 59 + 58 60 return e.JSON(200, results[0]) 59 61 }
+2
server/handle_repo_put_record.go
··· 55 55 return helpers.ServerError(e, nil) 56 56 } 57 57 58 + results[0].Type = nil 59 + 58 60 return e.JSON(200, results[0]) 59 61 }
+4 -4
server/repo.go
··· 83 83 } 84 84 85 85 type ApplyWriteResult struct { 86 - Type string `json:"$type,omitempty"` 86 + Type *string `json:"$type,omitempty"` 87 87 Uri string `json:"uri"` 88 88 Cid string `json:"cid"` 89 89 Commit *RepoCommit `json:"commit,omitempty"` ··· 138 138 Value: d, 139 139 }) 140 140 results = append(results, ApplyWriteResult{ 141 - Type: OpTypeCreate.String(), 141 + Type: to.StringPtr(OpTypeCreate.String()), 142 142 Uri: "at://" + urepo.Did + "/" + op.Collection + "/" + *op.Rkey, 143 143 Cid: nc.String(), 144 144 ValidationStatus: to.StringPtr("valid"), // TODO: obviously this might not be true atm lol ··· 164 164 Value: d, 165 165 }) 166 166 results = append(results, ApplyWriteResult{ 167 - Type: OpTypeUpdate.String(), 167 + Type: to.StringPtr(OpTypeUpdate.String()), 168 168 Uri: "at://" + urepo.Did + "/" + op.Collection + "/" + *op.Rkey, 169 169 Cid: nc.String(), 170 170 ValidationStatus: to.StringPtr("valid"), // TODO: obviously this might not be true atm lol ··· 273 273 } 274 274 275 275 for i := range results { 276 - results[i].Type = results[i].Type + "Result" 276 + results[i].Type = to.StringPtr(*results[i].Type + "Result") 277 277 results[i].Commit = &RepoCommit{ 278 278 Cid: newroot.String(), 279 279 Rev: rev,