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-03-27 18:17:07 +01:00
|
|
|
Query string `form:"q"`
|
|
|
|
ID string `form:"id"`
|
|
|
|
Title string `form:"title"`
|
|
|
|
Hash string `form:"hash"`
|
2020-05-14 19:03:12 +02:00
|
|
|
Video bool `form:"video"`
|
|
|
|
Photo bool `form:"photo"`
|
2020-03-27 18:17:07 +01:00
|
|
|
Duplicate bool `form:"duplicate"`
|
|
|
|
Archived bool `form:"archived"`
|
|
|
|
Error bool `form:"error"`
|
2020-04-26 11:41:54 +02:00
|
|
|
Lat float32 `form:"lat"`
|
|
|
|
Lng float32 `form:"lng"`
|
2020-03-27 18:17:07 +01:00
|
|
|
Dist uint `form:"dist"`
|
2020-04-26 11:41:54 +02:00
|
|
|
Fmin float32 `form:"fmin"`
|
|
|
|
Fmax float32 `form:"fmax"`
|
2020-04-11 12:14:37 +02:00
|
|
|
Chroma uint8 `form:"chroma"`
|
|
|
|
Diff uint32 `form:"diff"`
|
2020-03-27 18:17:07 +01:00
|
|
|
Mono bool `form:"mono"`
|
|
|
|
Portrait bool `form:"portrait"`
|
|
|
|
Location bool `form:"location"`
|
|
|
|
Album string `form:"album"`
|
|
|
|
Label string `form:"label"`
|
2020-05-14 19:03:12 +02:00
|
|
|
Country string `form:"country"`
|
|
|
|
Year uint `form:"year"`
|
|
|
|
Month uint `form:"month"`
|
|
|
|
Color string `form:"color"`
|
|
|
|
Quality int `form:"quality"`
|
|
|
|
Review bool `form:"review"`
|
|
|
|
Camera int `form:"camera"`
|
|
|
|
Lens int `form:"lens"`
|
|
|
|
Before time.Time `form:"before" time_format:"2006-01-02"`
|
|
|
|
After time.Time `form:"after" time_format:"2006-01-02"`
|
|
|
|
Favorite bool `form:"favorite"`
|
|
|
|
Public bool `form:"public"`
|
|
|
|
Private bool `form:"private"`
|
|
|
|
Safe bool `form:"safe"`
|
|
|
|
Count int `form:"count" binding:"required"`
|
|
|
|
Offset int `form:"offset"`
|
|
|
|
Order string `form:"order"`
|
|
|
|
Merged bool `form:"merged"`
|
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}
|
|
|
|
}
|