From b804ae9d32145eb29a35fe471a3e4e1387c8b7a8 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Tue, 31 May 2022 22:30:45 -0500 Subject: [PATCH] stuff --- server/cmd/db/db.go | 24 ++++++++++++++++++++++++ server/cmd/main.go | 25 ++----------------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/server/cmd/db/db.go b/server/cmd/db/db.go index d9d6fcb..7c3f532 100644 --- a/server/cmd/db/db.go +++ b/server/cmd/db/db.go @@ -1,7 +1,31 @@ package db +import "time" + type User struct { ID string Username string Hash string } + +type Thread struct { + ID string `json:"thread_id"` + Author string + Title string + LastMod time.Time `json:"last_mod"` + Created time.Time + ReplyCount int `json:"reply_count"` + Pinned int // TODO bool + LastAuthor string `json:"last_author"` + Messages []Message +} + +type Message struct { + ThreadID string `json:"thread_id"` + PostID string `json:"post_id"` + Author string + Created time.Time + Edited int // TODO bool + Body string + SendRaw int `json:"send_raw"` // TODO bool +} diff --git a/server/cmd/main.go b/server/cmd/main.go index 59d8090..e1c5130 100644 --- a/server/cmd/main.go +++ b/server/cmd/main.go @@ -10,7 +10,6 @@ import ( "net/http" "os" "strings" - "time" "git.tilde.town/tildetown/bbj2/server/cmd/api" "git.tilde.town/tildetown/bbj2/server/cmd/config" @@ -138,6 +137,8 @@ func handler(opts config.Options, f http.HandlerFunc) http.HandlerFunc { // encryption, it doesn't really help anything. I'd rather have plaintext + // transport encryption and then, on the server side, proper salted hashing. +// TODO get rid of these + func writeResponse(w http.ResponseWriter, resp api.BBJResponse) { w.WriteHeader(http.StatusOK) w.Header().Set("Content-Type", "application/json") @@ -555,25 +556,3 @@ func setupAPI(opts config.Options) { })) */ } - -type Thread struct { - ID string `json:"thread_id"` - Author string - Title string - LastMod time.Time `json:"last_mod"` - Created time.Time - ReplyCount int `json:"reply_count"` - Pinned int // TODO bool - LastAuthor string `json:"last_author"` - Messages []Message -} - -type Message struct { - ThreadID string `json:"thread_id"` - PostID string `json:"post_id"` - Author string - Created time.Time - Edited int // TODO bool - Body string - SendRaw int `json:"send_raw"` // TODO bool -}