comments

package
v0.0.0-...-1967991 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	Id          string    `json:"id"`
	PublishDate time.Time `json:"publishDate"`
	Author      user.User `json:"author"`
	// contains filtered or unexported fields
}

type CommentIdWithAuthorAndPhoto

type CommentIdWithAuthorAndPhoto struct {
	CommentId       []byte `json:"commentId"`
	CommentAuthorId []byte `json:"commentAuthorId"`
	PhotoId         []byte `json:"photoId"`
	PhotoAuthorId   []byte `json:"photoAuthorId"`
}

CommentIdWithAuthorAndPhoto is a simple view with just the IDs

type Controller

type Controller struct {
	Service Service
}

func (Controller) ListRoutes

func (controller Controller) ListRoutes() []route.Route

type Dao

type Dao interface {
	CreateComment(newComment entityComment) error
	GetCommentByIdAs(commentId uuid.UUID, userId uuid.UUID) (*EntityCommentWithCustom, error)
	DeleteByIdPhotoAndAuthor(commentUuid uuid.UUID, photoUuid uuid.UUID, userUuid uuid.UUID) (bool, error)
	GetCommentInfoIds(commentUuid uuid.UUID) (*CommentIdWithAuthorAndPhoto, error)
	GetCommentsAfter(photoUuid uuid.UUID, userUuid uuid.UUID, afterComment uuid.UUID, beforeDate string) ([]EntityCommentWithCustom, error)
}

type DbDao

type DbDao struct {
	Db database.AppDatabase
}

func (DbDao) CreateComment

func (db DbDao) CreateComment(newComment entityComment) error

func (DbDao) DeleteByIdPhotoAndAuthor

func (db DbDao) DeleteByIdPhotoAndAuthor(commentUuid uuid.UUID, photoUuid uuid.UUID, userUuid uuid.UUID) (bool, error)

func (DbDao) GetCommentByIdAs

func (db DbDao) GetCommentByIdAs(commentId uuid.UUID, userId uuid.UUID) (*EntityCommentWithCustom, error)

func (DbDao) GetCommentInfoIds

func (db DbDao) GetCommentInfoIds(commentUuid uuid.UUID) (*CommentIdWithAuthorAndPhoto, error)

func (DbDao) GetCommentsAfter

func (db DbDao) GetCommentsAfter(photoUuid uuid.UUID, userUuid uuid.UUID, afterComment uuid.UUID, beforeDate string) ([]EntityCommentWithCustom, error)

type EntityCommentWithCustom

type EntityCommentWithCustom struct {
	user.ModelUserWithCustom
	// contains filtered or unexported fields
}

type Service

type Service interface {
	CommentPhoto(photoId string, userId string, comment newComment) (Comment, error)
	DeleteCommentOnPhotoIfAuthor(commentId string, photoId string, userId string) error
	GetCommentsPageAs(photoId string, userId string, pageCursor string) ([]Comment, *string, error)
}

type ServiceImpl

type ServiceImpl struct {
	Db           Dao
	BanService   user.BanService
	PhotoService photo.Service
	TimeProvider timeprovider.TimeProvider
}

func (ServiceImpl) CommentPhoto

func (service ServiceImpl) CommentPhoto(photoId string, userId string, comment newComment) (Comment, error)

func (ServiceImpl) DeleteCommentOnPhotoIfAuthor

func (service ServiceImpl) DeleteCommentOnPhotoIfAuthor(commentId string, photoId string, userId string) error

func (ServiceImpl) GetCommentsPageAs

func (service ServiceImpl) GetCommentsPageAs(photoId string, userId string, pageCursor string) ([]Comment, *string, error)

Jump to

Keyboard shortcuts

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