types

package
v0.0.0-...-e5d5354 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPageSize = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Blog

type Blog struct {
	ID            int
	Title         string
	Content       string
	ThumbnailPath string
	Category      Category
	User          User
	Likes         Likes
	CreatedAt     time.Time
}

type BlogStore

type BlogStore interface {
	GetCategories() ([]Category, error)
	GetBlogs(offset, limit int, searchQuery, category string) ([]Blog, int, error)
	GetLatestBlogs() ([]Blog, error)
	GetBlogByID(blogID, userID int) (*Blog, error)
	CreateBlog(blog Blog) (int, error)
	CreateLike(userID, blogID, value int) error
	UpdateLike(userID, blogID, value int) error
	GetBlogLikes(userID, blogID int) (*Likes, error)
}

type Category

type Category struct {
	ID   int
	Name string
}

type Comment

type Comment struct {
	ID        int
	Content   string
	ParentID  int
	User      User
	Blog      Blog
	Likes     Likes
	Replies   []Comment
	CreatedAt time.Time
}

type CommentStore

type CommentStore interface {
	CreateComment(comment Comment) (int, error)
	GetCommentsByBlogID(blogID, userID int) ([]Comment, error)
	GetCommentLikes(commentID, userID int) (*Likes, error)
	CreateLike(value, commentID, userID int) error
	UpdateLike(value, commentID, userID int) error
}

type Likes

type Likes struct {
	Count         int
	UserLiked     bool
	UserLikeValue int
}

type Profile

type Profile struct {
	Username    string
	Bio         string
	AvatarPath  string
	NumComments int
	NumBogs     int
	IsOwner     bool
	CreatedAt   time.Time
}

type S3Uploader

type S3Uploader interface {
	PutObject(file io.Reader, filename, directory string) (string, error)
}

type User

type User struct {
	ID         int
	Username   string
	Email      string
	Password   string
	Bio        string
	AvatarPath string
	CreatedAt  time.Time
}

type UserStore

type UserStore interface {
	GetUserByEmail(email string) (*User, error)
	GetUserByID(id int) (*User, error)
	GetProfileByID(id int) (*Profile, error)
	CreateUser(user User) (int, error)
	UpdateUser(user User) (*User, error)
}

Jump to

Keyboard shortcuts

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