models

package
v0.0.0-...-abc7074 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	PostAttached int64  `json:"postAttached,omitempty"`
}

type Comment

type Comment struct {
	ID        int64  `json:"id"`
	PostID    int64  `json:"post_id"`
	AuthorID  int64  `json:"-"`
	Content   string `json:"content"`
	CreatedAt int64  `json:"createdAt"`
	Author    *User  `json:"author"`
}

type InputComment

type InputComment struct {
	ID      int64  `json:"id"`
	PostID  int64  `json:"post_id"`
	Content string `json:"content"`
}

type InputFilterPost

type InputFilterPost struct {
	Option     string   `json:"option"`   // categories or date or rating or author
	AuthorID   int64    `json:"authorID"` // getAllPosts created by AuthorID
	Date       string   `json:"date"`     // ASC or DESC
	Rating     string   `json:"rating"`   // ASC or DESC
	Categories []string `json:"categories"`
	UserRating string   `json:"userRating"` // upvoted or downvoted
}

type InputFindComment

type InputFindComment struct {
	Option string `json:"option"` // user or post
	PostID int64  `json:"post_id"`
	UserID int64  `json:"user_id"`
}

type InputPost

type InputPost struct {
	ID         int64    `json:"id"`
	Title      string   `json:"title"`
	Content    string   `json:"content"`
	Categories []string `json:"categories"`
}

type InputRate

type InputRate struct {
	ID       int64 `json:"id"`       // postID
	Reaction int   `json:"reaction"` // 1 or -1
}

type InputUserSignIn

type InputUserSignIn struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type InputUserSignUp

type InputUserSignUp struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Email    string `json:"email"`
}

type Post

type Post struct {
	ID             int64      `json:"id"`
	AuthorID       int64      `json:"-"`
	Author         *User      `json:"author"`
	Title          string     `json:"title"`
	Content        string     `json:"content"`
	Categories     []Category `json:"categories"`
	PostRating     int        `json:"postRating"`
	UserRating     int        `json:"userRating"`
	CreatedAt      int64      `json:"createdAt,omitempty"`
	CommentsNumber int        `json:"commentsNumber"`
}

type PostRating

type PostRating struct {
	ID     int   `json:"id"`
	UserID int64 `json:"userID"`
	PostID int64 `json:"postID"`
	Rate   int   `json:"rate"`
}

type Rating

type Rating struct {
	Rating     int `json:"rating"`
	UserRating int `json:"userRating"`
}

type User

type User struct {
	ID         int64  `json:"id"`
	Username   string `json:"username"`
	Password   string `json:"password,omitempty"`
	Email      string `json:"email"`
	CreatedAt  int64  `json:"createdAt,omitempty"`
	LastActive int64  `json:"lastActive,omitempty"`
	SessionID  string `json:"sessionID,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL