Improve some models types (using scuffedtime more often just to be safe), extra fields, set them as omitempty when optional

master
Thomas Lynch 1 year ago
parent bffc697b97
commit bef26fa57d
  1. 6
      app/models/custompage.go
  2. 15
      app/models/post.go
  3. 26
      app/models/webring.go

@ -1,15 +1,11 @@
package models
import (
"time"
)
type CustomPage struct {
Board string `json:"board"`
Page string `json:"page"`
Title string `json:"title"`
Message RawAndMarkdownMessage `json:"message"`
Date time.Time `json:"date"`
Date ScuffedTime `json:"date"`
Edited interface{} `json:"edited"`
ID string `json:"_id"`
}

@ -55,16 +55,17 @@ type Post struct {
}
type Report struct {
ID string `json:"id"`
Reason string `json:"reason"`
Date time.Time `json:"date"`
IP IP `json:"ip"`
ID string `json:"id"`
Reason string `json:"reason"`
Date ScuffedTime `json:"date"`
IP IP `json:"ip"`
}
type IP struct {
Raw string `json:"raw"`
Raw string `json:"raw,omitempty"`
Cloak string `json:"cloak"`
Pruned bool `json:"pruned"`
Pruned bool `json:"pruned,omitempty"`
Type int `json:"type,omitempty"`
}
type Files struct {
@ -92,7 +93,7 @@ type Geometry struct {
type Country struct {
Name string `json:"name"`
Code string `json:"code"`
Src string `json:"src"`
Src string `json:"src,omitempty"`
Custom bool `json:"custom"`
}

@ -1,9 +1,5 @@
package models
import (
"time"
)
type Webring struct {
Name string `json:"name"`
URL string `json:"url"`
@ -16,15 +12,15 @@ type Webring struct {
}
type WebringBoard struct {
URI string `json:"uri"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Path string `json:"path"`
PostsPerHour int `json:"postsPerHour"`
PostsPerDay int `json:"postsPerDay"`
TotalPosts int `json:"totalPosts"`
UniqueUsers int `json:"uniqueUsers"`
Nsfw bool `json:"nsfw"`
Tags []string `json:"tags"`
LastPostTimestamp time.Time `json:"lastPostTimestamp"`
URI string `json:"uri"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Path string `json:"path"`
PostsPerHour int `json:"postsPerHour"`
PostsPerDay int `json:"postsPerDay"`
TotalPosts int `json:"totalPosts"`
UniqueUsers int `json:"uniqueUsers"`
Nsfw bool `json:"nsfw"`
Tags []string `json:"tags"`
LastPostTimestamp ScuffedTime `json:"lastPostTimestamp"`
}

Loading…
Cancel
Save