move post and board models to separate folder

master
Thomas Lynch 2 years ago
parent 515d671827
commit 0bd911d6bf
  1. 31
      app/boardlist.go
  2. 28
      app/models/board.go
  3. 87
      app/models/post.go
  4. 105
      app/overboard.go

@ -3,38 +3,15 @@ package jschan
import (
"context"
"fmt"
"jschan/app/models"
"net/http"
"net/url"
)
type LastPostTimestamp struct {
Text string `json:"text"`
Color string `json:"color"`
}
type Settings struct {
Sfw bool `json:"sfw"`
Name string `json:"name"`
Description string `json:"description"`
UnlistedLocal bool `json:"unlistedLocal,omitempty"`
}
type Boards struct {
ID string `json:"_id"`
URI string `json:"uri,omitempty"`
Path string `json:"path,omitempty"`
LastPostTimestamp LastPostTimestamp `json:"lastPostTimestamp"`
Tags []interface{} `json:"tags,omitempty"`
SiteName string `json:"siteName,omitempty"`
SequenceValue int `json:"sequence_value"`
Pph int `json:"pph"`
Ips int `json:"ips"`
Settings Settings `json:"settings,omitempty"`
Webring bool `json:"webring"`
Ppd int `json:"ppd,omitempty"`
}
type GetBoardsResponse struct {
Boards []Boards `json:"boards"`
Page int `json:"page"`
MaxPage int `json:"maxPage"`
Boards []models.Board `json:"boards"`
Page int `json:"page"`
MaxPage int `json:"maxPage"`
}
type GetBoardsPublicOptions struct {

@ -0,0 +1,28 @@
package models
type Board struct {
ID string `json:"_id"`
URI string `json:"uri,omitempty"`
Path string `json:"path,omitempty"`
LastPostTimestamp LastPostTimestamp `json:"lastPostTimestamp"`
Tags []interface{} `json:"tags,omitempty"`
SiteName string `json:"siteName,omitempty"`
SequenceValue int `json:"sequence_value"`
Pph int `json:"pph"`
Ips int `json:"ips"`
Settings Settings `json:"settings,omitempty"`
Webring bool `json:"webring"`
Ppd int `json:"ppd,omitempty"`
}
type Settings struct {
Sfw bool `json:"sfw"`
Name string `json:"name"`
Description string `json:"description"`
UnlistedLocal bool `json:"unlistedLocal,omitempty"`
}
type LastPostTimestamp struct {
Text string `json:"text"`
Color string `json:"color"`
}

@ -0,0 +1,87 @@
package models
import (
"time"
)
type Post struct {
ID string `json:"_id"`
Date time.Time `json:"date"`
U int64 `json:"u"`
Name string `json:"name"`
Country interface{} `json:"country"`
Board string `json:"board"`
Tripcode interface{} `json:"tripcode"`
Capcode string `json:"capcode"`
Subject string `json:"subject"`
Message string `json:"message"`
Messagehash string `json:"messagehash"`
Nomarkup string `json:"nomarkup"`
Thread interface{} `json:"thread"`
Email string `json:"email"`
Spoiler bool `json:"spoiler"`
Banmessage interface{} `json:"banmessage"`
UserID interface{} `json:"userId"`
Files []Files `json:"files"`
Quotes []interface{} `json:"quotes"`
Crossquotes []interface{} `json:"crossquotes"`
Backlinks []Backlinks `json:"backlinks"`
Replyposts int `json:"replyposts"`
Replyfiles int `json:"replyfiles"`
Sticky int `json:"sticky"`
Locked int `json:"locked"`
Bumplocked int `json:"bumplocked"`
Cyclic int `json:"cyclic"`
Bumped time.Time `json:"bumped"`
PostID int `json:"postId"`
Replies []Post `json:"replies"`
Previewbacklinks []interface{} `json:"previewbacklinks,omitempty"`
Omittedfiles int `json:"omittedfiles,omitempty"`
Omittedposts int `json:"omittedposts,omitempty"`
Edited Edited `json:"edited,omitempty"`
}
type Files struct {
Spoiler interface{} `json:"spoiler"`
Hash string `json:"hash"`
Filename string `json:"filename"`
OriginalFilename string `json:"originalFilename"`
Mimetype string `json:"mimetype"`
Size int `json:"size"`
Extension string `json:"extension"`
Thumbextension string `json:"thumbextension"`
Geometry Geometry `json:"geometry"`
GeometryString string `json:"geometryString"`
HasThumb bool `json:"hasThumb"`
SizeString string `json:"sizeString"`
}
type Geometry struct {
Width int `json:"width"`
Height int `json:"height"`
Thumbwidth int `json:"thumbwidth"`
Thumbheight int `json:"thumbheight"`
}
type Country struct {
Name string `json:"name"`
Code string `json:"code"`
Src string `json:"src"`
Custom bool `json:"custom"`
}
type Quotes struct {
ID string `json:"_id"`
Thread int `json:"thread"`
PostID int `json:"postId"`
}
type Backlinks struct {
ID string `json:"_id"`
PostID int `json:"postId"`
}
type Edited struct {
Username string `json:"username"`
Date time.Time `json:"date"`
}

@ -3,113 +3,12 @@ package jschan
import (
"context"
"fmt"
"jschan/app/models"
"net/http"
"net/url"
"strings"
"time"
)
type Geometry struct {
Width int `json:"width"`
Height int `json:"height"`
Thumbwidth int `json:"thumbwidth"`
Thumbheight int `json:"thumbheight"`
}
type Files struct {
Spoiler interface{} `json:"spoiler"`
Hash string `json:"hash"`
Filename string `json:"filename"`
OriginalFilename string `json:"originalFilename"`
Mimetype string `json:"mimetype"`
Size int `json:"size"`
Extension string `json:"extension"`
Thumbextension string `json:"thumbextension"`
Geometry Geometry `json:"geometry"`
GeometryString string `json:"geometryString"`
HasThumb bool `json:"hasThumb"`
SizeString string `json:"sizeString"`
}
type Backlinks struct {
ID string `json:"_id"`
PostID int `json:"postId"`
}
type Country struct {
Name string `json:"name"`
Code string `json:"code"`
Src string `json:"src"`
Custom bool `json:"custom"`
}
type Quotes struct {
ID string `json:"_id"`
Thread int `json:"thread"`
PostID int `json:"postId"`
}
type Edited struct {
Username string `json:"username"`
Date time.Time `json:"date"`
}
type Replies struct {
ID string `json:"_id"`
Date time.Time `json:"date"`
U int64 `json:"u"`
Name string `json:"name"`
Country Country `json:"country"`
Board string `json:"board"`
Tripcode interface{} `json:"tripcode"`
Capcode interface{} `json:"capcode"`
Subject string `json:"subject"`
Message string `json:"message"`
Messagehash string `json:"messagehash"`
Nomarkup string `json:"nomarkup"`
Thread int `json:"thread"`
Email string `json:"email"`
Spoiler bool `json:"spoiler"`
Banmessage interface{} `json:"banmessage"`
UserID interface{} `json:"userId"`
Files []interface{} `json:"files"`
Quotes []Quotes `json:"quotes"`
Crossquotes []interface{} `json:"crossquotes"`
Backlinks []Backlinks `json:"backlinks"`
PostID int `json:"postId"`
Edited Edited `json:"edited,omitempty"`
}
type Threads struct {
ID string `json:"_id"`
Date time.Time `json:"date"`
Name string `json:"name"`
Country interface{} `json:"country"`
Board string `json:"board"`
Tripcode interface{} `json:"tripcode"`
Capcode string `json:"capcode"`
Subject string `json:"subject"`
Message string `json:"message"`
Messagehash string `json:"messagehash"`
Nomarkup string `json:"nomarkup"`
Thread interface{} `json:"thread"`
Email string `json:"email"`
Spoiler bool `json:"spoiler"`
Banmessage interface{} `json:"banmessage"`
UserID interface{} `json:"userId"`
Files []Files `json:"files"`
Quotes []interface{} `json:"quotes"`
Crossquotes []interface{} `json:"crossquotes"`
Backlinks []Backlinks `json:"backlinks"`
Replyposts int `json:"replyposts"`
Replyfiles int `json:"replyfiles"`
Sticky int `json:"sticky"`
Locked int `json:"locked"`
Bumplocked int `json:"bumplocked"`
Cyclic int `json:"cyclic"`
Bumped time.Time `json:"bumped"`
PostID int `json:"postId"`
U int64 `json:"u"`
Replies []Replies `json:"replies"`
Previewbacklinks []interface{} `json:"previewbacklinks,omitempty"`
Omittedfiles int `json:"omittedfiles,omitempty"`
Omittedposts int `json:"omittedposts,omitempty"`
Edited Edited `json:"edited,omitempty"`
}
type GetOverboardOptions struct {
AddBoards []string `json:"search"`
RemoveBoards []string `json:"sort"`
@ -117,7 +16,7 @@ type GetOverboardOptions struct {
}
type GetOverboardResponse struct {
Threads []Threads `json:"threads"`
Threads []models.Post `json:"threads"`
}
func getOverboardQuery(options *GetOverboardOptions) (*url.Values, error) {

Loading…
Cancel
Save