2019-12-05 19:21:35 +01:00
|
|
|
package form
|
2018-08-15 09:59:51 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2020-01-15 04:04:33 +01:00
|
|
|
// PhotoSearch represents search form fields for "/api/v1/photos".
|
2019-12-05 19:21:35 +01:00
|
|
|
type PhotoSearch struct {
|
2020-01-15 19:59:25 +01:00
|
|
|
Query string `form:"q"`
|
2020-01-30 09:51:23 +01:00
|
|
|
ID string `form:"id"`
|
2019-12-20 23:05:44 +01:00
|
|
|
Title string `form:"title"`
|
|
|
|
Hash string `form:"hash"`
|
|
|
|
Duplicate bool `form:"duplicate"`
|
2020-01-09 02:09:54 +01:00
|
|
|
Archived bool `form:"archived"`
|
2020-01-29 17:41:51 +01:00
|
|
|
Error bool `form:"error"`
|
2019-12-20 23:05:44 +01:00
|
|
|
Lat float64 `form:"lat"`
|
|
|
|
Lng float64 `form:"lng"`
|
|
|
|
Dist uint `form:"dist"`
|
|
|
|
Fmin float64 `form:"fmin"`
|
|
|
|
Fmax float64 `form:"fmax"`
|
|
|
|
Chroma uint `form:"chroma"`
|
|
|
|
Mono bool `form:"mono"`
|
|
|
|
Portrait bool `form:"portrait"`
|
|
|
|
Location bool `form:"location"`
|
|
|
|
Album string `form:"album"`
|
|
|
|
Label string `form:"label"`
|
|
|
|
Country string `form:"country"`
|
2019-12-28 23:06:44 +01:00
|
|
|
Year uint `form:"year"`
|
|
|
|
Month uint `form:"month"`
|
2019-05-16 02:22:38 +02:00
|
|
|
Color string `form:"color"`
|
|
|
|
Camera int `form:"camera"`
|
2019-12-28 23:06:44 +01:00
|
|
|
Lens int `form:"lens"`
|
2019-05-16 02:22:38 +02:00
|
|
|
Before time.Time `form:"before" time_format:"2006-01-02"`
|
|
|
|
After time.Time `form:"after" time_format:"2006-01-02"`
|
|
|
|
Favorites bool `form:"favorites"`
|
2019-12-11 14:10:20 +01:00
|
|
|
Public bool `form:"public"`
|
|
|
|
Story bool `form:"story"`
|
|
|
|
Safe bool `form:"safe"`
|
2020-01-06 05:45:03 +01:00
|
|
|
Nsfw bool `form:"nsfw"`
|
2020-01-15 19:59:25 +01:00
|
|
|
Count int `form:"count" binding:"required"`
|
|
|
|
Offset int `form:"offset"`
|
|
|
|
Order string `form:"order"`
|
2019-05-15 21:51:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-15 04:04:33 +01:00
|
|
|
func (f *PhotoSearch) GetQuery() string {
|
|
|
|
return f.Query
|
|
|
|
}
|
2019-05-15 21:51:00 +02:00
|
|
|
|
2020-01-15 04:04:33 +01:00
|
|
|
func (f *PhotoSearch) SetQuery(q string) {
|
|
|
|
f.Query = q
|
|
|
|
}
|
2019-05-15 23:07:25 +02:00
|
|
|
|
2020-01-15 04:04:33 +01:00
|
|
|
func (f *PhotoSearch) ParseQueryString() error {
|
|
|
|
return ParseQueryString(f)
|
2018-08-15 09:59:51 +02:00
|
|
|
}
|
2020-02-02 13:01:26 +01:00
|
|
|
|
|
|
|
func NewPhotoSearch(query string) PhotoSearch {
|
|
|
|
return PhotoSearch{Query: query}
|
|
|
|
}
|