2019-12-05 19:21:35 +01:00
|
|
|
package form
|
2019-06-17 21:45:06 +02:00
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
// SearchAlbums represents search form fields for "/api/v1/albums".
|
|
|
|
type SearchAlbums struct {
|
2020-05-14 19:03:12 +02:00
|
|
|
Query string `form:"q"`
|
2021-12-16 11:42:57 +01:00
|
|
|
UID string `form:"uid"`
|
2020-05-29 12:21:17 +02:00
|
|
|
Type string `form:"type"`
|
2020-07-12 16:36:39 +02:00
|
|
|
Location string `form:"location"`
|
2020-05-29 12:21:17 +02:00
|
|
|
Category string `form:"category"`
|
2020-05-14 19:03:12 +02:00
|
|
|
Slug string `form:"slug"`
|
2020-05-26 09:02:19 +02:00
|
|
|
Title string `form:"title"`
|
|
|
|
Country string `json:"country"`
|
2023-01-02 16:17:59 +01:00
|
|
|
Year string `form:"year" example:"year:1990|2003" notes:"Year Number, OR search with |"`
|
|
|
|
Month string `form:"month" example:"month:7|10" notes:"Month (1-12), OR search with |"`
|
|
|
|
Day string `form:"day" example:"day:3|13" notes:"Day of Month (1-31), OR search with |"`
|
2020-05-14 19:03:12 +02:00
|
|
|
Favorite bool `form:"favorite"`
|
2022-08-31 17:42:57 +02:00
|
|
|
Public bool `form:"public"`
|
2020-05-26 09:02:19 +02:00
|
|
|
Private bool `form:"private"`
|
2020-05-23 20:58:58 +02:00
|
|
|
Count int `form:"count" binding:"required" serialize:"-"`
|
|
|
|
Offset int `form:"offset" serialize:"-"`
|
|
|
|
Order string `form:"order" serialize:"-"`
|
2019-06-17 21:45:06 +02:00
|
|
|
}
|
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
func (f *SearchAlbums) GetQuery() string {
|
2020-01-15 04:04:33 +01:00
|
|
|
return f.Query
|
|
|
|
}
|
2019-06-17 21:45:06 +02:00
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
func (f *SearchAlbums) SetQuery(q string) {
|
2020-01-15 04:04:33 +01:00
|
|
|
f.Query = q
|
|
|
|
}
|
2019-06-17 21:45:06 +02:00
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
func (f *SearchAlbums) ParseQueryString() error {
|
2020-01-15 04:04:33 +01:00
|
|
|
return ParseQueryString(f)
|
2019-06-17 21:45:06 +02:00
|
|
|
}
|
2020-01-27 16:53:09 +01:00
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
func NewAlbumSearch(query string) SearchAlbums {
|
|
|
|
return SearchAlbums{Query: query}
|
2020-01-27 16:53:09 +01:00
|
|
|
}
|