handlers

package
v0.0.0-...-8306474 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommentsHandler

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

func NewCommentsHandler

func NewCommentsHandler(db datastore.Database) CommentsHandler

func (CommentsHandler) Count

func (ch CommentsHandler) Count(c *gin.Context)

func (CommentsHandler) Create

func (ch CommentsHandler) Create(c *gin.Context)

func (CommentsHandler) Delete

func (ch CommentsHandler) Delete(c *gin.Context)

func (CommentsHandler) List

func (ch CommentsHandler) List(c *gin.Context)

type CountCommentsRequest

type CountCommentsRequest struct {
	PostID string `uri:"post_id" binding:"required,uuid"`
}

type CountCommentsResponse

type CountCommentsResponse struct {
	Count uint64 `json:"count"`
}

type CreateCommentRequest

type CreateCommentRequest struct {
	// UserID string `json:"user_id" binding:"required,uuid"`
	// PostID string `uri:"post_id" binding:"required,uuid"`
	// Text string `json:"text" binding:"required"`
	PostID struct {
		PostID string `uri:"post_id" json:"post_id" binding:"required,uuid"`
	}
	Text struct {
		Text string `json:"text" binding:"required"`
	}
}

Comments

type CreateCommentResponse

type CreateCommentResponse struct {
}

type CreateLikeRequest

type CreateLikeRequest struct {
	// UserID string `json:"user_id" binding:"required,uuid"`
	PostID string `uri:"post_id" binding:"required,uuid"`
}

Likes

type CreateLikeResponse

type CreateLikeResponse struct {
}

type CreatePostRequest

type CreatePostRequest struct {
	Title string `json:"title" binding:"required"`
	URL   string `json:"url" binding:"required,url"`
}

type CreatePostResponse

type CreatePostResponse struct {
}

type DeleteCommentRequest

type DeleteCommentRequest struct {
	ID string `uri:"id" binding:"required,uuid"`
}

type DeleteCommentResponse

type DeleteCommentResponse struct {
}

type DeleteLikeRequest

type DeleteLikeRequest struct {
	PostID string `uri:"post_id" binding:"required,uuid"`
}

type DeleteLikeResponse

type DeleteLikeResponse struct {
}

type DeletePostRequest

type DeletePostRequest struct {
	PostID string `uri:"id" binding:"required,uuid"`
}

type DeletePostResponse

type DeletePostResponse struct {
}

type GetCurrentUserResponse

type GetCurrentUserResponse struct {
	User
}

type GetPostRequest

type GetPostRequest struct {
	PostID string `uri:"id" binding:"required,uuid"`
}

type GetPostResponse

type GetPostResponse struct {
	Post *types.Post `json:"post"`
}

type GetUserRequest

type GetUserRequest struct {
	ID string `uri:"id" binding:"required,uuid"`
}

type GetUserResponse

type GetUserResponse struct {
	ID        string `json:"id"`
	Username  string `json:"username"`
	Firstname string `json:"firstname"`
	Lastname  string `json:"lastname"`
}

type LikesHandler

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

func NewLikesHandler

func NewLikesHandler(db datastore.Database) LikesHandler

func (LikesHandler) Create

func (lh LikesHandler) Create(c *gin.Context)

func (LikesHandler) Delete

func (lh LikesHandler) Delete(c *gin.Context)

func (LikesHandler) List

func (lh LikesHandler) List(c *gin.Context)

type ListCommentsRequest

type ListCommentsRequest struct {
	PostID string `uri:"post_id" binding:"required,uuid"`
}

type ListCommentsResponse

type ListCommentsResponse struct {
	Comments []*types.Comment `json:"comments"`
}

type ListLikesRequest

type ListLikesRequest struct {
	PostID string `uri:"post_id" binding:"required,uuid"`
}

type ListLikesResponse

type ListLikesResponse struct {
	Likes uint64 `json:"likes"`
}

type ListPostsRequest

type ListPostsRequest struct {
}

Posts

type ListPostsResponse

type ListPostsResponse struct {
	Posts []*types.Post `json:"posts"`
}

type PostsHandler

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

func NewPostsHandler

func NewPostsHandler(db datastore.Database) PostsHandler

func (PostsHandler) Create

func (ph PostsHandler) Create(c *gin.Context)

func (PostsHandler) Delete

func (ph PostsHandler) Delete(c *gin.Context)

func (PostsHandler) Get

func (ph PostsHandler) Get(c *gin.Context)

func (PostsHandler) List

func (ph PostsHandler) List(c *gin.Context)

type SigninRequest

type SigninRequest struct {
	Login    string `json:"login" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type SigninResponse

type SigninResponse struct {
	User `json:"user"`
	JWT  string `json:"jwt"`
}

type SignupRequest

type SignupRequest struct {
	Firstname string `json:"firstname" binding:"required"`
	Lastname  string `json:"lastname" binding:"required"`
	Username  string `json:"username" binding:"required"`
	Email     string `json:"email" binding:"required,email"`
	Password  string `json:"password" binding:"required"`
}

Users

type SignupResponse

type SignupResponse struct {
	JWT string `json:"jwt"`
}

type User

type User struct {
	ID        string `json:"id"`
	Email     string `json:"email"`
	Username  string `json:"username"`
	Firstname string `json:"firstname"`
	Lastname  string `json:"lastname"`
}

type UsersHandler

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

func NewUsersHandler

func NewUsersHandler(db datastore.Database) UsersHandler

func (UsersHandler) GetCurrentUser

func (uh UsersHandler) GetCurrentUser(c *gin.Context)

func (UsersHandler) GetUser

func (uh UsersHandler) GetUser(c *gin.Context)

func (UsersHandler) Signin

func (uh UsersHandler) Signin(c *gin.Context)

func (UsersHandler) Signup

func (rh UsersHandler) Signup(c *gin.Context)

Jump to

Keyboard shortcuts

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