Documentation ¶
Index ¶
- type Comment
- type CommentFull
- type List
- type Repository
- type RepositoryImpl
- type ServerImpl
- type Service
- type ServiceImpl
- func (s *ServiceImpl) CreateComment(ctx context.Context, comment *Comment) (*Comment, error)
- func (s *ServiceImpl) GetByHotelID(ctx context.Context, hotelID uuid.UUID, page, size int64) (*List, error)
- func (s *ServiceImpl) GetCommByID(ctx context.Context, commentID uuid.UUID) (*Comment, error)
- func (s *ServiceImpl) UpdateComment(ctx context.Context, comment *Comment) (*Comment, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` Message string `json:"message" validate:"required,min=5,max=500"` Photos []string `json:"photos,omitempty"` Rating float64 `json:"rating" validate:"required,min=0,max=10"` CommentID uuid.UUID `json:"comment_id"` HotelID uuid.UUID `json:"hotel_id"` UserID uuid.UUID `json:"user_id"` }
type CommentFull ¶
type CommentFull struct { User *users.CommentUser `json:"user"` CreatedAt *time.Time `json:"createdAt"` UpdatedAt *time.Time `json:"updatedAt"` Message string `json:"message"` Photos []string `json:"photos"` Rating float64 `json:"rating"` CommentID uuid.UUID `json:"comment_id"` HotelID uuid.UUID `json:"hotel_id"` }
type Repository ¶
type RepositoryImpl ¶
type RepositoryImpl struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(redisConn *redis.Client) RepositoryImpl
func (*RepositoryImpl) CommentByID ¶
func (*RepositoryImpl) DeleteComment ¶
func (*RepositoryImpl) SetComment ¶
func (c *RepositoryImpl) SetComment(ctx context.Context, comment *Comment) error
type ServerImpl ¶
type ServerImpl struct {
// contains filtered or unexported fields
}
func (*ServerImpl) CreateComment ¶
func (s *ServerImpl) CreateComment() echo.HandlerFunc
Register CreateComment @Tags Comments @Summary Create new comment @Description Create new single comment @Accept json @Produce json @Success 201 {object} Comment @Router /api/v1/comments [post]
func (*ServerImpl) GetByHotelID ¶
func (s *ServerImpl) GetByHotelID() echo.HandlerFunc
Register GetByHotelID @Tags Comments @Summary Get comments by hotel id @Description Get comments list by hotel uuid @Accept json @Produce json @Param hotel_id query string false "hotel uuid" @Success 200 {object} List @Router /api/v1/comments/hotel/{hotel_id} [get]
func (*ServerImpl) GetCommByID ¶
func (s *ServerImpl) GetCommByID() echo.HandlerFunc
Register GetCommByID @Tags Comments @Summary Get comment by id @Description Get comment by uuid @Accept json @Produce json @Param comment_id query string false "comment uuid" @Success 200 {object} Comment @Router /api/v1/comments/{comment_id} [get]
func (*ServerImpl) MapRoutes ¶
func (s *ServerImpl) MapRoutes(mw *users.SessionMiddleware)
func (*ServerImpl) UpdateComment ¶
func (s *ServerImpl) UpdateComment() echo.HandlerFunc
Register UpdateComment @Tags Comments @Summary Update comment by id @Description Update comment by uuid @Accept json @Produce json @Param comment_id query string false "comment uuid" @Success 200 {object} Comment @Router /api/v1/comments/{comment_id} [put]
type Service ¶
type Service interface { CreateComment(ctx context.Context, comment *Comment) (*Comment, error) GetCommByID(ctx context.Context, commentID uuid.UUID) (*Comment, error) UpdateComment(ctx context.Context, comment *Comment) (*Comment, error) GetByHotelID(ctx context.Context, hotelID uuid.UUID, page, size int64) (*List, error) }
type ServiceImpl ¶
type ServiceImpl struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService( logger logger.Logger, repository Repository, ) ServiceImpl