summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--derelict.go7
-rw-r--r--models.go11
2 files changed, 12 insertions, 6 deletions
diff --git a/derelict.go b/derelict.go
index d70598e..ef0b6c3 100644
--- a/derelict.go
+++ b/derelict.go
@@ -74,12 +74,7 @@ func handleBattlesPost(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Unexpected error 1", http.StatusInternalServerError)
return
}
- type wreck struct {
- Team int `json:"team"`
- Id string `json:"id"`
- Hash string `json:"hash"`
- }
- var wrecks []wreck
+ var wrecks []Wreck
data, err := ioutil.ReadAll(r.Body)
if err != nil {
http.Error(w, "Unexpected error 2", http.StatusInternalServerError)
diff --git a/models.go b/models.go
new file mode 100644
index 0000000..d230525
--- /dev/null
+++ b/models.go
@@ -0,0 +1,11 @@
+package main
+
+type Killmail struct {
+ Id string `json:"id"`
+ Hash string `json:"hash"`
+}
+
+type Wreck struct {
+ Killmail
+ Team string `json:"team"`
+}