photoprism/internal/form/search_subjects.go

36 lines
929 B
Go
Raw Normal View History

2021-09-02 14:12:31 +00:00
package form
// SearchSubjects represents search form fields for "/api/v1/subjects".
type SearchSubjects struct {
2021-09-02 14:12:31 +00:00
Query string `form:"q"`
UID string `form:"uid"`
2021-09-02 14:12:31 +00:00
Type string `form:"type"`
Name string `form:"name"`
All bool `form:"all"`
Hidden string `form:"hidden"`
Favorite string `form:"favorite"`
Private string `form:"private"`
Excluded string `form:"excluded"`
Files int `form:"files"`
Photos int `form:"photos"`
2021-09-02 14:12:31 +00:00
Count int `form:"count" binding:"required" serialize:"-"`
Offset int `form:"offset" serialize:"-"`
Order string `form:"order" serialize:"-"`
}
func (f *SearchSubjects) GetQuery() string {
2021-09-02 14:12:31 +00:00
return f.Query
}
func (f *SearchSubjects) SetQuery(q string) {
2021-09-02 14:12:31 +00:00
f.Query = q
}
func (f *SearchSubjects) ParseQueryString() error {
2021-09-02 14:12:31 +00:00
return ParseQueryString(f)
}
func NewSubjectSearch(query string) SearchSubjects {
return SearchSubjects{Query: query}
2021-09-02 14:12:31 +00:00
}