trunk
vilmibm 2022-05-31 22:30:45 -05:00
parent 9d8bd4a2df
commit b804ae9d32
2 changed files with 26 additions and 23 deletions

View File

@ -1,7 +1,31 @@
package db package db
import "time"
type User struct { type User struct {
ID string ID string
Username string Username string
Hash 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
}

View File

@ -10,7 +10,6 @@ import (
"net/http" "net/http"
"os" "os"
"strings" "strings"
"time"
"git.tilde.town/tildetown/bbj2/server/cmd/api" "git.tilde.town/tildetown/bbj2/server/cmd/api"
"git.tilde.town/tildetown/bbj2/server/cmd/config" "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 + // encryption, it doesn't really help anything. I'd rather have plaintext +
// transport encryption and then, on the server side, proper salted hashing. // transport encryption and then, on the server side, proper salted hashing.
// TODO get rid of these
func writeResponse(w http.ResponseWriter, resp api.BBJResponse) { func writeResponse(w http.ResponseWriter, resp api.BBJResponse) {
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json") 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
}