38 lines
1009 B
Go
38 lines
1009 B
Go
// models/common.go
|
|
package models
|
|
|
|
import "time"
|
|
|
|
// Общая структура для информации об авторе
|
|
type AuthorInfo struct {
|
|
ID uint `json:"id"`
|
|
FirstName string `json:"first_name"`
|
|
LastName string `json:"last_name"`
|
|
Avatar string `json:"avatar,omitempty"`
|
|
Email string `json:"email,omitempty"` // Добавляем email
|
|
}
|
|
|
|
// DTO для пагинации
|
|
type PaginationRequest struct {
|
|
Page int `form:"page" validate:"min=1" default:"1"`
|
|
PerPage int `form:"per_page" validate:"min=1,max=100" default:"10"`
|
|
}
|
|
|
|
type PaginationResponse struct {
|
|
Page int `json:"page"`
|
|
PerPage int `json:"per_page"`
|
|
Total int `json:"total"`
|
|
TotalPages int `json:"total_pages"`
|
|
}
|
|
|
|
// DTO для фильтров
|
|
type DateRangeFilter struct {
|
|
StartDate *time.Time `form:"start_date"`
|
|
EndDate *time.Time `form:"end_date"`
|
|
}
|
|
|
|
type WorkoutFilter struct {
|
|
DateRangeFilter
|
|
Type string `form:"type"`
|
|
UserID uint `form:"user_id"`
|
|
} |