photo

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Service Service
}

func (Controller) ListRoutes

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

type Dao

type Dao interface {
	GetPhotoByIdAs(photoId uuid.UUID, userId uuid.UUID) (*EntityPhotoAuthorInfo, error)
	NewPhotoPerUser(photoId uuid.UUID, userId uuid.UUID, imageUrl string) error
	DeletePhoto(imageUuid uuid.UUID) error
	GetPhotoById(imageUuid uuid.UUID) (*EntityPhotoInfo, error)
	ListUsersPhotoAfter(authorUuid uuid.UUID, searchAsUuid uuid.UUID, afterPhotoId uuid.UUID, beforeDate string) ([]EntityPhotoAuthorInfo, error)
}

type DbDao

type DbDao struct {
	Time timeprovider.TimeProvider
	Db   database.AppDatabase
}

func (DbDao) DeletePhoto

func (db DbDao) DeletePhoto(imageUuid uuid.UUID) error

func (DbDao) GetPhotoById

func (db DbDao) GetPhotoById(imageUuid uuid.UUID) (*EntityPhotoInfo, error)

func (DbDao) GetPhotoByIdAs

func (db DbDao) GetPhotoByIdAs(photoId uuid.UUID, userId uuid.UUID) (*EntityPhotoAuthorInfo, error)

func (DbDao) ListUsersPhotoAfter

func (db DbDao) ListUsersPhotoAfter(authorUuid uuid.UUID, searchAsUuid uuid.UUID, afterPhotoId uuid.UUID, beforeDate string) ([]EntityPhotoAuthorInfo, error)

func (DbDao) NewPhotoPerUser

func (db DbDao) NewPhotoPerUser(photoId uuid.UUID, userId uuid.UUID, imageUrl string) error

type EntityPhotoAuthorInfo

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

func ParsePhotoEntity

func ParsePhotoEntity(rows database.StructRows) ([]EntityPhotoAuthorInfo, error)

type EntityPhotoInfo

type EntityPhotoInfo struct {
	LikesCount    uint `json:"likesCount"`
	CommentsCount uint `json:"commentsCount"`
	// contains filtered or unexported fields
}

type IdParam

type IdParam struct {
	PhotoId string `json:"photoId" validate:"required,uuid"`
}

type Photo

type Photo struct {
	Id            string    `json:"id"`
	Author        user.User `json:"author"`
	PublishDate   time.Time `json:"publishDate"`
	LikesCount    uint      `json:"likesCount"`
	CommentsCount uint      `json:"commentsCount"`
	Liked         bool      `json:"liked"`
	ImageUrl      string    `json:"imageUrl"`
}

func DbPhotosListToPage

func DbPhotosListToPage(dbPhotos []EntityPhotoAuthorInfo) (photos []Photo, pageCursor *string)

func (*Photo) AddImageHost

func (photo *Photo) AddImageHost(r *http.Request, logger logrus.FieldLogger)

type Service

type Service interface {
	CreatePost(userId string, imageData []byte, logger logrus.FieldLogger) (Photo, error)
	DeletePostAs(imageId string, userId string) error
	GetPostAuthorById(imageId string) (string, error)
	GetUsersPhotosPage(id string, searchAs string, cursor string) ([]Photo, *string, error)
	GetPhotoByIdAs(photoId string, searchAs string) (*Photo, error)
}

type ServiceImpl

type ServiceImpl struct {
	Db             Dao
	Storage        storage.Storage
	ImageProcessor imageProcessor
	UserService    user.Service
	BanService     user.BanService
}

func (ServiceImpl) CreatePost

func (service ServiceImpl) CreatePost(userId string, imageData []byte, logger logrus.FieldLogger) (Photo, error)

func (ServiceImpl) DeletePostAs

func (service ServiceImpl) DeletePostAs(imageId string, userId string) error

func (ServiceImpl) GetPhotoByIdAs

func (service ServiceImpl) GetPhotoByIdAs(photoId string, searchAs string) (*Photo, error)

func (ServiceImpl) GetPostAuthorById

func (service ServiceImpl) GetPostAuthorById(imageId string) (string, error)

func (ServiceImpl) GetUsersPhotosPage

func (service ServiceImpl) GetUsersPhotosPage(id string, searchAs string, pageCursor string) ([]Photo, *string, error)

type UserPhotosCursor

type UserPhotosCursor struct {
	api.PaginationInfo
	user.IdParams
}

Jump to

Keyboard shortcuts

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