blog

package
v0.0.0-...-73eed44 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlogController

type BlogController struct {
	// contains filtered or unexported fields
}

func NewBlogController

func NewBlogController(br BlogRepository, auth auth.Auth, ur user.UserRepository) BlogController

func (BlogController) CreateBlogPost

func (bc BlogController) CreateBlogPost(c *gin.Context)

func (BlogController) GetBlogPost

func (bc BlogController) GetBlogPost(c *gin.Context)

func (BlogController) GetBlogPostsByAdmin

func (bc BlogController) GetBlogPostsByAdmin(c *gin.Context)

func (BlogController) GetPublishedBlogPosts

func (bc BlogController) GetPublishedBlogPosts(c *gin.Context)

type BlogPost

type BlogPost struct {
	Id        primitive.ObjectID `bson:"_id"`
	Title     string
	Content   string
	AuthorId  primitive.ObjectID
	Status    string
	CreatedAt int64
	UpdatedAt int64
}

type BlogRepository

type BlogRepository struct {
	Client *mongo.Client
}

func NewBlogRepository

func NewBlogRepository(client *mongo.Client) BlogRepository

func (BlogRepository) CreateBlogPost

func (br BlogRepository) CreateBlogPost(blogPost *BlogPost) (*BlogPost, error)

func (BlogRepository) GetBlogPost

func (br BlogRepository) GetBlogPost(id string) (*BlogPost, error)

func (BlogRepository) GetBlogPosts

func (br BlogRepository) GetBlogPosts(filter interface{}, options *options.FindOptions) (*[]BlogPost, error)

func (BlogRepository) UpdateBlogPost

func (br BlogRepository) UpdateBlogPost(blogPost *BlogPost) (*BlogPost, error)

type GetBlogPostRequest

type GetBlogPostRequest struct {
	Id string
}

type GetBlogPostResponse

type GetBlogPostResponse struct {
	Id              string
	Title           string
	Content         string
	AuthorFirstName string
	AuthorLastName  string
}

type GetPublishedBlogPostsRequest

type GetPublishedBlogPostsRequest struct {
	Skip  int64
	Limit int64
}

type IBlogRepository

type IBlogRepository interface {
	CreateBlogPost(blogPost *BlogPost) (*BlogPost, error)
	GetBlogPost(id string) (*BlogPost, error)
	GetBlogPosts(filter interface{}, options options.FindOptions) (*[]BlogPost, error)
	UpdateBlogPost(blogPost *BlogPost) (*BlogPost, error)
}

Jump to

Keyboard shortcuts

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