2025-11-15 17:43:23 +00:00
|
|
|
package request
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"jaecoo-be/app/database/entity"
|
|
|
|
|
"jaecoo-be/utils/paginator"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type GalleriesQueryRequest struct {
|
|
|
|
|
Title *string `json:"title"`
|
|
|
|
|
Pagination *paginator.Pagination `json:"pagination"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-26 06:57:05 +00:00
|
|
|
|
2025-11-15 17:43:23 +00:00
|
|
|
type GalleriesQueryRequestContext struct {
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-26 06:57:05 +00:00
|
|
|
type CommentRequest struct {
|
|
|
|
|
Message string `json:"message"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-15 17:43:23 +00:00
|
|
|
func (req GalleriesQueryRequestContext) ToParamRequest() GalleriesQueryRequest {
|
|
|
|
|
var request GalleriesQueryRequest
|
|
|
|
|
|
|
|
|
|
if title := req.Title; title != "" {
|
|
|
|
|
request.Title = &title
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return request
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type GalleriesCreateRequest struct {
|
|
|
|
|
Title string `json:"title" validate:"required"`
|
|
|
|
|
Description *string `json:"description"`
|
|
|
|
|
ThumbnailPath *string `json:"thumbnail_path"`
|
2026-02-03 11:10:10 +00:00
|
|
|
Category string `json:"category" validate:"required"`
|
2026-02-03 10:44:24 +00:00
|
|
|
|
2025-11-15 17:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (req GalleriesCreateRequest) ToEntity() *entity.Galleries {
|
|
|
|
|
return &entity.Galleries{
|
|
|
|
|
Title: req.Title,
|
|
|
|
|
Description: req.Description,
|
|
|
|
|
ThumbnailPath: req.ThumbnailPath,
|
2026-02-03 11:10:10 +00:00
|
|
|
Category: req.Category,
|
2025-11-15 17:43:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type GalleriesUpdateRequest struct {
|
|
|
|
|
Title *string `json:"title"`
|
|
|
|
|
Description *string `json:"description"`
|
|
|
|
|
ThumbnailPath *string `json:"thumbnail_path"`
|
2026-02-03 11:10:10 +00:00
|
|
|
Category string `json:"category" validate:"required"`
|
2025-11-15 17:43:23 +00:00
|
|
|
IsActive *bool `json:"is_active"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-03 10:44:24 +00:00
|
|
|
|
|
|
|
|
|
2025-11-15 17:43:23 +00:00
|
|
|
func (req GalleriesUpdateRequest) ToEntity() *entity.Galleries {
|
|
|
|
|
return &entity.Galleries{
|
|
|
|
|
Title: getStringValue(req.Title),
|
|
|
|
|
Description: req.Description,
|
|
|
|
|
ThumbnailPath: req.ThumbnailPath,
|
2026-02-03 11:10:10 +00:00
|
|
|
Category: req.Category,
|
2025-11-15 17:43:23 +00:00
|
|
|
IsActive: req.IsActive,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getStringValue(s *string) string {
|
|
|
|
|
if s == nil {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
return *s
|
|
|
|
|
}
|
|
|
|
|
|