micrach/repositories/structs.go

69 lines
1.7 KiB
Go
Raw Normal View History

package repositories
import "time"
// DB Structs
// DB Structs
// DB Structs
type Post struct {
ID int `json:"id"`
2021-08-31 19:48:02 +03:00
IsParent bool `json:"-"`
ParentID int `json:"parentId"`
IsDeleted bool `json:"-"`
Title string `json:"title"`
Text string `json:"text"`
IsSage bool `json:"isSage"`
Files []File `json:"files"`
CreatedAt time.Time `json:"createdAt"`
2021-08-31 19:48:02 +03:00
UpdatedAt time.Time `json:"-"`
}
type File struct {
ID int `json:"-"`
PostID int `json:"-"`
CreatedAt time.Time `json:"-"`
Name string `json:"name"`
Ext string `json:"-"`
Size int `json:"size"`
}
2021-09-10 02:17:45 +03:00
// HTML Templates Structs
// HTML Templates Structs
// HTML Templates Structs
// post-form.html
type HtmlFormData struct {
FirstPostID int
CaptchaID string
IsCaptchaActive bool
}
// thread.html
type GetThreadHtmlData struct {
Thread []Post
FormData HtmlFormData
}
// index.html
type GetThreadsHtmlData struct {
2022-01-26 20:37:14 +03:00
Threads []Post `json:"threads"`
PagesCount int `json:"pagesCount"`
Page int `json:"page"`
FormData HtmlFormData
2021-09-10 02:17:45 +03:00
}
// 400.html
type BadRequestHtmlData struct {
Message string
}
2021-10-10 10:42:28 +03:00
const InvalidCaptchaErrorMessage = "INVALID CAPTCHA"
const InvalidTextOrFilesErrorMessage = "TEXT OR FILES SHOULD NOT BE EMPTY"
const InvalidTitleLengthErrorMessage = "TITLE SHOULD NOT EXCEED 100 CHARS"
const InvalidTextLengthErrorMessage = "TEXT SHOULD NOT EXCEED 1000 CHARS"
const InvalidFilesLengthErrorMessage = "MAXIMUM 4 FILES CAN BE UPLOADED"
2021-10-10 11:11:31 +03:00
const InvalidFileSizeErrorMessage = "FILE SIZE EXCIDED (3MB PER FILE)"
const InvalidFileExtErrorMessage = "AVALIABLE FILE EXT: PNG, JPG"
const ThreadIsArchivedErrorMessage = "THREAD IS ARCHIVED"