41 lines
859 B
Go
41 lines
859 B
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Participant struct {
|
|
Id int32 `db:"id"`
|
|
UserId int32 `db:"user_id"`
|
|
ContestId int32 `db:"contest_id"`
|
|
Name string `db:"name"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at"`
|
|
}
|
|
|
|
type ParticipantsListItem struct {
|
|
Id int32 `db:"id"`
|
|
UserId int32 `db:"user_id"`
|
|
ContestId int32 `db:"contest_id"`
|
|
Name string `db:"name"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at"`
|
|
}
|
|
|
|
type ParticipantsList struct {
|
|
Participants []*ParticipantsListItem
|
|
Pagination Pagination
|
|
}
|
|
|
|
type ParticipantsFilter struct {
|
|
Page int32
|
|
PageSize int32
|
|
|
|
ContestId int32
|
|
}
|
|
|
|
func (f ParticipantsFilter) Offset() int32 {
|
|
return (f.Page - 1) * f.PageSize
|
|
}
|
|
|
|
type ParticipantUpdate struct {
|
|
Name *string `json:"name"`
|
|
}
|