398 lines
11 KiB
Go
398 lines
11 KiB
Go
|
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
|
||
|
|
||
|
package model
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"strconv"
|
||
|
"time"
|
||
|
|
||
|
"github.com/99designs/gqlgen/graphql"
|
||
|
)
|
||
|
|
||
|
type Album struct {
|
||
|
ID *string `json:"id" gorm:"primarykey;not null"`
|
||
|
CreatedAt *time.Time `json:"createdAt" `
|
||
|
UpdatedAt *time.Time `json:"updatedAt" `
|
||
|
Name string `json:"name" gorm:"unique;not null"`
|
||
|
}
|
||
|
|
||
|
type AlbumFilter struct {
|
||
|
ID *IDFilter `json:"id" `
|
||
|
CreatedAt *TimeFilter `json:"createdAt" `
|
||
|
UpdatedAt *TimeFilter `json:"updatedAt" `
|
||
|
Name *StringFilter `json:"name" `
|
||
|
And *MediaItemFilter `json:"and" `
|
||
|
Or *MediaItemFilter `json:"or" `
|
||
|
}
|
||
|
|
||
|
type AlbumResponse struct {
|
||
|
Data []*Album `json:"data" `
|
||
|
PageInfo *PageInfo `json:"pageInfo" `
|
||
|
}
|
||
|
|
||
|
type AuthTypeFilter struct {
|
||
|
EqualTo *AuthType `json:"equalTo" `
|
||
|
NotEqualTo *AuthType `json:"notEqualTo" `
|
||
|
In []AuthType `json:"in" `
|
||
|
NotIn []AuthType `json:"notIn" `
|
||
|
}
|
||
|
|
||
|
type BooleanFilter struct {
|
||
|
EqualTo *bool `json:"equalTo" `
|
||
|
NotEqualTo *bool `json:"notEqualTo" `
|
||
|
}
|
||
|
|
||
|
type Device struct {
|
||
|
ID *string `json:"id" gorm:"primarykey;not null"`
|
||
|
CreatedAt *time.Time `json:"createdAt" `
|
||
|
UpdatedAt *time.Time `json:"updatedAt" `
|
||
|
Name string `json:"name" gorm:"not null"`
|
||
|
Type DeviceType `json:"type" gorm:"default:Unknown;not null"`
|
||
|
User *User `json:"user" gorm:"ForeignKey:ID;not null"`
|
||
|
RefreshKey *string `json:"refreshKey" `
|
||
|
}
|
||
|
|
||
|
type DeviceFilter struct {
|
||
|
ID *IDFilter `json:"id" `
|
||
|
CreatedAt *TimeFilter `json:"createdAt" `
|
||
|
UpdatedAt *TimeFilter `json:"updatedAt" `
|
||
|
Name *StringFilter `json:"name" `
|
||
|
Type *DeviceTypeFilter `json:"type" `
|
||
|
And *MediaItemFilter `json:"and" `
|
||
|
Or *MediaItemFilter `json:"or" `
|
||
|
}
|
||
|
|
||
|
type DeviceResponse struct {
|
||
|
Data []*Device `json:"data" `
|
||
|
PageInfo *PageInfo `json:"pageInfo" `
|
||
|
}
|
||
|
|
||
|
type DeviceTypeFilter struct {
|
||
|
EqualTo *DeviceType `json:"equalTo" `
|
||
|
NotEqualTo *DeviceType `json:"notEqualTo" `
|
||
|
In []DeviceType `json:"in" `
|
||
|
NotIn []DeviceType `json:"notIn" `
|
||
|
}
|
||
|
|
||
|
type FloatFilter struct {
|
||
|
EqualTo *float64 `json:"equalTo" `
|
||
|
NotEqualTo *float64 `json:"notEqualTo" `
|
||
|
LessThan *float64 `json:"lessThan" `
|
||
|
LessThanOrEqualTo *float64 `json:"lessThanOrEqualTo" `
|
||
|
MoreThan *float64 `json:"moreThan" `
|
||
|
MoreThanOrEqualTo *float64 `json:"moreThanOrEqualTo" `
|
||
|
In []float64 `json:"in" `
|
||
|
NotIn []float64 `json:"notIn" `
|
||
|
}
|
||
|
|
||
|
type IDFilter struct {
|
||
|
EqualTo *string `json:"equalTo" `
|
||
|
NotEqualTo *string `json:"notEqualTo" `
|
||
|
In []string `json:"in" `
|
||
|
NotIn []string `json:"notIn" `
|
||
|
}
|
||
|
|
||
|
type IntFilter struct {
|
||
|
EqualTo *int `json:"equalTo" `
|
||
|
NotEqualTo *int `json:"notEqualTo" `
|
||
|
LessThan *int `json:"lessThan" `
|
||
|
LessThanOrEqualTo *int `json:"lessThanOrEqualTo" `
|
||
|
MoreThan *int `json:"moreThan" `
|
||
|
MoreThanOrEqualTo *int `json:"moreThanOrEqualTo" `
|
||
|
In []int `json:"in" `
|
||
|
NotIn []int `json:"notIn" `
|
||
|
}
|
||
|
|
||
|
type MediaItem struct {
|
||
|
ID *string `json:"id" gorm:"primarykey;not null"`
|
||
|
CreatedAt *time.Time `json:"createdAt" `
|
||
|
UpdatedAt *time.Time `json:"updatedAt" `
|
||
|
ExifDate *time.Time `json:"exifDate" `
|
||
|
Latitude *float64 `json:"latitude" `
|
||
|
Longitude *float64 `json:"longitude" `
|
||
|
IsVideo bool `json:"isVideo" gorm:"default:false;not null"`
|
||
|
FileName string `json:"fileName" gorm:"not null"`
|
||
|
OrigName string `json:"origName" gorm:"not null"`
|
||
|
Tags []*Tag `json:"tags" gorm:"many2many:media_tags"`
|
||
|
Albums []*Album `json:"albums" gorm:"many2many:media_albums"`
|
||
|
User *User `json:"user" gorm:"ForeignKey:ID;not null"`
|
||
|
}
|
||
|
|
||
|
type MediaItemFilter struct {
|
||
|
ID *IDFilter `json:"id" `
|
||
|
CreatedAt *TimeFilter `json:"createdAt" `
|
||
|
UpdatedAt *TimeFilter `json:"updatedAt" `
|
||
|
ExifDate *TimeFilter `json:"exifDate" `
|
||
|
Latitude *FloatFilter `json:"latitude" `
|
||
|
Longitude *FloatFilter `json:"longitude" `
|
||
|
IsVideo *BooleanFilter `json:"isVideo" `
|
||
|
OrigName *StringFilter `json:"origName" `
|
||
|
Tags *TagFilter `json:"tags" `
|
||
|
Albums *AlbumFilter `json:"albums" `
|
||
|
And *MediaItemFilter `json:"and" `
|
||
|
Or *MediaItemFilter `json:"or" `
|
||
|
}
|
||
|
|
||
|
type MediaItemResponse struct {
|
||
|
Data []*MediaItem `json:"data" `
|
||
|
PageInfo *PageInfo `json:"pageInfo" `
|
||
|
}
|
||
|
|
||
|
type NewAlbum struct {
|
||
|
Name string `json:"name" `
|
||
|
}
|
||
|
|
||
|
type NewDevice struct {
|
||
|
Name string `json:"name" `
|
||
|
}
|
||
|
|
||
|
type NewMediaItem struct {
|
||
|
File graphql.Upload `json:"file" `
|
||
|
Tags []string `json:"tags" `
|
||
|
Albums []string `json:"albums" `
|
||
|
}
|
||
|
|
||
|
type NewTag struct {
|
||
|
Name string `json:"name" `
|
||
|
}
|
||
|
|
||
|
type NewUser struct {
|
||
|
Email string `json:"email" `
|
||
|
Username string `json:"username" `
|
||
|
FirstName *string `json:"firstName" `
|
||
|
LastName *string `json:"lastName" `
|
||
|
Role Role `json:"role" `
|
||
|
AuthType AuthType `json:"authType" `
|
||
|
Password *string `json:"password" `
|
||
|
}
|
||
|
|
||
|
type PageInfo struct {
|
||
|
Count int `json:"count" `
|
||
|
Page int `json:"page" `
|
||
|
Total int `json:"total" `
|
||
|
}
|
||
|
|
||
|
type RoleFilter struct {
|
||
|
EqualTo *Role `json:"equalTo" `
|
||
|
NotEqualTo *Role `json:"notEqualTo" `
|
||
|
In []Role `json:"in" `
|
||
|
NotIn []Role `json:"notIn" `
|
||
|
}
|
||
|
|
||
|
type StringFilter struct {
|
||
|
EqualTo *string `json:"equalTo" `
|
||
|
NotEqualTo *string `json:"notEqualTo" `
|
||
|
StartWith *string `json:"startWith" `
|
||
|
NotStartWith *string `json:"notStartWith" `
|
||
|
EndWith *string `json:"endWith" `
|
||
|
NotEndWith *string `json:"notEndWith" `
|
||
|
Contain *string `json:"contain" `
|
||
|
NotContain *string `json:"notContain" `
|
||
|
In []string `json:"in" `
|
||
|
NotIn []string `json:"notIn" `
|
||
|
StartWithStrict *string `json:"startWithStrict" `
|
||
|
NotStartWithStrict *string `json:"notStartWithStrict" `
|
||
|
EndWithStrict *string `json:"endWithStrict" `
|
||
|
NotEndWithStrict *string `json:"notEndWithStrict" `
|
||
|
ContainStrict *string `json:"containStrict" `
|
||
|
NotContainStrict *string `json:"notContainStrict" `
|
||
|
}
|
||
|
|
||
|
type Tag struct {
|
||
|
ID *string `json:"id" gorm:"primarykey;not null"`
|
||
|
CreatedAt *time.Time `json:"createdAt" `
|
||
|
UpdatedAt *time.Time `json:"updatedAt" `
|
||
|
Name string `json:"name" gorm:"unique;not null"`
|
||
|
}
|
||
|
|
||
|
type TagFilter struct {
|
||
|
ID *IDFilter `json:"id" `
|
||
|
CreatedAt *TimeFilter `json:"createdAt" `
|
||
|
UpdatedAt *TimeFilter `json:"updatedAt" `
|
||
|
Name *StringFilter `json:"name" `
|
||
|
And *MediaItemFilter `json:"and" `
|
||
|
Or *MediaItemFilter `json:"or" `
|
||
|
}
|
||
|
|
||
|
type TagResponse struct {
|
||
|
Data []*Tag `json:"data" `
|
||
|
PageInfo *PageInfo `json:"pageInfo" `
|
||
|
}
|
||
|
|
||
|
type TimeFilter struct {
|
||
|
EqualTo *time.Time `json:"equalTo" `
|
||
|
NotEqualTo *time.Time `json:"notEqualTo" `
|
||
|
LessThan *time.Time `json:"lessThan" `
|
||
|
LessThanOrEqualTo *time.Time `json:"lessThanOrEqualTo" `
|
||
|
MoreThan *time.Time `json:"moreThan" `
|
||
|
MoreThanOrEqualTo *time.Time `json:"moreThanOrEqualTo" `
|
||
|
}
|
||
|
|
||
|
type User struct {
|
||
|
ID *string `json:"id" gorm:"primarykey;not null"`
|
||
|
CreatedAt *time.Time `json:"createdAt" `
|
||
|
UpdatedAt *time.Time `json:"updatedAt" `
|
||
|
Email string `json:"email" gorm:"not null;unique"`
|
||
|
Username string `json:"username" gorm:"not null;unique"`
|
||
|
FirstName *string `json:"firstName" `
|
||
|
LastName *string `json:"lastName" `
|
||
|
Role Role `json:"role" gorm:"default:User;not null"`
|
||
|
AuthType AuthType `json:"authType" gorm:"default:Local;not null"`
|
||
|
Password *string `json:"password" `
|
||
|
}
|
||
|
|
||
|
type UserFilter struct {
|
||
|
ID *IDFilter `json:"id" `
|
||
|
CreatedAt *TimeFilter `json:"createdAt" `
|
||
|
UpdatedAt *TimeFilter `json:"updatedAt" `
|
||
|
Username *StringFilter `json:"username" `
|
||
|
FirstName *StringFilter `json:"firstName" `
|
||
|
LastName *StringFilter `json:"lastName" `
|
||
|
Role *RoleFilter `json:"role" `
|
||
|
AuthType *AuthTypeFilter `json:"authType" `
|
||
|
And *UserFilter `json:"and" `
|
||
|
Or *UserFilter `json:"or" `
|
||
|
}
|
||
|
|
||
|
type UserResponse struct {
|
||
|
Data []*User `json:"data" `
|
||
|
PageInfo *PageInfo `json:"pageInfo" `
|
||
|
}
|
||
|
|
||
|
type AuthType string
|
||
|
|
||
|
const (
|
||
|
AuthTypeLocal AuthType = "Local"
|
||
|
AuthTypeLdap AuthType = "LDAP"
|
||
|
)
|
||
|
|
||
|
var AllAuthType = []AuthType{
|
||
|
AuthTypeLocal,
|
||
|
AuthTypeLdap,
|
||
|
}
|
||
|
|
||
|
func (e AuthType) IsValid() bool {
|
||
|
switch e {
|
||
|
case AuthTypeLocal, AuthTypeLdap:
|
||
|
return true
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
func (e AuthType) String() string {
|
||
|
return string(e)
|
||
|
}
|
||
|
|
||
|
func (e *AuthType) UnmarshalGQL(v interface{}) error {
|
||
|
str, ok := v.(string)
|
||
|
if !ok {
|
||
|
return fmt.Errorf("enums must be strings")
|
||
|
}
|
||
|
|
||
|
*e = AuthType(str)
|
||
|
if !e.IsValid() {
|
||
|
return fmt.Errorf("%s is not a valid AuthType", str)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (e AuthType) MarshalGQL(w io.Writer) {
|
||
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
||
|
}
|
||
|
|
||
|
type DeviceType string
|
||
|
|
||
|
const (
|
||
|
DeviceTypeIOs DeviceType = "iOS"
|
||
|
DeviceTypeAndroid DeviceType = "Android"
|
||
|
DeviceTypeChrome DeviceType = "Chrome"
|
||
|
DeviceTypeFirefox DeviceType = "Firefox"
|
||
|
DeviceTypeInternetExplorer DeviceType = "InternetExplorer"
|
||
|
DeviceTypeEdge DeviceType = "Edge"
|
||
|
DeviceTypeSafari DeviceType = "Safari"
|
||
|
DeviceTypeUnknown DeviceType = "Unknown"
|
||
|
)
|
||
|
|
||
|
var AllDeviceType = []DeviceType{
|
||
|
DeviceTypeIOs,
|
||
|
DeviceTypeAndroid,
|
||
|
DeviceTypeChrome,
|
||
|
DeviceTypeFirefox,
|
||
|
DeviceTypeInternetExplorer,
|
||
|
DeviceTypeEdge,
|
||
|
DeviceTypeSafari,
|
||
|
DeviceTypeUnknown,
|
||
|
}
|
||
|
|
||
|
func (e DeviceType) IsValid() bool {
|
||
|
switch e {
|
||
|
case DeviceTypeIOs, DeviceTypeAndroid, DeviceTypeChrome, DeviceTypeFirefox, DeviceTypeInternetExplorer, DeviceTypeEdge, DeviceTypeSafari, DeviceTypeUnknown:
|
||
|
return true
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
func (e DeviceType) String() string {
|
||
|
return string(e)
|
||
|
}
|
||
|
|
||
|
func (e *DeviceType) UnmarshalGQL(v interface{}) error {
|
||
|
str, ok := v.(string)
|
||
|
if !ok {
|
||
|
return fmt.Errorf("enums must be strings")
|
||
|
}
|
||
|
|
||
|
*e = DeviceType(str)
|
||
|
if !e.IsValid() {
|
||
|
return fmt.Errorf("%s is not a valid DeviceType", str)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (e DeviceType) MarshalGQL(w io.Writer) {
|
||
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
||
|
}
|
||
|
|
||
|
type Role string
|
||
|
|
||
|
const (
|
||
|
RoleAdmin Role = "Admin"
|
||
|
RoleUser Role = "User"
|
||
|
)
|
||
|
|
||
|
var AllRole = []Role{
|
||
|
RoleAdmin,
|
||
|
RoleUser,
|
||
|
}
|
||
|
|
||
|
func (e Role) IsValid() bool {
|
||
|
switch e {
|
||
|
case RoleAdmin, RoleUser:
|
||
|
return true
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
func (e Role) String() string {
|
||
|
return string(e)
|
||
|
}
|
||
|
|
||
|
func (e *Role) UnmarshalGQL(v interface{}) error {
|
||
|
str, ok := v.(string)
|
||
|
if !ok {
|
||
|
return fmt.Errorf("enums must be strings")
|
||
|
}
|
||
|
|
||
|
*e = Role(str)
|
||
|
if !e.IsValid() {
|
||
|
return fmt.Errorf("%s is not a valid Role", str)
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (e Role) MarshalGQL(w io.Writer) {
|
||
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
||
|
}
|