diff --git a/api/gqlgen.yml b/api/gqlgen.yml index c49c42ab..1e4772b1 100644 --- a/api/gqlgen.yml +++ b/api/gqlgen.yml @@ -1,10 +1,7 @@ -# .gqlgen.yml example -# # Refer to https://gqlgen.com/config/ -# for detailed .gqlgen.yml documentation. schema: - - graphql/schema.graphql + - graphql/resolvers/*.graphql exec: filename: graphql/generated.go @@ -14,8 +11,10 @@ model: package: models resolver: - filename: graphql/resolvers/root.go - type: Resolver + layout: follow-schema + dir: graphql/resolvers + package: resolvers + filename_template: "{name}.generated.go" autobind: [] diff --git a/api/graphql/generated.go b/api/graphql/generated.go index 0ffce436..f43434a0 100644 --- a/api/graphql/generated.go +++ b/api/graphql/generated.go @@ -322,7 +322,6 @@ type MutationResolver interface { ShareMedia(ctx context.Context, mediaID int, expire *time.Time, password *string) (*models.ShareToken, error) DeleteShareToken(ctx context.Context, token string) (*models.ShareToken, error) ProtectShareToken(ctx context.Context, token string, password *string) (*models.ShareToken, error) - FavoriteMedia(ctx context.Context, mediaID int, favorite bool) (*models.Media, error) UpdateUser(ctx context.Context, id int, username *string, password *string, admin *bool) (*models.User, error) CreateUser(ctx context.Context, username string, password *string, admin bool) (*models.User, error) DeleteUser(ctx context.Context, id int) (*models.User, error) @@ -339,25 +338,26 @@ type MutationResolver interface { MoveImageFaces(ctx context.Context, imageFaceIDs []int, destinationFaceGroupID int) (*models.FaceGroup, error) RecognizeUnlabeledFaces(ctx context.Context) ([]*models.ImageFace, error) DetachImageFaces(ctx context.Context, imageFaceIDs []int) (*models.FaceGroup, error) + FavoriteMedia(ctx context.Context, mediaID int, favorite bool) (*models.Media, error) } type QueryResolver interface { SiteInfo(ctx context.Context) (*models.SiteInfo, error) User(ctx context.Context, order *models.Ordering, paginate *models.Pagination) ([]*models.User, error) MyUser(ctx context.Context) (*models.User, error) MyUserPreferences(ctx context.Context) (*models.UserPreferences, error) - MyAlbums(ctx context.Context, order *models.Ordering, paginate *models.Pagination, onlyRoot *bool, showEmpty *bool, onlyWithFavorites *bool) ([]*models.Album, error) - Album(ctx context.Context, id int, tokenCredentials *models.ShareTokenCredentials) (*models.Album, error) - MyMedia(ctx context.Context, order *models.Ordering, paginate *models.Pagination) ([]*models.Media, error) - Media(ctx context.Context, id int, tokenCredentials *models.ShareTokenCredentials) (*models.Media, error) - MediaList(ctx context.Context, ids []int) ([]*models.Media, error) MyTimeline(ctx context.Context, paginate *models.Pagination, onlyFavorites *bool, fromDate *time.Time) ([]*models.Media, error) - MyMediaGeoJSON(ctx context.Context) (interface{}, error) - MapboxToken(ctx context.Context) (*string, error) ShareToken(ctx context.Context, credentials models.ShareTokenCredentials) (*models.ShareToken, error) ShareTokenValidatePassword(ctx context.Context, credentials models.ShareTokenCredentials) (bool, error) Search(ctx context.Context, query string, limitMedia *int, limitAlbums *int) (*models.SearchResult, error) + MyAlbums(ctx context.Context, order *models.Ordering, paginate *models.Pagination, onlyRoot *bool, showEmpty *bool, onlyWithFavorites *bool) ([]*models.Album, error) + Album(ctx context.Context, id int, tokenCredentials *models.ShareTokenCredentials) (*models.Album, error) MyFaceGroups(ctx context.Context, paginate *models.Pagination) ([]*models.FaceGroup, error) FaceGroup(ctx context.Context, id int) (*models.FaceGroup, error) + MyMedia(ctx context.Context, order *models.Ordering, paginate *models.Pagination) ([]*models.Media, error) + Media(ctx context.Context, id int, tokenCredentials *models.ShareTokenCredentials) (*models.Media, error) + MediaList(ctx context.Context, ids []int) ([]*models.Media, error) + MyMediaGeoJSON(ctx context.Context) (any, error) + MapboxToken(ctx context.Context) (*string, error) } type ShareTokenResolver interface { HasPassword(ctx context.Context, obj *models.ShareToken) (bool, error) @@ -1784,7 +1784,7 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil } -//go:embed "schema.graphql" +//go:embed "resolvers/album.graphql" "resolvers/faces.graphql" "resolvers/media.graphql" "resolvers/media_geo_json.graphql" "resolvers/schema.graphql" var sourcesFS embed.FS func sourceData(filename string) string { @@ -1796,7 +1796,11 @@ func sourceData(filename string) string { } var sources = []*ast.Source{ - {Name: "schema.graphql", Input: sourceData("schema.graphql"), BuiltIn: false}, + {Name: "resolvers/album.graphql", Input: sourceData("resolvers/album.graphql"), BuiltIn: false}, + {Name: "resolvers/faces.graphql", Input: sourceData("resolvers/faces.graphql"), BuiltIn: false}, + {Name: "resolvers/media.graphql", Input: sourceData("resolvers/media.graphql"), BuiltIn: false}, + {Name: "resolvers/media_geo_json.graphql", Input: sourceData("resolvers/media_geo_json.graphql"), BuiltIn: false}, + {Name: "resolvers/schema.graphql", Input: sourceData("resolvers/schema.graphql"), BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) @@ -1807,923 +1811,2232 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Album_media_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Ordering - if tmp, ok := rawArgs["order"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) - arg0, err = ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Album_media_argsOrder(ctx, rawArgs) + if err != nil { + return nil, err } args["order"] = arg0 - var arg1 *models.Pagination - if tmp, ok := rawArgs["paginate"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) - arg1, err = ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Album_media_argsPaginate(ctx, rawArgs) + if err != nil { + return nil, err } args["paginate"] = arg1 - var arg2 *bool - if tmp, ok := rawArgs["onlyFavorites"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyFavorites")) - arg2, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } + arg2, err := ec.field_Album_media_argsOnlyFavorites(ctx, rawArgs) + if err != nil { + return nil, err } args["onlyFavorites"] = arg2 return args, nil } +func (ec *executionContext) field_Album_media_argsOrder( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Ordering, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["order"] + if !ok { + var zeroVal *models.Ordering + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) + if tmp, ok := rawArgs["order"]; ok { + return ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) + } + + var zeroVal *models.Ordering + return zeroVal, nil +} + +func (ec *executionContext) field_Album_media_argsPaginate( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Pagination, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["paginate"] + if !ok { + var zeroVal *models.Pagination + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) + if tmp, ok := rawArgs["paginate"]; ok { + return ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) + } + + var zeroVal *models.Pagination + return zeroVal, nil +} + +func (ec *executionContext) field_Album_media_argsOnlyFavorites( + ctx context.Context, + rawArgs map[string]interface{}, +) (*bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["onlyFavorites"] + if !ok { + var zeroVal *bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyFavorites")) + if tmp, ok := rawArgs["onlyFavorites"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} func (ec *executionContext) field_Album_subAlbums_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Ordering - if tmp, ok := rawArgs["order"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) - arg0, err = ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Album_subAlbums_argsOrder(ctx, rawArgs) + if err != nil { + return nil, err } args["order"] = arg0 - var arg1 *models.Pagination - if tmp, ok := rawArgs["paginate"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) - arg1, err = ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Album_subAlbums_argsPaginate(ctx, rawArgs) + if err != nil { + return nil, err } args["paginate"] = arg1 return args, nil } +func (ec *executionContext) field_Album_subAlbums_argsOrder( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Ordering, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["order"] + if !ok { + var zeroVal *models.Ordering + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) + if tmp, ok := rawArgs["order"]; ok { + return ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) + } + + var zeroVal *models.Ordering + return zeroVal, nil +} + +func (ec *executionContext) field_Album_subAlbums_argsPaginate( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Pagination, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["paginate"] + if !ok { + var zeroVal *models.Pagination + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) + if tmp, ok := rawArgs["paginate"]; ok { + return ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) + } + + var zeroVal *models.Pagination + return zeroVal, nil +} func (ec *executionContext) field_FaceGroup_imageFaces_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Pagination - if tmp, ok := rawArgs["paginate"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) - arg0, err = ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_FaceGroup_imageFaces_argsPaginate(ctx, rawArgs) + if err != nil { + return nil, err } args["paginate"] = arg0 return args, nil } +func (ec *executionContext) field_FaceGroup_imageFaces_argsPaginate( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Pagination, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["paginate"] + if !ok { + var zeroVal *models.Pagination + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) + if tmp, ok := rawArgs["paginate"]; ok { + return ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) + } + + var zeroVal *models.Pagination + return zeroVal, nil +} func (ec *executionContext) field_Mutation_authorizeUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["username"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_authorizeUser_argsUsername(ctx, rawArgs) + if err != nil { + return nil, err } args["username"] = arg0 - var arg1 string - if tmp, ok := rawArgs["password"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_authorizeUser_argsPassword(ctx, rawArgs) + if err != nil { + return nil, err } args["password"] = arg1 return args, nil } +func (ec *executionContext) field_Mutation_authorizeUser_argsUsername( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["username"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) + if tmp, ok := rawArgs["username"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_authorizeUser_argsPassword( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["password"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) + if tmp, ok := rawArgs["password"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} func (ec *executionContext) field_Mutation_changeUserPreferences_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *string - if tmp, ok := rawArgs["language"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("language")) - arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_changeUserPreferences_argsLanguage(ctx, rawArgs) + if err != nil { + return nil, err } args["language"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_changeUserPreferences_argsLanguage( + ctx context.Context, + rawArgs map[string]interface{}, +) (*string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["language"] + if !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("language")) + if tmp, ok := rawArgs["language"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} func (ec *executionContext) field_Mutation_combineFaceGroups_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["destinationFaceGroupID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationFaceGroupID")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_combineFaceGroups_argsDestinationFaceGroupID(ctx, rawArgs) + if err != nil { + return nil, err } args["destinationFaceGroupID"] = arg0 - var arg1 int - if tmp, ok := rawArgs["sourceFaceGroupID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sourceFaceGroupID")) - arg1, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_combineFaceGroups_argsSourceFaceGroupID(ctx, rawArgs) + if err != nil { + return nil, err } args["sourceFaceGroupID"] = arg1 return args, nil } +func (ec *executionContext) field_Mutation_combineFaceGroups_argsDestinationFaceGroupID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["destinationFaceGroupID"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationFaceGroupID")) + if tmp, ok := rawArgs["destinationFaceGroupID"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_combineFaceGroups_argsSourceFaceGroupID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["sourceFaceGroupID"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("sourceFaceGroupID")) + if tmp, ok := rawArgs["sourceFaceGroupID"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Mutation_createUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["username"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_createUser_argsUsername(ctx, rawArgs) + if err != nil { + return nil, err } args["username"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["password"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) - arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_createUser_argsPassword(ctx, rawArgs) + if err != nil { + return nil, err } args["password"] = arg1 - var arg2 bool - if tmp, ok := rawArgs["admin"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("admin")) - arg2, err = ec.unmarshalNBoolean2bool(ctx, tmp) - if err != nil { - return nil, err - } + arg2, err := ec.field_Mutation_createUser_argsAdmin(ctx, rawArgs) + if err != nil { + return nil, err } args["admin"] = arg2 return args, nil } +func (ec *executionContext) field_Mutation_createUser_argsUsername( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["username"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) + if tmp, ok := rawArgs["username"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_createUser_argsPassword( + ctx context.Context, + rawArgs map[string]interface{}, +) (*string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["password"] + if !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) + if tmp, ok := rawArgs["password"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_createUser_argsAdmin( + ctx context.Context, + rawArgs map[string]interface{}, +) (bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["admin"] + if !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("admin")) + if tmp, ok := rawArgs["admin"]; ok { + return ec.unmarshalNBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} func (ec *executionContext) field_Mutation_deleteShareToken_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["token"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("token")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_deleteShareToken_argsToken(ctx, rawArgs) + if err != nil { + return nil, err } args["token"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_deleteShareToken_argsToken( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["token"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("token")) + if tmp, ok := rawArgs["token"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} func (ec *executionContext) field_Mutation_deleteUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["id"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_deleteUser_argsID(ctx, rawArgs) + if err != nil { + return nil, err } args["id"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_deleteUser_argsID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["id"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Mutation_detachImageFaces_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 []int - if tmp, ok := rawArgs["imageFaceIDs"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("imageFaceIDs")) - arg0, err = ec.unmarshalNID2ᚕintᚄ(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_detachImageFaces_argsImageFaceIDs(ctx, rawArgs) + if err != nil { + return nil, err } args["imageFaceIDs"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_detachImageFaces_argsImageFaceIDs( + ctx context.Context, + rawArgs map[string]interface{}, +) ([]int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["imageFaceIDs"] + if !ok { + var zeroVal []int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("imageFaceIDs")) + if tmp, ok := rawArgs["imageFaceIDs"]; ok { + return ec.unmarshalNID2ᚕintᚄ(ctx, tmp) + } + + var zeroVal []int + return zeroVal, nil +} func (ec *executionContext) field_Mutation_favoriteMedia_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["mediaId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mediaId")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_favoriteMedia_argsMediaID(ctx, rawArgs) + if err != nil { + return nil, err } args["mediaId"] = arg0 - var arg1 bool - if tmp, ok := rawArgs["favorite"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("favorite")) - arg1, err = ec.unmarshalNBoolean2bool(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_favoriteMedia_argsFavorite(ctx, rawArgs) + if err != nil { + return nil, err } args["favorite"] = arg1 return args, nil } +func (ec *executionContext) field_Mutation_favoriteMedia_argsMediaID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["mediaId"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("mediaId")) + if tmp, ok := rawArgs["mediaId"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_favoriteMedia_argsFavorite( + ctx context.Context, + rawArgs map[string]interface{}, +) (bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["favorite"] + if !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("favorite")) + if tmp, ok := rawArgs["favorite"]; ok { + return ec.unmarshalNBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} func (ec *executionContext) field_Mutation_initialSetupWizard_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["username"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_initialSetupWizard_argsUsername(ctx, rawArgs) + if err != nil { + return nil, err } args["username"] = arg0 - var arg1 string - if tmp, ok := rawArgs["password"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_initialSetupWizard_argsPassword(ctx, rawArgs) + if err != nil { + return nil, err } args["password"] = arg1 - var arg2 string - if tmp, ok := rawArgs["rootPath"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rootPath")) - arg2, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg2, err := ec.field_Mutation_initialSetupWizard_argsRootPath(ctx, rawArgs) + if err != nil { + return nil, err } args["rootPath"] = arg2 return args, nil } +func (ec *executionContext) field_Mutation_initialSetupWizard_argsUsername( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["username"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) + if tmp, ok := rawArgs["username"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_initialSetupWizard_argsPassword( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["password"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) + if tmp, ok := rawArgs["password"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_initialSetupWizard_argsRootPath( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["rootPath"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("rootPath")) + if tmp, ok := rawArgs["rootPath"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} func (ec *executionContext) field_Mutation_moveImageFaces_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 []int - if tmp, ok := rawArgs["imageFaceIDs"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("imageFaceIDs")) - arg0, err = ec.unmarshalNID2ᚕintᚄ(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_moveImageFaces_argsImageFaceIDs(ctx, rawArgs) + if err != nil { + return nil, err } args["imageFaceIDs"] = arg0 - var arg1 int - if tmp, ok := rawArgs["destinationFaceGroupID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationFaceGroupID")) - arg1, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_moveImageFaces_argsDestinationFaceGroupID(ctx, rawArgs) + if err != nil { + return nil, err } args["destinationFaceGroupID"] = arg1 return args, nil } +func (ec *executionContext) field_Mutation_moveImageFaces_argsImageFaceIDs( + ctx context.Context, + rawArgs map[string]interface{}, +) ([]int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["imageFaceIDs"] + if !ok { + var zeroVal []int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("imageFaceIDs")) + if tmp, ok := rawArgs["imageFaceIDs"]; ok { + return ec.unmarshalNID2ᚕintᚄ(ctx, tmp) + } + + var zeroVal []int + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_moveImageFaces_argsDestinationFaceGroupID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["destinationFaceGroupID"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationFaceGroupID")) + if tmp, ok := rawArgs["destinationFaceGroupID"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Mutation_protectShareToken_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["token"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("token")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_protectShareToken_argsToken(ctx, rawArgs) + if err != nil { + return nil, err } args["token"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["password"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) - arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_protectShareToken_argsPassword(ctx, rawArgs) + if err != nil { + return nil, err } args["password"] = arg1 return args, nil } +func (ec *executionContext) field_Mutation_protectShareToken_argsToken( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["token"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("token")) + if tmp, ok := rawArgs["token"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_protectShareToken_argsPassword( + ctx context.Context, + rawArgs map[string]interface{}, +) (*string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["password"] + if !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) + if tmp, ok := rawArgs["password"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} func (ec *executionContext) field_Mutation_resetAlbumCover_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["albumID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("albumID")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_resetAlbumCover_argsAlbumID(ctx, rawArgs) + if err != nil { + return nil, err } args["albumID"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_resetAlbumCover_argsAlbumID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["albumID"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("albumID")) + if tmp, ok := rawArgs["albumID"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Mutation_scanUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["userId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_scanUser_argsUserID(ctx, rawArgs) + if err != nil { + return nil, err } args["userId"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_scanUser_argsUserID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["userId"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) + if tmp, ok := rawArgs["userId"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Mutation_setAlbumCover_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["coverID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("coverID")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_setAlbumCover_argsCoverID(ctx, rawArgs) + if err != nil { + return nil, err } args["coverID"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_setAlbumCover_argsCoverID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["coverID"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("coverID")) + if tmp, ok := rawArgs["coverID"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Mutation_setFaceGroupLabel_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["faceGroupID"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("faceGroupID")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_setFaceGroupLabel_argsFaceGroupID(ctx, rawArgs) + if err != nil { + return nil, err } args["faceGroupID"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["label"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) - arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_setFaceGroupLabel_argsLabel(ctx, rawArgs) + if err != nil { + return nil, err } args["label"] = arg1 return args, nil } +func (ec *executionContext) field_Mutation_setFaceGroupLabel_argsFaceGroupID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["faceGroupID"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("faceGroupID")) + if tmp, ok := rawArgs["faceGroupID"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_setFaceGroupLabel_argsLabel( + ctx context.Context, + rawArgs map[string]interface{}, +) (*string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["label"] + if !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) + if tmp, ok := rawArgs["label"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} func (ec *executionContext) field_Mutation_setPeriodicScanInterval_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["interval"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interval")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_setPeriodicScanInterval_argsInterval(ctx, rawArgs) + if err != nil { + return nil, err } args["interval"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_setPeriodicScanInterval_argsInterval( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["interval"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("interval")) + if tmp, ok := rawArgs["interval"]; ok { + return ec.unmarshalNInt2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Mutation_setScannerConcurrentWorkers_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["workers"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("workers")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_setScannerConcurrentWorkers_argsWorkers(ctx, rawArgs) + if err != nil { + return nil, err } args["workers"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_setScannerConcurrentWorkers_argsWorkers( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["workers"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("workers")) + if tmp, ok := rawArgs["workers"]; ok { + return ec.unmarshalNInt2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Mutation_setThumbnailDownsampleMethod_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 models.ThumbnailFilter - if tmp, ok := rawArgs["method"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("method")) - arg0, err = ec.unmarshalNThumbnailFilter2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐThumbnailFilter(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_setThumbnailDownsampleMethod_argsMethod(ctx, rawArgs) + if err != nil { + return nil, err } args["method"] = arg0 return args, nil } +func (ec *executionContext) field_Mutation_setThumbnailDownsampleMethod_argsMethod( + ctx context.Context, + rawArgs map[string]interface{}, +) (models.ThumbnailFilter, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["method"] + if !ok { + var zeroVal models.ThumbnailFilter + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("method")) + if tmp, ok := rawArgs["method"]; ok { + return ec.unmarshalNThumbnailFilter2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐThumbnailFilter(ctx, tmp) + } + + var zeroVal models.ThumbnailFilter + return zeroVal, nil +} func (ec *executionContext) field_Mutation_shareAlbum_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["albumId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("albumId")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_shareAlbum_argsAlbumID(ctx, rawArgs) + if err != nil { + return nil, err } args["albumId"] = arg0 - var arg1 *time.Time - if tmp, ok := rawArgs["expire"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("expire")) - arg1, err = ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_shareAlbum_argsExpire(ctx, rawArgs) + if err != nil { + return nil, err } args["expire"] = arg1 - var arg2 *string - if tmp, ok := rawArgs["password"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) - arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + arg2, err := ec.field_Mutation_shareAlbum_argsPassword(ctx, rawArgs) + if err != nil { + return nil, err } args["password"] = arg2 return args, nil } +func (ec *executionContext) field_Mutation_shareAlbum_argsAlbumID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["albumId"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("albumId")) + if tmp, ok := rawArgs["albumId"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_shareAlbum_argsExpire( + ctx context.Context, + rawArgs map[string]interface{}, +) (*time.Time, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["expire"] + if !ok { + var zeroVal *time.Time + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("expire")) + if tmp, ok := rawArgs["expire"]; ok { + return ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) + } + + var zeroVal *time.Time + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_shareAlbum_argsPassword( + ctx context.Context, + rawArgs map[string]interface{}, +) (*string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["password"] + if !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) + if tmp, ok := rawArgs["password"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} func (ec *executionContext) field_Mutation_shareMedia_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["mediaId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("mediaId")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_shareMedia_argsMediaID(ctx, rawArgs) + if err != nil { + return nil, err } args["mediaId"] = arg0 - var arg1 *time.Time - if tmp, ok := rawArgs["expire"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("expire")) - arg1, err = ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_shareMedia_argsExpire(ctx, rawArgs) + if err != nil { + return nil, err } args["expire"] = arg1 - var arg2 *string - if tmp, ok := rawArgs["password"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) - arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + arg2, err := ec.field_Mutation_shareMedia_argsPassword(ctx, rawArgs) + if err != nil { + return nil, err } args["password"] = arg2 return args, nil } +func (ec *executionContext) field_Mutation_shareMedia_argsMediaID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["mediaId"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("mediaId")) + if tmp, ok := rawArgs["mediaId"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_shareMedia_argsExpire( + ctx context.Context, + rawArgs map[string]interface{}, +) (*time.Time, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["expire"] + if !ok { + var zeroVal *time.Time + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("expire")) + if tmp, ok := rawArgs["expire"]; ok { + return ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) + } + + var zeroVal *time.Time + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_shareMedia_argsPassword( + ctx context.Context, + rawArgs map[string]interface{}, +) (*string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["password"] + if !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) + if tmp, ok := rawArgs["password"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} func (ec *executionContext) field_Mutation_updateUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["id"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_updateUser_argsID(ctx, rawArgs) + if err != nil { + return nil, err } args["id"] = arg0 - var arg1 *string - if tmp, ok := rawArgs["username"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) - arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_updateUser_argsUsername(ctx, rawArgs) + if err != nil { + return nil, err } args["username"] = arg1 - var arg2 *string - if tmp, ok := rawArgs["password"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) - arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) - if err != nil { - return nil, err - } + arg2, err := ec.field_Mutation_updateUser_argsPassword(ctx, rawArgs) + if err != nil { + return nil, err } args["password"] = arg2 - var arg3 *bool - if tmp, ok := rawArgs["admin"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("admin")) - arg3, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } + arg3, err := ec.field_Mutation_updateUser_argsAdmin(ctx, rawArgs) + if err != nil { + return nil, err } args["admin"] = arg3 return args, nil } +func (ec *executionContext) field_Mutation_updateUser_argsID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["id"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_updateUser_argsUsername( + ctx context.Context, + rawArgs map[string]interface{}, +) (*string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["username"] + if !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) + if tmp, ok := rawArgs["username"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_updateUser_argsPassword( + ctx context.Context, + rawArgs map[string]interface{}, +) (*string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["password"] + if !ok { + var zeroVal *string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("password")) + if tmp, ok := rawArgs["password"]; ok { + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } + + var zeroVal *string + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_updateUser_argsAdmin( + ctx context.Context, + rawArgs map[string]interface{}, +) (*bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["admin"] + if !ok { + var zeroVal *bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("admin")) + if tmp, ok := rawArgs["admin"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} func (ec *executionContext) field_Mutation_userAddRootPath_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["id"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_userAddRootPath_argsID(ctx, rawArgs) + if err != nil { + return nil, err } args["id"] = arg0 - var arg1 string - if tmp, ok := rawArgs["rootPath"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rootPath")) - arg1, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_userAddRootPath_argsRootPath(ctx, rawArgs) + if err != nil { + return nil, err } args["rootPath"] = arg1 return args, nil } +func (ec *executionContext) field_Mutation_userAddRootPath_argsID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["id"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_userAddRootPath_argsRootPath( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["rootPath"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("rootPath")) + if tmp, ok := rawArgs["rootPath"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} func (ec *executionContext) field_Mutation_userRemoveRootAlbum_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["userId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Mutation_userRemoveRootAlbum_argsUserID(ctx, rawArgs) + if err != nil { + return nil, err } args["userId"] = arg0 - var arg1 int - if tmp, ok := rawArgs["albumId"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("albumId")) - arg1, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Mutation_userRemoveRootAlbum_argsAlbumID(ctx, rawArgs) + if err != nil { + return nil, err } args["albumId"] = arg1 return args, nil } +func (ec *executionContext) field_Mutation_userRemoveRootAlbum_argsUserID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["userId"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("userId")) + if tmp, ok := rawArgs["userId"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Mutation_userRemoveRootAlbum_argsAlbumID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["albumId"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("albumId")) + if tmp, ok := rawArgs["albumId"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["name"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) + if err != nil { + return nil, err } args["name"] = arg0 return args, nil } +func (ec *executionContext) field_Query___type_argsName( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["name"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + if tmp, ok := rawArgs["name"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} func (ec *executionContext) field_Query_album_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["id"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_album_argsID(ctx, rawArgs) + if err != nil { + return nil, err } args["id"] = arg0 - var arg1 *models.ShareTokenCredentials - if tmp, ok := rawArgs["tokenCredentials"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tokenCredentials")) - arg1, err = ec.unmarshalOShareTokenCredentials2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenCredentials(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Query_album_argsTokenCredentials(ctx, rawArgs) + if err != nil { + return nil, err } args["tokenCredentials"] = arg1 return args, nil } +func (ec *executionContext) field_Query_album_argsID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["id"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Query_album_argsTokenCredentials( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.ShareTokenCredentials, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["tokenCredentials"] + if !ok { + var zeroVal *models.ShareTokenCredentials + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("tokenCredentials")) + if tmp, ok := rawArgs["tokenCredentials"]; ok { + return ec.unmarshalOShareTokenCredentials2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenCredentials(ctx, tmp) + } + + var zeroVal *models.ShareTokenCredentials + return zeroVal, nil +} func (ec *executionContext) field_Query_faceGroup_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["id"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_faceGroup_argsID(ctx, rawArgs) + if err != nil { + return nil, err } args["id"] = arg0 return args, nil } +func (ec *executionContext) field_Query_faceGroup_argsID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["id"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} func (ec *executionContext) field_Query_mediaList_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 []int - if tmp, ok := rawArgs["ids"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ids")) - arg0, err = ec.unmarshalNID2ᚕintᚄ(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_mediaList_argsIds(ctx, rawArgs) + if err != nil { + return nil, err } args["ids"] = arg0 return args, nil } +func (ec *executionContext) field_Query_mediaList_argsIds( + ctx context.Context, + rawArgs map[string]interface{}, +) ([]int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["ids"] + if !ok { + var zeroVal []int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("ids")) + if tmp, ok := rawArgs["ids"]; ok { + return ec.unmarshalNID2ᚕintᚄ(ctx, tmp) + } + + var zeroVal []int + return zeroVal, nil +} func (ec *executionContext) field_Query_media_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["id"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - arg0, err = ec.unmarshalNID2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_media_argsID(ctx, rawArgs) + if err != nil { + return nil, err } args["id"] = arg0 - var arg1 *models.ShareTokenCredentials - if tmp, ok := rawArgs["tokenCredentials"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tokenCredentials")) - arg1, err = ec.unmarshalOShareTokenCredentials2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenCredentials(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Query_media_argsTokenCredentials(ctx, rawArgs) + if err != nil { + return nil, err } args["tokenCredentials"] = arg1 return args, nil } +func (ec *executionContext) field_Query_media_argsID( + ctx context.Context, + rawArgs map[string]interface{}, +) (int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["id"] + if !ok { + var zeroVal int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + if tmp, ok := rawArgs["id"]; ok { + return ec.unmarshalNID2int(ctx, tmp) + } + + var zeroVal int + return zeroVal, nil +} + +func (ec *executionContext) field_Query_media_argsTokenCredentials( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.ShareTokenCredentials, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["tokenCredentials"] + if !ok { + var zeroVal *models.ShareTokenCredentials + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("tokenCredentials")) + if tmp, ok := rawArgs["tokenCredentials"]; ok { + return ec.unmarshalOShareTokenCredentials2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenCredentials(ctx, tmp) + } + + var zeroVal *models.ShareTokenCredentials + return zeroVal, nil +} func (ec *executionContext) field_Query_myAlbums_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Ordering - if tmp, ok := rawArgs["order"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) - arg0, err = ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_myAlbums_argsOrder(ctx, rawArgs) + if err != nil { + return nil, err } args["order"] = arg0 - var arg1 *models.Pagination - if tmp, ok := rawArgs["paginate"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) - arg1, err = ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Query_myAlbums_argsPaginate(ctx, rawArgs) + if err != nil { + return nil, err } args["paginate"] = arg1 - var arg2 *bool - if tmp, ok := rawArgs["onlyRoot"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyRoot")) - arg2, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } + arg2, err := ec.field_Query_myAlbums_argsOnlyRoot(ctx, rawArgs) + if err != nil { + return nil, err } args["onlyRoot"] = arg2 - var arg3 *bool - if tmp, ok := rawArgs["showEmpty"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("showEmpty")) - arg3, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } + arg3, err := ec.field_Query_myAlbums_argsShowEmpty(ctx, rawArgs) + if err != nil { + return nil, err } args["showEmpty"] = arg3 - var arg4 *bool - if tmp, ok := rawArgs["onlyWithFavorites"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyWithFavorites")) - arg4, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } + arg4, err := ec.field_Query_myAlbums_argsOnlyWithFavorites(ctx, rawArgs) + if err != nil { + return nil, err } args["onlyWithFavorites"] = arg4 return args, nil } +func (ec *executionContext) field_Query_myAlbums_argsOrder( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Ordering, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["order"] + if !ok { + var zeroVal *models.Ordering + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) + if tmp, ok := rawArgs["order"]; ok { + return ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) + } + + var zeroVal *models.Ordering + return zeroVal, nil +} + +func (ec *executionContext) field_Query_myAlbums_argsPaginate( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Pagination, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["paginate"] + if !ok { + var zeroVal *models.Pagination + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) + if tmp, ok := rawArgs["paginate"]; ok { + return ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) + } + + var zeroVal *models.Pagination + return zeroVal, nil +} + +func (ec *executionContext) field_Query_myAlbums_argsOnlyRoot( + ctx context.Context, + rawArgs map[string]interface{}, +) (*bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["onlyRoot"] + if !ok { + var zeroVal *bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyRoot")) + if tmp, ok := rawArgs["onlyRoot"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} + +func (ec *executionContext) field_Query_myAlbums_argsShowEmpty( + ctx context.Context, + rawArgs map[string]interface{}, +) (*bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["showEmpty"] + if !ok { + var zeroVal *bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("showEmpty")) + if tmp, ok := rawArgs["showEmpty"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} + +func (ec *executionContext) field_Query_myAlbums_argsOnlyWithFavorites( + ctx context.Context, + rawArgs map[string]interface{}, +) (*bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["onlyWithFavorites"] + if !ok { + var zeroVal *bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyWithFavorites")) + if tmp, ok := rawArgs["onlyWithFavorites"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} func (ec *executionContext) field_Query_myFaceGroups_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Pagination - if tmp, ok := rawArgs["paginate"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) - arg0, err = ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_myFaceGroups_argsPaginate(ctx, rawArgs) + if err != nil { + return nil, err } args["paginate"] = arg0 return args, nil } +func (ec *executionContext) field_Query_myFaceGroups_argsPaginate( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Pagination, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["paginate"] + if !ok { + var zeroVal *models.Pagination + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) + if tmp, ok := rawArgs["paginate"]; ok { + return ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) + } + + var zeroVal *models.Pagination + return zeroVal, nil +} func (ec *executionContext) field_Query_myMedia_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Ordering - if tmp, ok := rawArgs["order"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) - arg0, err = ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_myMedia_argsOrder(ctx, rawArgs) + if err != nil { + return nil, err } args["order"] = arg0 - var arg1 *models.Pagination - if tmp, ok := rawArgs["paginate"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) - arg1, err = ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Query_myMedia_argsPaginate(ctx, rawArgs) + if err != nil { + return nil, err } args["paginate"] = arg1 return args, nil } +func (ec *executionContext) field_Query_myMedia_argsOrder( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Ordering, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["order"] + if !ok { + var zeroVal *models.Ordering + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) + if tmp, ok := rawArgs["order"]; ok { + return ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) + } + + var zeroVal *models.Ordering + return zeroVal, nil +} + +func (ec *executionContext) field_Query_myMedia_argsPaginate( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Pagination, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["paginate"] + if !ok { + var zeroVal *models.Pagination + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) + if tmp, ok := rawArgs["paginate"]; ok { + return ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) + } + + var zeroVal *models.Pagination + return zeroVal, nil +} func (ec *executionContext) field_Query_myTimeline_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Pagination - if tmp, ok := rawArgs["paginate"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) - arg0, err = ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_myTimeline_argsPaginate(ctx, rawArgs) + if err != nil { + return nil, err } args["paginate"] = arg0 - var arg1 *bool - if tmp, ok := rawArgs["onlyFavorites"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyFavorites")) - arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Query_myTimeline_argsOnlyFavorites(ctx, rawArgs) + if err != nil { + return nil, err } args["onlyFavorites"] = arg1 - var arg2 *time.Time - if tmp, ok := rawArgs["fromDate"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fromDate")) - arg2, err = ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) - if err != nil { - return nil, err - } + arg2, err := ec.field_Query_myTimeline_argsFromDate(ctx, rawArgs) + if err != nil { + return nil, err } args["fromDate"] = arg2 return args, nil } +func (ec *executionContext) field_Query_myTimeline_argsPaginate( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Pagination, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["paginate"] + if !ok { + var zeroVal *models.Pagination + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) + if tmp, ok := rawArgs["paginate"]; ok { + return ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) + } + + var zeroVal *models.Pagination + return zeroVal, nil +} + +func (ec *executionContext) field_Query_myTimeline_argsOnlyFavorites( + ctx context.Context, + rawArgs map[string]interface{}, +) (*bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["onlyFavorites"] + if !ok { + var zeroVal *bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyFavorites")) + if tmp, ok := rawArgs["onlyFavorites"]; ok { + return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + } + + var zeroVal *bool + return zeroVal, nil +} + +func (ec *executionContext) field_Query_myTimeline_argsFromDate( + ctx context.Context, + rawArgs map[string]interface{}, +) (*time.Time, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["fromDate"] + if !ok { + var zeroVal *time.Time + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("fromDate")) + if tmp, ok := rawArgs["fromDate"]; ok { + return ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) + } + + var zeroVal *time.Time + return zeroVal, nil +} func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["query"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("query")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_search_argsQuery(ctx, rawArgs) + if err != nil { + return nil, err } args["query"] = arg0 - var arg1 *int - if tmp, ok := rawArgs["limitMedia"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limitMedia")) - arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Query_search_argsLimitMedia(ctx, rawArgs) + if err != nil { + return nil, err } args["limitMedia"] = arg1 - var arg2 *int - if tmp, ok := rawArgs["limitAlbums"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limitAlbums")) - arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp) - if err != nil { - return nil, err - } + arg2, err := ec.field_Query_search_argsLimitAlbums(ctx, rawArgs) + if err != nil { + return nil, err } args["limitAlbums"] = arg2 return args, nil } +func (ec *executionContext) field_Query_search_argsQuery( + ctx context.Context, + rawArgs map[string]interface{}, +) (string, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["query"] + if !ok { + var zeroVal string + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("query")) + if tmp, ok := rawArgs["query"]; ok { + return ec.unmarshalNString2string(ctx, tmp) + } + + var zeroVal string + return zeroVal, nil +} + +func (ec *executionContext) field_Query_search_argsLimitMedia( + ctx context.Context, + rawArgs map[string]interface{}, +) (*int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["limitMedia"] + if !ok { + var zeroVal *int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("limitMedia")) + if tmp, ok := rawArgs["limitMedia"]; ok { + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } + + var zeroVal *int + return zeroVal, nil +} + +func (ec *executionContext) field_Query_search_argsLimitAlbums( + ctx context.Context, + rawArgs map[string]interface{}, +) (*int, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["limitAlbums"] + if !ok { + var zeroVal *int + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("limitAlbums")) + if tmp, ok := rawArgs["limitAlbums"]; ok { + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } + + var zeroVal *int + return zeroVal, nil +} func (ec *executionContext) field_Query_shareTokenValidatePassword_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 models.ShareTokenCredentials - if tmp, ok := rawArgs["credentials"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("credentials")) - arg0, err = ec.unmarshalNShareTokenCredentials2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenCredentials(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_shareTokenValidatePassword_argsCredentials(ctx, rawArgs) + if err != nil { + return nil, err } args["credentials"] = arg0 return args, nil } +func (ec *executionContext) field_Query_shareTokenValidatePassword_argsCredentials( + ctx context.Context, + rawArgs map[string]interface{}, +) (models.ShareTokenCredentials, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["credentials"] + if !ok { + var zeroVal models.ShareTokenCredentials + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("credentials")) + if tmp, ok := rawArgs["credentials"]; ok { + return ec.unmarshalNShareTokenCredentials2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenCredentials(ctx, tmp) + } + + var zeroVal models.ShareTokenCredentials + return zeroVal, nil +} func (ec *executionContext) field_Query_shareToken_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 models.ShareTokenCredentials - if tmp, ok := rawArgs["credentials"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("credentials")) - arg0, err = ec.unmarshalNShareTokenCredentials2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenCredentials(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_shareToken_argsCredentials(ctx, rawArgs) + if err != nil { + return nil, err } args["credentials"] = arg0 return args, nil } +func (ec *executionContext) field_Query_shareToken_argsCredentials( + ctx context.Context, + rawArgs map[string]interface{}, +) (models.ShareTokenCredentials, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["credentials"] + if !ok { + var zeroVal models.ShareTokenCredentials + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("credentials")) + if tmp, ok := rawArgs["credentials"]; ok { + return ec.unmarshalNShareTokenCredentials2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenCredentials(ctx, tmp) + } + + var zeroVal models.ShareTokenCredentials + return zeroVal, nil +} func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *models.Ordering - if tmp, ok := rawArgs["order"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) - arg0, err = ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_user_argsOrder(ctx, rawArgs) + if err != nil { + return nil, err } args["order"] = arg0 - var arg1 *models.Pagination - if tmp, ok := rawArgs["paginate"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) - arg1, err = ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) - if err != nil { - return nil, err - } + arg1, err := ec.field_Query_user_argsPaginate(ctx, rawArgs) + if err != nil { + return nil, err } args["paginate"] = arg1 return args, nil } +func (ec *executionContext) field_Query_user_argsOrder( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Ordering, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["order"] + if !ok { + var zeroVal *models.Ordering + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("order")) + if tmp, ok := rawArgs["order"]; ok { + return ec.unmarshalOOrdering2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐOrdering(ctx, tmp) + } + + var zeroVal *models.Ordering + return zeroVal, nil +} + +func (ec *executionContext) field_Query_user_argsPaginate( + ctx context.Context, + rawArgs map[string]interface{}, +) (*models.Pagination, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["paginate"] + if !ok { + var zeroVal *models.Pagination + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("paginate")) + if tmp, ok := rawArgs["paginate"]; ok { + return ec.unmarshalOPagination2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐPagination(ctx, tmp) + } + + var zeroVal *models.Pagination + return zeroVal, nil +} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err } args["includeDeprecated"] = arg0 return args, nil } +func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]interface{}, +) (bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["includeDeprecated"] + if !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) + if err != nil { + return nil, err } args["includeDeprecated"] = arg0 return args, nil } +func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( + ctx context.Context, + rawArgs map[string]interface{}, +) (bool, error) { + // We won't call the directive if the argument is null. + // Set call_argument_directives_with_null to true to call directives + // even if the argument is null. + _, ok := rawArgs["includeDeprecated"] + if !ok { + var zeroVal bool + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + if tmp, ok := rawArgs["includeDeprecated"]; ok { + return ec.unmarshalOBoolean2bool(ctx, tmp) + } + + var zeroVal bool + return zeroVal, nil +} // endregion ***************************** args.gotpl ***************************** @@ -2764,7 +4077,7 @@ func (ec *executionContext) _Album_id(ctx context.Context, field graphql.Collect return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Album_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Album_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Album", Field: field, @@ -2808,7 +4121,7 @@ func (ec *executionContext) _Album_title(ctx context.Context, field graphql.Coll return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Album_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Album_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Album", Field: field, @@ -3015,7 +4328,7 @@ func (ec *executionContext) _Album_parentAlbum(ctx context.Context, field graphq return ec.marshalOAlbum2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐAlbum(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Album_parentAlbum(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Album_parentAlbum(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Album", Field: field, @@ -3081,7 +4394,7 @@ func (ec *executionContext) _Album_owner(ctx context.Context, field graphql.Coll return ec.marshalNUser2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Album_owner(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Album_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Album", Field: field, @@ -3137,7 +4450,7 @@ func (ec *executionContext) _Album_filePath(ctx context.Context, field graphql.C return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Album_filePath(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Album_filePath(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Album", Field: field, @@ -3178,7 +4491,7 @@ func (ec *executionContext) _Album_thumbnail(ctx context.Context, field graphql. return ec.marshalOMedia2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMedia(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Album_thumbnail(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Album_thumbnail(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Album", Field: field, @@ -3256,7 +4569,7 @@ func (ec *executionContext) _Album_path(ctx context.Context, field graphql.Colle return ec.marshalNAlbum2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐAlbumᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Album_path(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Album_path(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Album", Field: field, @@ -3322,7 +4635,7 @@ func (ec *executionContext) _Album_shares(ctx context.Context, field graphql.Col return ec.marshalNShareToken2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Album_shares(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Album_shares(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Album", Field: field, @@ -3382,7 +4695,7 @@ func (ec *executionContext) _AuthorizeResult_success(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_AuthorizeResult_success(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_AuthorizeResult_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AuthorizeResult", Field: field, @@ -3426,7 +4739,7 @@ func (ec *executionContext) _AuthorizeResult_status(ctx context.Context, field g return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_AuthorizeResult_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_AuthorizeResult_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AuthorizeResult", Field: field, @@ -3467,7 +4780,7 @@ func (ec *executionContext) _AuthorizeResult_token(ctx context.Context, field gr return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_AuthorizeResult_token(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_AuthorizeResult_token(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AuthorizeResult", Field: field, @@ -3511,7 +4824,7 @@ func (ec *executionContext) _Coordinates_latitude(ctx context.Context, field gra return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Coordinates_latitude(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Coordinates_latitude(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Coordinates", Field: field, @@ -3555,7 +4868,7 @@ func (ec *executionContext) _Coordinates_longitude(ctx context.Context, field gr return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Coordinates_longitude(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Coordinates_longitude(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Coordinates", Field: field, @@ -3599,7 +4912,7 @@ func (ec *executionContext) _FaceGroup_id(ctx context.Context, field graphql.Col return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_FaceGroup_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_FaceGroup_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "FaceGroup", Field: field, @@ -3640,7 +4953,7 @@ func (ec *executionContext) _FaceGroup_label(ctx context.Context, field graphql. return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_FaceGroup_label(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_FaceGroup_label(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "FaceGroup", Field: field, @@ -3749,7 +5062,7 @@ func (ec *executionContext) _FaceGroup_imageFaceCount(ctx context.Context, field return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_FaceGroup_imageFaceCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_FaceGroup_imageFaceCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "FaceGroup", Field: field, @@ -3793,7 +5106,7 @@ func (ec *executionContext) _FaceRectangle_minX(ctx context.Context, field graph return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_FaceRectangle_minX(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_FaceRectangle_minX(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "FaceRectangle", Field: field, @@ -3837,7 +5150,7 @@ func (ec *executionContext) _FaceRectangle_maxX(ctx context.Context, field graph return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_FaceRectangle_maxX(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_FaceRectangle_maxX(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "FaceRectangle", Field: field, @@ -3881,7 +5194,7 @@ func (ec *executionContext) _FaceRectangle_minY(ctx context.Context, field graph return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_FaceRectangle_minY(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_FaceRectangle_minY(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "FaceRectangle", Field: field, @@ -3925,7 +5238,7 @@ func (ec *executionContext) _FaceRectangle_maxY(ctx context.Context, field graph return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_FaceRectangle_maxY(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_FaceRectangle_maxY(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "FaceRectangle", Field: field, @@ -3969,7 +5282,7 @@ func (ec *executionContext) _ImageFace_id(ctx context.Context, field graphql.Col return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImageFace_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImageFace_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ImageFace", Field: field, @@ -4013,7 +5326,7 @@ func (ec *executionContext) _ImageFace_media(ctx context.Context, field graphql. return ec.marshalNMedia2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMedia(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImageFace_media(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImageFace_media(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ImageFace", Field: field, @@ -4091,7 +5404,7 @@ func (ec *executionContext) _ImageFace_rectangle(ctx context.Context, field grap return ec.marshalNFaceRectangle2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐFaceRectangle(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImageFace_rectangle(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImageFace_rectangle(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ImageFace", Field: field, @@ -4145,7 +5458,7 @@ func (ec *executionContext) _ImageFace_faceGroup(ctx context.Context, field grap return ec.marshalNFaceGroup2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐFaceGroup(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ImageFace_faceGroup(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ImageFace_faceGroup(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ImageFace", Field: field, @@ -4199,7 +5512,7 @@ func (ec *executionContext) _Media_id(ctx context.Context, field graphql.Collect return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4243,7 +5556,7 @@ func (ec *executionContext) _Media_title(ctx context.Context, field graphql.Coll return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4287,7 +5600,7 @@ func (ec *executionContext) _Media_path(ctx context.Context, field graphql.Colle return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_path(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_path(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4328,7 +5641,7 @@ func (ec *executionContext) _Media_thumbnail(ctx context.Context, field graphql. return ec.marshalOMediaURL2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaURL(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_thumbnail(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_thumbnail(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4379,7 +5692,7 @@ func (ec *executionContext) _Media_highRes(ctx context.Context, field graphql.Co return ec.marshalOMediaURL2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaURL(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_highRes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_highRes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4430,7 +5743,7 @@ func (ec *executionContext) _Media_videoWeb(ctx context.Context, field graphql.C return ec.marshalOMediaURL2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaURL(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_videoWeb(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_videoWeb(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4484,7 +5797,7 @@ func (ec *executionContext) _Media_album(ctx context.Context, field graphql.Coll return ec.marshalNAlbum2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐAlbum(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_album(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_album(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4547,7 +5860,7 @@ func (ec *executionContext) _Media_exif(ctx context.Context, field graphql.Colle return ec.marshalOMediaEXIF2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaEXIF(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_exif(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_exif(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4618,7 +5931,7 @@ func (ec *executionContext) _Media_videoMetadata(ctx context.Context, field grap return ec.marshalOVideoMetadata2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐVideoMetadata(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_videoMetadata(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_videoMetadata(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4684,7 +5997,7 @@ func (ec *executionContext) _Media_favorite(ctx context.Context, field graphql.C return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_favorite(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_favorite(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4728,7 +6041,7 @@ func (ec *executionContext) _Media_type(ctx context.Context, field graphql.Colle return ec.marshalNMediaType2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4772,7 +6085,7 @@ func (ec *executionContext) _Media_date(ctx context.Context, field graphql.Colle return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_date(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_date(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4813,7 +6126,7 @@ func (ec *executionContext) _Media_blurhash(ctx context.Context, field graphql.C return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_blurhash(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_blurhash(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4857,7 +6170,7 @@ func (ec *executionContext) _Media_shares(ctx context.Context, field graphql.Col return ec.marshalNShareToken2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_shares(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_shares(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4917,7 +6230,7 @@ func (ec *executionContext) _Media_downloads(ctx context.Context, field graphql. return ec.marshalNMediaDownload2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaDownloadᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_downloads(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_downloads(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -4967,7 +6280,7 @@ func (ec *executionContext) _Media_faces(ctx context.Context, field graphql.Coll return ec.marshalNImageFace2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐImageFaceᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Media_faces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Media_faces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Media", Field: field, @@ -5021,7 +6334,7 @@ func (ec *executionContext) _MediaDownload_title(ctx context.Context, field grap return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaDownload_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaDownload_title(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaDownload", Field: field, @@ -5065,7 +6378,7 @@ func (ec *executionContext) _MediaDownload_mediaUrl(ctx context.Context, field g return ec.marshalNMediaURL2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaURL(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaDownload_mediaUrl(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaDownload_mediaUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaDownload", Field: field, @@ -5119,7 +6432,7 @@ func (ec *executionContext) _MediaEXIF_id(ctx context.Context, field graphql.Col return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5163,7 +6476,7 @@ func (ec *executionContext) _MediaEXIF_media(ctx context.Context, field graphql. return ec.marshalNMedia2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMedia(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_media(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_media(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5238,7 +6551,7 @@ func (ec *executionContext) _MediaEXIF_description(ctx context.Context, field gr return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5279,7 +6592,7 @@ func (ec *executionContext) _MediaEXIF_camera(ctx context.Context, field graphql return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_camera(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_camera(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5320,7 +6633,7 @@ func (ec *executionContext) _MediaEXIF_maker(ctx context.Context, field graphql. return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_maker(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_maker(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5361,7 +6674,7 @@ func (ec *executionContext) _MediaEXIF_lens(ctx context.Context, field graphql.C return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_lens(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_lens(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5402,7 +6715,7 @@ func (ec *executionContext) _MediaEXIF_dateShot(ctx context.Context, field graph return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_dateShot(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_dateShot(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5443,7 +6756,7 @@ func (ec *executionContext) _MediaEXIF_exposure(ctx context.Context, field graph return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_exposure(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_exposure(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5484,7 +6797,7 @@ func (ec *executionContext) _MediaEXIF_aperture(ctx context.Context, field graph return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_aperture(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_aperture(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5525,7 +6838,7 @@ func (ec *executionContext) _MediaEXIF_iso(ctx context.Context, field graphql.Co return ec.marshalOInt2ᚖint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_iso(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_iso(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5566,7 +6879,7 @@ func (ec *executionContext) _MediaEXIF_focalLength(ctx context.Context, field gr return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_focalLength(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_focalLength(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5607,7 +6920,7 @@ func (ec *executionContext) _MediaEXIF_flash(ctx context.Context, field graphql. return ec.marshalOInt2ᚖint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_flash(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_flash(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5648,7 +6961,7 @@ func (ec *executionContext) _MediaEXIF_exposureProgram(ctx context.Context, fiel return ec.marshalOInt2ᚖint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_exposureProgram(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_exposureProgram(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5689,7 +7002,7 @@ func (ec *executionContext) _MediaEXIF_coordinates(ctx context.Context, field gr return ec.marshalOCoordinates2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐCoordinates(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaEXIF_coordinates(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaEXIF_coordinates(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaEXIF", Field: field, @@ -5739,7 +7052,7 @@ func (ec *executionContext) _MediaURL_url(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaURL_url(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaURL_url(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaURL", Field: field, @@ -5783,7 +7096,7 @@ func (ec *executionContext) _MediaURL_width(ctx context.Context, field graphql.C return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaURL_width(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaURL_width(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaURL", Field: field, @@ -5827,7 +7140,7 @@ func (ec *executionContext) _MediaURL_height(ctx context.Context, field graphql. return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaURL_height(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaURL_height(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaURL", Field: field, @@ -5871,7 +7184,7 @@ func (ec *executionContext) _MediaURL_fileSize(ctx context.Context, field graphq return ec.marshalNInt2int64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_MediaURL_fileSize(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MediaURL_fileSize(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "MediaURL", Field: field, @@ -6024,9 +7337,11 @@ func (ec *executionContext) _Mutation_scanAll(ctx context.Context, field graphql ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ScanAll(rctx) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal *models.ScannerResult + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -6058,7 +7373,7 @@ func (ec *executionContext) _Mutation_scanAll(ctx context.Context, field graphql return ec.marshalNScannerResult2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐScannerResult(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_scanAll(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_scanAll(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, @@ -6098,9 +7413,11 @@ func (ec *executionContext) _Mutation_scanUser(ctx context.Context, field graphq ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ScanUser(rctx, fc.Args["userId"].(int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal *models.ScannerResult + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -6183,9 +7500,11 @@ func (ec *executionContext) _Mutation_shareAlbum(ctx context.Context, field grap ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ShareAlbum(rctx, fc.Args["albumId"].(int), fc.Args["expire"].(*time.Time), fc.Args["password"].(*string)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.ShareToken + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -6274,9 +7593,11 @@ func (ec *executionContext) _Mutation_shareMedia(ctx context.Context, field grap ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ShareMedia(rctx, fc.Args["mediaId"].(int), fc.Args["expire"].(*time.Time), fc.Args["password"].(*string)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.ShareToken + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -6365,9 +7686,11 @@ func (ec *executionContext) _Mutation_deleteShareToken(ctx context.Context, fiel ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().DeleteShareToken(rctx, fc.Args["token"].(string)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.ShareToken + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -6456,9 +7779,11 @@ func (ec *executionContext) _Mutation_protectShareToken(ctx context.Context, fie ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ProtectShareToken(rctx, fc.Args["token"].(string), fc.Args["password"].(*string)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.ShareToken + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -6530,115 +7855,6 @@ func (ec *executionContext) fieldContext_Mutation_protectShareToken(ctx context. return fc, nil } -func (ec *executionContext) _Mutation_favoriteMedia(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_favoriteMedia(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().FavoriteMedia(rctx, fc.Args["mediaId"].(int), fc.Args["favorite"].(bool)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") - } - return ec.directives.IsAuthorized(ctx, nil, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*models.Media); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/photoview/photoview/api/graphql/models.Media`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*models.Media) - fc.Result = res - return ec.marshalNMedia2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMedia(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Mutation_favoriteMedia(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Mutation", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Media_id(ctx, field) - case "title": - return ec.fieldContext_Media_title(ctx, field) - case "path": - return ec.fieldContext_Media_path(ctx, field) - case "thumbnail": - return ec.fieldContext_Media_thumbnail(ctx, field) - case "highRes": - return ec.fieldContext_Media_highRes(ctx, field) - case "videoWeb": - return ec.fieldContext_Media_videoWeb(ctx, field) - case "album": - return ec.fieldContext_Media_album(ctx, field) - case "exif": - return ec.fieldContext_Media_exif(ctx, field) - case "videoMetadata": - return ec.fieldContext_Media_videoMetadata(ctx, field) - case "favorite": - return ec.fieldContext_Media_favorite(ctx, field) - case "type": - return ec.fieldContext_Media_type(ctx, field) - case "date": - return ec.fieldContext_Media_date(ctx, field) - case "blurhash": - return ec.fieldContext_Media_blurhash(ctx, field) - case "shares": - return ec.fieldContext_Media_shares(ctx, field) - case "downloads": - return ec.fieldContext_Media_downloads(ctx, field) - case "faces": - return ec.fieldContext_Media_faces(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Media", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_favoriteMedia_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - func (ec *executionContext) _Mutation_updateUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Mutation_updateUser(ctx, field) if err != nil { @@ -6656,9 +7872,11 @@ func (ec *executionContext) _Mutation_updateUser(ctx context.Context, field grap ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().UpdateUser(rctx, fc.Args["id"].(int), fc.Args["username"].(*string), fc.Args["password"].(*string), fc.Args["admin"].(*bool)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal *models.User + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -6743,9 +7961,11 @@ func (ec *executionContext) _Mutation_createUser(ctx context.Context, field grap ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateUser(rctx, fc.Args["username"].(string), fc.Args["password"].(*string), fc.Args["admin"].(bool)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal *models.User + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -6830,9 +8050,11 @@ func (ec *executionContext) _Mutation_deleteUser(ctx context.Context, field grap ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().DeleteUser(rctx, fc.Args["id"].(int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal *models.User + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -6917,9 +8139,11 @@ func (ec *executionContext) _Mutation_userAddRootPath(ctx context.Context, field ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().UserAddRootPath(rctx, fc.Args["id"].(int), fc.Args["rootPath"].(string)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal *models.Album + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -7011,9 +8235,11 @@ func (ec *executionContext) _Mutation_userRemoveRootAlbum(ctx context.Context, f ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().UserRemoveRootAlbum(rctx, fc.Args["userId"].(int), fc.Args["albumId"].(int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal *models.Album + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -7105,9 +8331,11 @@ func (ec *executionContext) _Mutation_setPeriodicScanInterval(ctx context.Contex ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SetPeriodicScanInterval(rctx, fc.Args["interval"].(int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal int + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -7180,9 +8408,11 @@ func (ec *executionContext) _Mutation_setScannerConcurrentWorkers(ctx context.Co ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SetScannerConcurrentWorkers(rctx, fc.Args["workers"].(int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal int + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -7255,9 +8485,11 @@ func (ec *executionContext) _Mutation_setThumbnailDownsampleMethod(ctx context.C ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SetThumbnailDownsampleMethod(rctx, fc.Args["method"].(models.ThumbnailFilter)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal models.ThumbnailFilter + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -7330,9 +8562,11 @@ func (ec *executionContext) _Mutation_changeUserPreferences(ctx context.Context, ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ChangeUserPreferences(rctx, fc.Args["language"].(*string)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.UserPreferences + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -7411,9 +8645,11 @@ func (ec *executionContext) _Mutation_resetAlbumCover(ctx context.Context, field ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().ResetAlbumCover(rctx, fc.Args["albumID"].(int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.Album + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -7508,9 +8744,11 @@ func (ec *executionContext) _Mutation_setAlbumCover(ctx context.Context, field g ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SetAlbumCover(rctx, fc.Args["coverID"].(int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.Album + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -7605,9 +8843,11 @@ func (ec *executionContext) _Mutation_setFaceGroupLabel(ctx context.Context, fie ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SetFaceGroupLabel(rctx, fc.Args["faceGroupID"].(int), fc.Args["label"].(*string)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.FaceGroup + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -7690,9 +8930,11 @@ func (ec *executionContext) _Mutation_combineFaceGroups(ctx context.Context, fie ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CombineFaceGroups(rctx, fc.Args["destinationFaceGroupID"].(int), fc.Args["sourceFaceGroupID"].(int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.FaceGroup + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -7775,9 +9017,11 @@ func (ec *executionContext) _Mutation_moveImageFaces(ctx context.Context, field ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MoveImageFaces(rctx, fc.Args["imageFaceIDs"].([]int), fc.Args["destinationFaceGroupID"].(int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.FaceGroup + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -7860,9 +9104,11 @@ func (ec *executionContext) _Mutation_recognizeUnlabeledFaces(ctx context.Contex ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().RecognizeUnlabeledFaces(rctx) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal []*models.ImageFace + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -7894,7 +9140,7 @@ func (ec *executionContext) _Mutation_recognizeUnlabeledFaces(ctx context.Contex return ec.marshalNImageFace2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐImageFaceᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_recognizeUnlabeledFaces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_recognizeUnlabeledFaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Mutation", Field: field, @@ -7934,9 +9180,11 @@ func (ec *executionContext) _Mutation_detachImageFaces(ctx context.Context, fiel ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().DetachImageFaces(rctx, fc.Args["imageFaceIDs"].([]int)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.FaceGroup + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -8002,6 +9250,117 @@ func (ec *executionContext) fieldContext_Mutation_detachImageFaces(ctx context.C return fc, nil } +func (ec *executionContext) _Mutation_favoriteMedia(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_favoriteMedia(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().FavoriteMedia(rctx, fc.Args["mediaId"].(int), fc.Args["favorite"].(bool)) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsAuthorized == nil { + var zeroVal *models.Media + return zeroVal, errors.New("directive isAuthorized is not implemented") + } + return ec.directives.IsAuthorized(ctx, nil, directive0) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*models.Media); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/photoview/photoview/api/graphql/models.Media`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*models.Media) + fc.Result = res + return ec.marshalNMedia2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMedia(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_favoriteMedia(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Media_id(ctx, field) + case "title": + return ec.fieldContext_Media_title(ctx, field) + case "path": + return ec.fieldContext_Media_path(ctx, field) + case "thumbnail": + return ec.fieldContext_Media_thumbnail(ctx, field) + case "highRes": + return ec.fieldContext_Media_highRes(ctx, field) + case "videoWeb": + return ec.fieldContext_Media_videoWeb(ctx, field) + case "album": + return ec.fieldContext_Media_album(ctx, field) + case "exif": + return ec.fieldContext_Media_exif(ctx, field) + case "videoMetadata": + return ec.fieldContext_Media_videoMetadata(ctx, field) + case "favorite": + return ec.fieldContext_Media_favorite(ctx, field) + case "type": + return ec.fieldContext_Media_type(ctx, field) + case "date": + return ec.fieldContext_Media_date(ctx, field) + case "blurhash": + return ec.fieldContext_Media_blurhash(ctx, field) + case "shares": + return ec.fieldContext_Media_shares(ctx, field) + case "downloads": + return ec.fieldContext_Media_downloads(ctx, field) + case "faces": + return ec.fieldContext_Media_faces(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Media", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_favoriteMedia_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Notification_key(ctx context.Context, field graphql.CollectedField, obj *models.Notification) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Notification_key(ctx, field) if err != nil { @@ -8033,7 +9392,7 @@ func (ec *executionContext) _Notification_key(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_key(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_key(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, @@ -8077,7 +9436,7 @@ func (ec *executionContext) _Notification_type(ctx context.Context, field graphq return ec.marshalNNotificationType2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐNotificationType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, @@ -8121,7 +9480,7 @@ func (ec *executionContext) _Notification_header(ctx context.Context, field grap return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_header(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_header(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, @@ -8165,7 +9524,7 @@ func (ec *executionContext) _Notification_content(ctx context.Context, field gra return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_content(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_content(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, @@ -8206,7 +9565,7 @@ func (ec *executionContext) _Notification_progress(ctx context.Context, field gr return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_progress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_progress(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, @@ -8250,7 +9609,7 @@ func (ec *executionContext) _Notification_positive(ctx context.Context, field gr return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_positive(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_positive(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, @@ -8294,7 +9653,7 @@ func (ec *executionContext) _Notification_negative(ctx context.Context, field gr return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_negative(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_negative(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, @@ -8335,7 +9694,7 @@ func (ec *executionContext) _Notification_timeout(ctx context.Context, field gra return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Notification_timeout(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Notification_timeout(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Notification", Field: field, @@ -8379,7 +9738,7 @@ func (ec *executionContext) _Query_siteInfo(ctx context.Context, field graphql.C return ec.marshalNSiteInfo2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐSiteInfo(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_siteInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_siteInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -8421,9 +9780,11 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, fc.Args["order"].(*models.Ordering), fc.Args["paginate"].(*models.Pagination)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal []*models.User + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, nil, directive0) } @@ -8508,9 +9869,11 @@ func (ec *executionContext) _Query_myUser(ctx context.Context, field graphql.Col ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MyUser(rctx) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.User + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -8542,7 +9905,7 @@ func (ec *executionContext) _Query_myUser(ctx context.Context, field graphql.Col return ec.marshalNUser2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_myUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_myUser(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -8584,9 +9947,11 @@ func (ec *executionContext) _Query_myUserPreferences(ctx context.Context, field ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MyUserPreferences(rctx) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal *models.UserPreferences + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -8618,7 +9983,7 @@ func (ec *executionContext) _Query_myUserPreferences(ctx context.Context, field return ec.marshalNUserPreferences2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐUserPreferences(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_myUserPreferences(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_myUserPreferences(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -8637,6 +10002,306 @@ func (ec *executionContext) fieldContext_Query_myUserPreferences(ctx context.Con return fc, nil } +func (ec *executionContext) _Query_myTimeline(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_myTimeline(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().MyTimeline(rctx, fc.Args["paginate"].(*models.Pagination), fc.Args["onlyFavorites"].(*bool), fc.Args["fromDate"].(*time.Time)) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsAuthorized == nil { + var zeroVal []*models.Media + return zeroVal, errors.New("directive isAuthorized is not implemented") + } + return ec.directives.IsAuthorized(ctx, nil, directive0) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.([]*models.Media); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be []*github.com/photoview/photoview/api/graphql/models.Media`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*models.Media) + fc.Result = res + return ec.marshalNMedia2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_myTimeline(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Media_id(ctx, field) + case "title": + return ec.fieldContext_Media_title(ctx, field) + case "path": + return ec.fieldContext_Media_path(ctx, field) + case "thumbnail": + return ec.fieldContext_Media_thumbnail(ctx, field) + case "highRes": + return ec.fieldContext_Media_highRes(ctx, field) + case "videoWeb": + return ec.fieldContext_Media_videoWeb(ctx, field) + case "album": + return ec.fieldContext_Media_album(ctx, field) + case "exif": + return ec.fieldContext_Media_exif(ctx, field) + case "videoMetadata": + return ec.fieldContext_Media_videoMetadata(ctx, field) + case "favorite": + return ec.fieldContext_Media_favorite(ctx, field) + case "type": + return ec.fieldContext_Media_type(ctx, field) + case "date": + return ec.fieldContext_Media_date(ctx, field) + case "blurhash": + return ec.fieldContext_Media_blurhash(ctx, field) + case "shares": + return ec.fieldContext_Media_shares(ctx, field) + case "downloads": + return ec.fieldContext_Media_downloads(ctx, field) + case "faces": + return ec.fieldContext_Media_faces(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Media", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_myTimeline_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_shareToken(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_shareToken(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ShareToken(rctx, fc.Args["credentials"].(models.ShareTokenCredentials)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*models.ShareToken) + fc.Result = res + return ec.marshalNShareToken2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareToken(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_shareToken(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ShareToken_id(ctx, field) + case "token": + return ec.fieldContext_ShareToken_token(ctx, field) + case "owner": + return ec.fieldContext_ShareToken_owner(ctx, field) + case "expire": + return ec.fieldContext_ShareToken_expire(ctx, field) + case "hasPassword": + return ec.fieldContext_ShareToken_hasPassword(ctx, field) + case "album": + return ec.fieldContext_ShareToken_album(ctx, field) + case "media": + return ec.fieldContext_ShareToken_media(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ShareToken", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_shareToken_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_shareTokenValidatePassword(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_shareTokenValidatePassword(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ShareTokenValidatePassword(rctx, fc.Args["credentials"].(models.ShareTokenCredentials)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_shareTokenValidatePassword(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_shareTokenValidatePassword_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_search(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Search(rctx, fc.Args["query"].(string), fc.Args["limitMedia"].(*int), fc.Args["limitAlbums"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*models.SearchResult) + fc.Result = res + return ec.marshalNSearchResult2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐSearchResult(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_search(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "query": + return ec.fieldContext_SearchResult_query(ctx, field) + case "albums": + return ec.fieldContext_SearchResult_albums(ctx, field) + case "media": + return ec.fieldContext_SearchResult_media(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SearchResult", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_search_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query_myAlbums(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_myAlbums(ctx, field) if err != nil { @@ -8654,9 +10319,11 @@ func (ec *executionContext) _Query_myAlbums(ctx context.Context, field graphql.C ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MyAlbums(rctx, fc.Args["order"].(*models.Ordering), fc.Args["paginate"].(*models.Pagination), fc.Args["onlyRoot"].(*bool), fc.Args["showEmpty"].(*bool), fc.Args["onlyWithFavorites"].(*bool)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal []*models.Album + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -8811,6 +10478,180 @@ func (ec *executionContext) fieldContext_Query_album(ctx context.Context, field return fc, nil } +func (ec *executionContext) _Query_myFaceGroups(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_myFaceGroups(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().MyFaceGroups(rctx, fc.Args["paginate"].(*models.Pagination)) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsAuthorized == nil { + var zeroVal []*models.FaceGroup + return zeroVal, errors.New("directive isAuthorized is not implemented") + } + return ec.directives.IsAuthorized(ctx, nil, directive0) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.([]*models.FaceGroup); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be []*github.com/photoview/photoview/api/graphql/models.FaceGroup`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*models.FaceGroup) + fc.Result = res + return ec.marshalNFaceGroup2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐFaceGroupᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_myFaceGroups(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_FaceGroup_id(ctx, field) + case "label": + return ec.fieldContext_FaceGroup_label(ctx, field) + case "imageFaces": + return ec.fieldContext_FaceGroup_imageFaces(ctx, field) + case "imageFaceCount": + return ec.fieldContext_FaceGroup_imageFaceCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type FaceGroup", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_myFaceGroups_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_faceGroup(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_faceGroup(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().FaceGroup(rctx, fc.Args["id"].(int)) + } + + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsAuthorized == nil { + var zeroVal *models.FaceGroup + return zeroVal, errors.New("directive isAuthorized is not implemented") + } + return ec.directives.IsAuthorized(ctx, nil, directive0) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*models.FaceGroup); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/photoview/photoview/api/graphql/models.FaceGroup`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*models.FaceGroup) + fc.Result = res + return ec.marshalNFaceGroup2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐFaceGroup(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_faceGroup(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_FaceGroup_id(ctx, field) + case "label": + return ec.fieldContext_FaceGroup_label(ctx, field) + case "imageFaces": + return ec.fieldContext_FaceGroup_imageFaces(ctx, field) + case "imageFaceCount": + return ec.fieldContext_FaceGroup_imageFaceCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type FaceGroup", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_faceGroup_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query_myMedia(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_myMedia(ctx, field) if err != nil { @@ -8828,9 +10669,11 @@ func (ec *executionContext) _Query_myMedia(ctx context.Context, field graphql.Co ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MyMedia(rctx, fc.Args["order"].(*models.Ordering), fc.Args["paginate"].(*models.Pagination)) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal []*models.Media + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -9098,115 +10941,6 @@ func (ec *executionContext) fieldContext_Query_mediaList(ctx context.Context, fi return fc, nil } -func (ec *executionContext) _Query_myTimeline(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_myTimeline(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().MyTimeline(rctx, fc.Args["paginate"].(*models.Pagination), fc.Args["onlyFavorites"].(*bool), fc.Args["fromDate"].(*time.Time)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") - } - return ec.directives.IsAuthorized(ctx, nil, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.([]*models.Media); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be []*github.com/photoview/photoview/api/graphql/models.Media`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*models.Media) - fc.Result = res - return ec.marshalNMedia2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_myTimeline(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Media_id(ctx, field) - case "title": - return ec.fieldContext_Media_title(ctx, field) - case "path": - return ec.fieldContext_Media_path(ctx, field) - case "thumbnail": - return ec.fieldContext_Media_thumbnail(ctx, field) - case "highRes": - return ec.fieldContext_Media_highRes(ctx, field) - case "videoWeb": - return ec.fieldContext_Media_videoWeb(ctx, field) - case "album": - return ec.fieldContext_Media_album(ctx, field) - case "exif": - return ec.fieldContext_Media_exif(ctx, field) - case "videoMetadata": - return ec.fieldContext_Media_videoMetadata(ctx, field) - case "favorite": - return ec.fieldContext_Media_favorite(ctx, field) - case "type": - return ec.fieldContext_Media_type(ctx, field) - case "date": - return ec.fieldContext_Media_date(ctx, field) - case "blurhash": - return ec.fieldContext_Media_blurhash(ctx, field) - case "shares": - return ec.fieldContext_Media_shares(ctx, field) - case "downloads": - return ec.fieldContext_Media_downloads(ctx, field) - case "faces": - return ec.fieldContext_Media_faces(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Media", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_myTimeline_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - func (ec *executionContext) _Query_myMediaGeoJson(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_myMediaGeoJson(ctx, field) if err != nil { @@ -9224,9 +10958,11 @@ func (ec *executionContext) _Query_myMediaGeoJson(ctx context.Context, field gra ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MyMediaGeoJSON(rctx) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") + var zeroVal any + return zeroVal, errors.New("directive isAuthorized is not implemented") } return ec.directives.IsAuthorized(ctx, nil, directive0) } @@ -9238,10 +10974,10 @@ func (ec *executionContext) _Query_myMediaGeoJson(ctx context.Context, field gra if tmp == nil { return nil, nil } - if data, ok := tmp.(interface{}); ok { + if data, ok := tmp.(any); ok { return data, nil } - return nil, fmt.Errorf(`unexpected type %T from directive, should be interface{}`, tmp) + return nil, fmt.Errorf(`unexpected type %T from directive, should be any`, tmp) }) if err != nil { ec.Error(ctx, err) @@ -9253,12 +10989,12 @@ func (ec *executionContext) _Query_myMediaGeoJson(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(interface{}) + res := resTmp.(any) fc.Result = res return ec.marshalNAny2interface(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_myMediaGeoJson(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_myMediaGeoJson(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -9299,7 +11035,7 @@ func (ec *executionContext) _Query_mapboxToken(ctx context.Context, field graphq return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_mapboxToken(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_mapboxToken(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -9312,365 +11048,6 @@ func (ec *executionContext) fieldContext_Query_mapboxToken(ctx context.Context, return fc, nil } -func (ec *executionContext) _Query_shareToken(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_shareToken(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ShareToken(rctx, fc.Args["credentials"].(models.ShareTokenCredentials)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*models.ShareToken) - fc.Result = res - return ec.marshalNShareToken2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareToken(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_shareToken(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_ShareToken_id(ctx, field) - case "token": - return ec.fieldContext_ShareToken_token(ctx, field) - case "owner": - return ec.fieldContext_ShareToken_owner(ctx, field) - case "expire": - return ec.fieldContext_ShareToken_expire(ctx, field) - case "hasPassword": - return ec.fieldContext_ShareToken_hasPassword(ctx, field) - case "album": - return ec.fieldContext_ShareToken_album(ctx, field) - case "media": - return ec.fieldContext_ShareToken_media(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type ShareToken", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_shareToken_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Query_shareTokenValidatePassword(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_shareTokenValidatePassword(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ShareTokenValidatePassword(rctx, fc.Args["credentials"].(models.ShareTokenCredentials)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_shareTokenValidatePassword(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_shareTokenValidatePassword_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_search(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Search(rctx, fc.Args["query"].(string), fc.Args["limitMedia"].(*int), fc.Args["limitAlbums"].(*int)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*models.SearchResult) - fc.Result = res - return ec.marshalNSearchResult2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐSearchResult(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_search(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "query": - return ec.fieldContext_SearchResult_query(ctx, field) - case "albums": - return ec.fieldContext_SearchResult_albums(ctx, field) - case "media": - return ec.fieldContext_SearchResult_media(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type SearchResult", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_search_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Query_myFaceGroups(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_myFaceGroups(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().MyFaceGroups(rctx, fc.Args["paginate"].(*models.Pagination)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") - } - return ec.directives.IsAuthorized(ctx, nil, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.([]*models.FaceGroup); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be []*github.com/photoview/photoview/api/graphql/models.FaceGroup`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]*models.FaceGroup) - fc.Result = res - return ec.marshalNFaceGroup2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐFaceGroupᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_myFaceGroups(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_FaceGroup_id(ctx, field) - case "label": - return ec.fieldContext_FaceGroup_label(ctx, field) - case "imageFaces": - return ec.fieldContext_FaceGroup_imageFaces(ctx, field) - case "imageFaceCount": - return ec.fieldContext_FaceGroup_imageFaceCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type FaceGroup", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_myFaceGroups_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Query_faceGroup(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_faceGroup(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - directive0 := func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().FaceGroup(rctx, fc.Args["id"].(int)) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.IsAuthorized == nil { - return nil, errors.New("directive isAuthorized is not implemented") - } - return ec.directives.IsAuthorized(ctx, nil, directive0) - } - - tmp, err := directive1(rctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) - } - if tmp == nil { - return nil, nil - } - if data, ok := tmp.(*models.FaceGroup); ok { - return data, nil - } - return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/photoview/photoview/api/graphql/models.FaceGroup`, tmp) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*models.FaceGroup) - fc.Result = res - return ec.marshalNFaceGroup2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐFaceGroup(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_faceGroup(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_FaceGroup_id(ctx, field) - case "label": - return ec.fieldContext_FaceGroup_label(ctx, field) - case "imageFaces": - return ec.fieldContext_FaceGroup_imageFaces(ctx, field) - case "imageFaceCount": - return ec.fieldContext_FaceGroup_imageFaceCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type FaceGroup", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_faceGroup_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { @@ -9773,7 +11150,7 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___schema(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -9831,7 +11208,7 @@ func (ec *executionContext) _ScannerResult_finished(ctx context.Context, field g return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ScannerResult_finished(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ScannerResult_finished(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ScannerResult", Field: field, @@ -9875,7 +11252,7 @@ func (ec *executionContext) _ScannerResult_success(ctx context.Context, field gr return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ScannerResult_success(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ScannerResult_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ScannerResult", Field: field, @@ -9916,7 +11293,7 @@ func (ec *executionContext) _ScannerResult_progress(ctx context.Context, field g return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ScannerResult_progress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ScannerResult_progress(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ScannerResult", Field: field, @@ -9957,7 +11334,7 @@ func (ec *executionContext) _ScannerResult_message(ctx context.Context, field gr return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ScannerResult_message(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ScannerResult_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ScannerResult", Field: field, @@ -10001,7 +11378,7 @@ func (ec *executionContext) _SearchResult_query(ctx context.Context, field graph return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SearchResult_query(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SearchResult_query(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SearchResult", Field: field, @@ -10045,7 +11422,7 @@ func (ec *executionContext) _SearchResult_albums(ctx context.Context, field grap return ec.marshalNAlbum2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐAlbumᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SearchResult_albums(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SearchResult_albums(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SearchResult", Field: field, @@ -10111,7 +11488,7 @@ func (ec *executionContext) _SearchResult_media(ctx context.Context, field graph return ec.marshalNMedia2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SearchResult_media(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SearchResult_media(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SearchResult", Field: field, @@ -10189,7 +11566,7 @@ func (ec *executionContext) _ShareToken_id(ctx context.Context, field graphql.Co return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ShareToken_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShareToken_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ShareToken", Field: field, @@ -10233,7 +11610,7 @@ func (ec *executionContext) _ShareToken_token(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ShareToken_token(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShareToken_token(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ShareToken", Field: field, @@ -10277,7 +11654,7 @@ func (ec *executionContext) _ShareToken_owner(ctx context.Context, field graphql return ec.marshalNUser2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ShareToken_owner(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShareToken_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ShareToken", Field: field, @@ -10330,7 +11707,7 @@ func (ec *executionContext) _ShareToken_expire(ctx context.Context, field graphq return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ShareToken_expire(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShareToken_expire(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ShareToken", Field: field, @@ -10374,7 +11751,7 @@ func (ec *executionContext) _ShareToken_hasPassword(ctx context.Context, field g return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ShareToken_hasPassword(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShareToken_hasPassword(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ShareToken", Field: field, @@ -10415,7 +11792,7 @@ func (ec *executionContext) _ShareToken_album(ctx context.Context, field graphql return ec.marshalOAlbum2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐAlbum(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ShareToken_album(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShareToken_album(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ShareToken", Field: field, @@ -10478,7 +11855,7 @@ func (ec *executionContext) _ShareToken_media(ctx context.Context, field graphql return ec.marshalOMedia2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMedia(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_ShareToken_media(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_ShareToken_media(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "ShareToken", Field: field, @@ -10556,7 +11933,7 @@ func (ec *executionContext) _SiteInfo_initialSetup(ctx context.Context, field gr return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SiteInfo_initialSetup(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SiteInfo_initialSetup(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SiteInfo", Field: field, @@ -10600,7 +11977,7 @@ func (ec *executionContext) _SiteInfo_faceDetectionEnabled(ctx context.Context, return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SiteInfo_faceDetectionEnabled(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SiteInfo_faceDetectionEnabled(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SiteInfo", Field: field, @@ -10630,9 +12007,11 @@ func (ec *executionContext) _SiteInfo_periodicScanInterval(ctx context.Context, ctx = rctx // use context from middleware stack in children return obj.PeriodicScanInterval, nil } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal int + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, obj, directive0) } @@ -10664,7 +12043,7 @@ func (ec *executionContext) _SiteInfo_periodicScanInterval(ctx context.Context, return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SiteInfo_periodicScanInterval(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SiteInfo_periodicScanInterval(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SiteInfo", Field: field, @@ -10694,9 +12073,11 @@ func (ec *executionContext) _SiteInfo_concurrentWorkers(ctx context.Context, fie ctx = rctx // use context from middleware stack in children return obj.ConcurrentWorkers, nil } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal int + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, obj, directive0) } @@ -10728,7 +12109,7 @@ func (ec *executionContext) _SiteInfo_concurrentWorkers(ctx context.Context, fie return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SiteInfo_concurrentWorkers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SiteInfo_concurrentWorkers(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SiteInfo", Field: field, @@ -10758,9 +12139,11 @@ func (ec *executionContext) _SiteInfo_thumbnailMethod(ctx context.Context, field ctx = rctx // use context from middleware stack in children return obj.ThumbnailMethod, nil } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal models.ThumbnailFilter + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, obj, directive0) } @@ -10792,7 +12175,7 @@ func (ec *executionContext) _SiteInfo_thumbnailMethod(ctx context.Context, field return ec.marshalNThumbnailFilter2githubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐThumbnailFilter(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SiteInfo_thumbnailMethod(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SiteInfo_thumbnailMethod(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SiteInfo", Field: field, @@ -10850,7 +12233,7 @@ func (ec *executionContext) _Subscription_notification(ctx context.Context, fiel } } -func (ec *executionContext) fieldContext_Subscription_notification(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Subscription_notification(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Subscription", Field: field, @@ -10912,7 +12295,7 @@ func (ec *executionContext) _TimelineGroup_album(ctx context.Context, field grap return ec.marshalNAlbum2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐAlbum(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TimelineGroup_album(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TimelineGroup_album(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TimelineGroup", Field: field, @@ -10978,7 +12361,7 @@ func (ec *executionContext) _TimelineGroup_media(ctx context.Context, field grap return ec.marshalNMedia2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMediaᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TimelineGroup_media(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TimelineGroup_media(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TimelineGroup", Field: field, @@ -11056,7 +12439,7 @@ func (ec *executionContext) _TimelineGroup_mediaTotal(ctx context.Context, field return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TimelineGroup_mediaTotal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TimelineGroup_mediaTotal(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TimelineGroup", Field: field, @@ -11100,7 +12483,7 @@ func (ec *executionContext) _TimelineGroup_date(ctx context.Context, field graph return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_TimelineGroup_date(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TimelineGroup_date(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "TimelineGroup", Field: field, @@ -11144,7 +12527,7 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "User", Field: field, @@ -11188,7 +12571,7 @@ func (ec *executionContext) _User_username(ctx context.Context, field graphql.Co return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_username(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_username(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "User", Field: field, @@ -11218,9 +12601,11 @@ func (ec *executionContext) _User_albums(ctx context.Context, field graphql.Coll ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Albums(rctx, obj) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal []*models.Album + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, obj, directive0) } @@ -11252,7 +12637,7 @@ func (ec *executionContext) _User_albums(ctx context.Context, field graphql.Coll return ec.marshalNAlbum2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐAlbumᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_albums(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_albums(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "User", Field: field, @@ -11304,9 +12689,11 @@ func (ec *executionContext) _User_rootAlbums(ctx context.Context, field graphql. ctx = rctx // use context from middleware stack in children return ec.resolvers.User().RootAlbums(rctx, obj) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.IsAdmin == nil { - return nil, errors.New("directive isAdmin is not implemented") + var zeroVal []*models.Album + return zeroVal, errors.New("directive isAdmin is not implemented") } return ec.directives.IsAdmin(ctx, obj, directive0) } @@ -11338,7 +12725,7 @@ func (ec *executionContext) _User_rootAlbums(ctx context.Context, field graphql. return ec.marshalNAlbum2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐAlbumᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_rootAlbums(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_rootAlbums(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "User", Field: field, @@ -11404,7 +12791,7 @@ func (ec *executionContext) _User_admin(ctx context.Context, field graphql.Colle return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_admin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_admin(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "User", Field: field, @@ -11448,7 +12835,7 @@ func (ec *executionContext) _UserPreferences_id(ctx context.Context, field graph return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UserPreferences_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UserPreferences_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "UserPreferences", Field: field, @@ -11489,7 +12876,7 @@ func (ec *executionContext) _UserPreferences_language(ctx context.Context, field return ec.marshalOLanguageTranslation2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐLanguageTranslation(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_UserPreferences_language(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UserPreferences_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "UserPreferences", Field: field, @@ -11533,7 +12920,7 @@ func (ec *executionContext) _VideoMetadata_id(ctx context.Context, field graphql return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11577,7 +12964,7 @@ func (ec *executionContext) _VideoMetadata_media(ctx context.Context, field grap return ec.marshalNMedia2ᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐMedia(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_media(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_media(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11655,7 +13042,7 @@ func (ec *executionContext) _VideoMetadata_width(ctx context.Context, field grap return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_width(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_width(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11699,7 +13086,7 @@ func (ec *executionContext) _VideoMetadata_height(ctx context.Context, field gra return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_height(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_height(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11743,7 +13130,7 @@ func (ec *executionContext) _VideoMetadata_duration(ctx context.Context, field g return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_duration(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_duration(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11784,7 +13171,7 @@ func (ec *executionContext) _VideoMetadata_codec(ctx context.Context, field grap return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_codec(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_codec(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11825,7 +13212,7 @@ func (ec *executionContext) _VideoMetadata_framerate(ctx context.Context, field return ec.marshalOFloat2ᚖfloat64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_framerate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_framerate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11866,7 +13253,7 @@ func (ec *executionContext) _VideoMetadata_bitrate(ctx context.Context, field gr return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_bitrate(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_bitrate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11907,7 +13294,7 @@ func (ec *executionContext) _VideoMetadata_colorProfile(ctx context.Context, fie return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_colorProfile(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_colorProfile(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11948,7 +13335,7 @@ func (ec *executionContext) _VideoMetadata_audio(ctx context.Context, field grap return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_VideoMetadata_audio(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_VideoMetadata_audio(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "VideoMetadata", Field: field, @@ -11992,7 +13379,7 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -12033,7 +13420,7 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -12077,7 +13464,7 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_locations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -12121,7 +13508,7 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -12175,7 +13562,7 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -12219,7 +13606,7 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -12260,7 +13647,7 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -12304,7 +13691,7 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -12345,7 +13732,7 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -12389,7 +13776,7 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -12430,7 +13817,7 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -12474,7 +13861,7 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -12528,7 +13915,7 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -12594,7 +13981,7 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -12635,7 +14022,7 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -12679,7 +14066,7 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -12720,7 +14107,7 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -12764,7 +14151,7 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -12827,7 +14214,7 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -12868,7 +14255,7 @@ func (ec *executionContext) ___Schema_description(ctx context.Context, field gra return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -12912,7 +14299,7 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_types(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -12978,7 +14365,7 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_queryType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -13041,7 +14428,7 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_mutationType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -13104,7 +14491,7 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -13170,7 +14557,7 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_directives(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -13226,7 +14613,7 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -13267,7 +14654,7 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -13308,7 +14695,7 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -13415,7 +14802,7 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_interfaces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -13478,7 +14865,7 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_possibleTypes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -13603,7 +14990,7 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_inputFields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -13654,7 +15041,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_ofType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -13717,7 +15104,7 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -13983,7 +15370,7 @@ func (ec *executionContext) _Album(ctx context.Context, sel ast.SelectionSet, ob case "thumbnail": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -14510,7 +15897,7 @@ func (ec *executionContext) _Media(ctx context.Context, sel ast.SelectionSet, ob case "thumbnail": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -14543,7 +15930,7 @@ func (ec *executionContext) _Media(ctx context.Context, sel ast.SelectionSet, ob case "highRes": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -14576,7 +15963,7 @@ func (ec *executionContext) _Media(ctx context.Context, sel ast.SelectionSet, ob case "videoWeb": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -14645,7 +16032,7 @@ func (ec *executionContext) _Media(ctx context.Context, sel ast.SelectionSet, ob case "exif": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15125,13 +16512,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } - case "favoriteMedia": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Mutation_favoriteMedia(ctx, field) - }) - if out.Values[i] == graphql.Null { - out.Invalids++ - } case "updateUser": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_updateUser(ctx, field) @@ -15238,6 +16618,13 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "favoriteMedia": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_favoriteMedia(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -15435,6 +16822,94 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "myTimeline": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_myTimeline(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "shareToken": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_shareToken(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "shareTokenValidatePassword": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_shareTokenValidatePassword(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "search": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_search(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "myAlbums": field := field @@ -15479,6 +16954,50 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "myFaceGroups": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_myFaceGroups(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "faceGroup": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_faceGroup(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "myMedia": field := field @@ -15545,28 +17064,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "myTimeline": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_myTimeline(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "myMediaGeoJson": field := field @@ -15593,7 +17090,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr case "mapboxToken": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15608,116 +17105,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "shareToken": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_shareToken(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "shareTokenValidatePassword": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_shareTokenValidatePassword(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "search": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_search(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "myFaceGroups": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_myFaceGroups(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "faceGroup": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_faceGroup(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -16717,12 +18104,12 @@ func (ec *executionContext) marshalNAlbum2ᚖgithubᚗcomᚋphotoviewᚋphotovie return ec._Album(ctx, sel, v) } -func (ec *executionContext) unmarshalNAny2interface(ctx context.Context, v interface{}) (interface{}, error) { +func (ec *executionContext) unmarshalNAny2interface(ctx context.Context, v interface{}) (any, error) { res, err := graphql.UnmarshalAny(v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNAny2interface(ctx context.Context, sel ast.SelectionSet, v interface{}) graphql.Marshaler { +func (ec *executionContext) marshalNAny2interface(ctx context.Context, sel ast.SelectionSet, v any) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") diff --git a/api/graphql/resolvers/album.go b/api/graphql/resolvers/album.generated.go similarity index 61% rename from api/graphql/resolvers/album.go rename to api/graphql/resolvers/album.generated.go index 789b4f21..25a293dd 100644 --- a/api/graphql/resolvers/album.go +++ b/api/graphql/resolvers/album.generated.go @@ -1,76 +1,27 @@ package resolvers +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.55 + import ( "context" + "errors" + "fmt" api "github.com/photoview/photoview/api/graphql" "github.com/photoview/photoview/api/graphql/auth" "github.com/photoview/photoview/api/graphql/models" "github.com/photoview/photoview/api/graphql/models/actions" - "github.com/pkg/errors" "gorm.io/gorm" ) -func (r *queryResolver) MyAlbums(ctx context.Context, order *models.Ordering, paginate *models.Pagination, onlyRoot *bool, - showEmpty *bool, onlyWithFavorites *bool) ([]*models.Album, error) { - - user := auth.UserFromContext(ctx) - if user == nil { - return nil, auth.ErrUnauthorized - } - - return actions.MyAlbums(r.DB(ctx), user, order, paginate, onlyRoot, showEmpty, onlyWithFavorites) -} - -func (r *queryResolver) Album(ctx context.Context, id int, tokenCredentials *models.ShareTokenCredentials) (*models.Album, error) { - - db := r.DB(ctx) - if tokenCredentials != nil { - - shareToken, err := r.ShareToken(ctx, *tokenCredentials) - if err != nil { - return nil, err - } - - if shareToken.Album != nil { - if *shareToken.AlbumID == id { - return shareToken.Album, nil - } - - subAlbum, err := shareToken.Album.GetChildren(db, func(query *gorm.DB) *gorm.DB { - return query.Where("sub_albums.id = ?", id) - }) - if err != nil { - return nil, errors.Wrapf(err, "find sub album of share token (%s)", tokenCredentials.Token) - } - - if len(subAlbum) > 0 { - return subAlbum[0], nil - } - } - } - - user := auth.UserFromContext(ctx) - if user == nil { - return nil, auth.ErrUnauthorized - } - - return actions.Album(db, user, id) -} - -func (r *Resolver) Album() api.AlbumResolver { - return &albumResolver{r} -} - -type albumResolver struct{ *Resolver } - -func (r *albumResolver) Media(ctx context.Context, album *models.Album, order *models.Ordering, - paginate *models.Pagination, onlyFavorites *bool) ([]*models.Media, error) { - +// Media is the resolver for the media field. +func (r *albumResolver) Media(ctx context.Context, obj *models.Album, order *models.Ordering, paginate *models.Pagination, onlyFavorites *bool) ([]*models.Media, error) { db := r.DB(ctx) query := db. - Where("media.album_id = ?", album.ID). + Where("media.album_id = ?", obj.ID). Where("media.id IN (?)", db.Model(&models.MediaURL{}). Select("media_urls.media_id"). Where("media_urls.media_id = media.id")) @@ -98,16 +49,11 @@ func (r *albumResolver) Media(ctx context.Context, album *models.Album, order *m return media, nil } -func (r *albumResolver) Thumbnail(ctx context.Context, album *models.Album) (*models.Media, error) { - return album.Thumbnail(r.DB(ctx)) -} - -func (r *albumResolver) SubAlbums(ctx context.Context, parent *models.Album, order *models.Ordering, - paginate *models.Pagination) ([]*models.Album, error) { - +// SubAlbums is the resolver for the subAlbums field. +func (r *albumResolver) SubAlbums(ctx context.Context, obj *models.Album, order *models.Ordering, paginate *models.Pagination) ([]*models.Album, error) { var albums []*models.Album - query := r.DB(ctx).Where("parent_album_id = ?", parent.ID) + query := r.DB(ctx).Where("parent_album_id = ?", obj.ID) query = models.FormatSQL(query, order, paginate) if err := query.Find(&albums).Error; err != nil { @@ -117,26 +63,18 @@ func (r *albumResolver) SubAlbums(ctx context.Context, parent *models.Album, ord return albums, nil } -func (r *albumResolver) ParentAlbum(ctx context.Context, obj *models.Album) (*models.Album, error) { - panic("not implemented") -} - +// Owner is the resolver for the owner field. func (r *albumResolver) Owner(ctx context.Context, obj *models.Album) (*models.User, error) { panic("not implemented") } -func (r *albumResolver) Shares(ctx context.Context, album *models.Album) ([]*models.ShareToken, error) { - - var shareTokens []*models.ShareToken - if err := r.DB(ctx).Where("album_id = ?", album.ID).Find(&shareTokens).Error; err != nil { - return nil, err - } - - return shareTokens, nil +// Thumbnail is the resolver for the thumbnail field. +func (r *albumResolver) Thumbnail(ctx context.Context, obj *models.Album) (*models.Media, error) { + return obj.Thumbnail(r.DB(ctx)) } +// Path is the resolver for the path field. func (r *albumResolver) Path(ctx context.Context, obj *models.Album) ([]*models.Album, error) { - user := auth.UserFromContext(ctx) if user == nil { empty := make([]*models.Album, 0) @@ -146,6 +84,16 @@ func (r *albumResolver) Path(ctx context.Context, obj *models.Album) ([]*models. return actions.AlbumPath(r.DB(ctx), user, obj) } +// Shares is the resolver for the shares field. +func (r *albumResolver) Shares(ctx context.Context, obj *models.Album) ([]*models.ShareToken, error) { + var shareTokens []*models.ShareToken + if err := r.DB(ctx).Where("album_id = ?", obj.ID).Find(&shareTokens).Error; err != nil { + return nil, err + } + + return shareTokens, nil +} + // Takes album_id, resets album.cover_id to 0 (null) func (r *mutationResolver) ResetAlbumCover(ctx context.Context, albumID int) (*models.Album, error) { user := auth.UserFromContext(ctx) @@ -156,11 +104,63 @@ func (r *mutationResolver) ResetAlbumCover(ctx context.Context, albumID int) (*m return actions.ResetAlbumCover(r.DB(ctx), user, albumID) } -func (r *mutationResolver) SetAlbumCover(ctx context.Context, mediaID int) (*models.Album, error) { +// SetAlbumCover is the resolver for the setAlbumCover field. +func (r *mutationResolver) SetAlbumCover(ctx context.Context, coverID int) (*models.Album, error) { user := auth.UserFromContext(ctx) if user == nil { return nil, errors.New("unauthorized") } - return actions.SetAlbumCover(r.DB(ctx), user, mediaID) + return actions.SetAlbumCover(r.DB(ctx), user, coverID) } + +// MyAlbums is the resolver for the myAlbums field. +func (r *queryResolver) MyAlbums(ctx context.Context, order *models.Ordering, paginate *models.Pagination, onlyRoot *bool, showEmpty *bool, onlyWithFavorites *bool) ([]*models.Album, error) { + user := auth.UserFromContext(ctx) + if user == nil { + return nil, auth.ErrUnauthorized + } + + return actions.MyAlbums(r.DB(ctx), user, order, paginate, onlyRoot, showEmpty, onlyWithFavorites) +} + +// Album is the resolver for the album field. +func (r *queryResolver) Album(ctx context.Context, id int, tokenCredentials *models.ShareTokenCredentials) (*models.Album, error) { + db := r.DB(ctx) + if tokenCredentials != nil { + + shareToken, err := r.ShareToken(ctx, *tokenCredentials) + if err != nil { + return nil, err + } + + if shareToken.Album != nil { + if *shareToken.AlbumID == id { + return shareToken.Album, nil + } + + subAlbum, err := shareToken.Album.GetChildren(db, func(query *gorm.DB) *gorm.DB { + return query.Where("sub_albums.id = ?", id) + }) + if err != nil { + return nil, fmt.Errorf("find sub album of share token (%s): %w", tokenCredentials.Token, err) + } + + if len(subAlbum) > 0 { + return subAlbum[0], nil + } + } + } + + user := auth.UserFromContext(ctx) + if user == nil { + return nil, auth.ErrUnauthorized + } + + return actions.Album(db, user, id) +} + +// Album returns api.AlbumResolver implementation. +func (r *Resolver) Album() api.AlbumResolver { return &albumResolver{r} } + +type albumResolver struct{ *Resolver } diff --git a/api/graphql/resolvers/album.graphql b/api/graphql/resolvers/album.graphql new file mode 100644 index 00000000..bb43c047 --- /dev/null +++ b/api/graphql/resolvers/album.graphql @@ -0,0 +1,60 @@ +type Album { + id: ID! + title: String! + + "The media inside this album" + media( + order: Ordering, + paginate: Pagination + "Return only the favorited media" + onlyFavorites: Boolean + ): [Media!]! + + "The albums contained in this album" + subAlbums( + order: Ordering, + paginate: Pagination + ): [Album!]! + + "The album which contains this album" + parentAlbum: Album + "The user who owns this album" + owner: User! + "The path on the filesystem of the server, where this album is located" + filePath: String! + "An image in this album used for previewing this album" + thumbnail: Media + "A breadcrumb list of all parent albums down to this one" + path: [Album!]! + + "A list of share tokens pointing to this album, owned by the logged in user" + shares: [ShareToken!]! +} + +extend type Query { + "List of albums owned by the logged in user." + myAlbums( + order: Ordering, + paginate: Pagination + "Return only albums from the root directory of the user" + onlyRoot: Boolean + "Return also albums with no media directly in them" + showEmpty: Boolean + "Show only albums having favorites" + onlyWithFavorites: Boolean + ): [Album!]! @isAuthorized + + """ + Get album by id, user must own the album or be admin + If valid tokenCredentials are provided, the album may be retrived without further authentication + """ + album(id: ID!, tokenCredentials: ShareTokenCredentials): Album! +} + +extend type Mutation { + "Reset the assigned cover photo for an album" + resetAlbumCover(albumID: ID!): Album! @isAuthorized + + "Assign a cover photo to an album" + setAlbumCover(coverID: ID!): Album! @isAuthorized +} diff --git a/api/graphql/resolvers/faces.generated.go b/api/graphql/resolvers/faces.generated.go new file mode 100644 index 00000000..238c0979 --- /dev/null +++ b/api/graphql/resolvers/faces.generated.go @@ -0,0 +1,410 @@ +package resolvers + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.55 + +import ( + "context" + "errors" + + api "github.com/photoview/photoview/api/graphql" + "github.com/photoview/photoview/api/graphql/auth" + "github.com/photoview/photoview/api/graphql/models" + "github.com/photoview/photoview/api/scanner/face_detection" + "gorm.io/gorm" +) + +// ImageFaces is the resolver for the imageFaces field. +func (r *faceGroupResolver) ImageFaces(ctx context.Context, obj *models.FaceGroup, paginate *models.Pagination) ([]*models.ImageFace, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return nil, errors.New("unauthorized") + } + + if face_detection.GlobalFaceDetector == nil { + return nil, ErrFaceDetectorNotInitialized + } + + if err := user.FillAlbums(db); err != nil { + return nil, err + } + + userAlbumIDs := make([]int, len(user.Albums)) + for i, album := range user.Albums { + userAlbumIDs[i] = album.ID + } + + query := db. + Joins("Media"). + Where(faceGroupIDIsQuestion, obj.ID). + Where("album_id IN (?)", userAlbumIDs) + + query = models.FormatSQL(query, nil, paginate) + + var imageFaces []*models.ImageFace + if err := query.Find(&imageFaces).Error; err != nil { + return nil, err + } + + return imageFaces, nil +} + +// ImageFaceCount is the resolver for the imageFaceCount field. +func (r *faceGroupResolver) ImageFaceCount(ctx context.Context, obj *models.FaceGroup) (int, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return -1, errors.New("unauthorized") + } + + if face_detection.GlobalFaceDetector == nil { + return -1, ErrFaceDetectorNotInitialized + } + + if err := user.FillAlbums(db); err != nil { + return -1, err + } + + userAlbumIDs := make([]int, len(user.Albums)) + for i, album := range user.Albums { + userAlbumIDs[i] = album.ID + } + + query := db. + Model(&models.ImageFace{}). + Joins("Media"). + Where(faceGroupIDIsQuestion, obj.ID). + Where("album_id IN (?)", userAlbumIDs) + + var count int64 + if err := query.Count(&count).Error; err != nil { + return -1, err + } + + return int(count), nil +} + +// Media is the resolver for the media field. +func (r *imageFaceResolver) Media(ctx context.Context, obj *models.ImageFace) (*models.Media, error) { + if err := obj.FillMedia(r.DB(ctx)); err != nil { + return nil, err + } + + return &obj.Media, nil +} + +// FaceGroup is the resolver for the faceGroup field. +func (r *imageFaceResolver) FaceGroup(ctx context.Context, obj *models.ImageFace) (*models.FaceGroup, error) { + if obj.FaceGroup != nil { + return obj.FaceGroup, nil + } + + if face_detection.GlobalFaceDetector == nil { + return nil, ErrFaceDetectorNotInitialized + } + + var faceGroup models.FaceGroup + if err := r.DB(ctx).Model(&obj).Association("FaceGroup").Find(&faceGroup); err != nil { + return nil, err + } + + obj.FaceGroup = &faceGroup + + return &faceGroup, nil +} + +// SetFaceGroupLabel is the resolver for the setFaceGroupLabel field. +func (r *mutationResolver) SetFaceGroupLabel(ctx context.Context, faceGroupID int, label *string) (*models.FaceGroup, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return nil, errors.New("unauthorized") + } + + if face_detection.GlobalFaceDetector == nil { + return nil, ErrFaceDetectorNotInitialized + } + + faceGroup, err := userOwnedFaceGroup(db, user, faceGroupID) + if err != nil { + return nil, err + } + + if err := db.Model(faceGroup).Update("label", label).Error; err != nil { + return nil, err + } + + return faceGroup, nil +} + +// CombineFaceGroups is the resolver for the combineFaceGroups field. +func (r *mutationResolver) CombineFaceGroups(ctx context.Context, destinationFaceGroupID int, sourceFaceGroupID int) (*models.FaceGroup, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return nil, errors.New("unauthorized") + } + + if face_detection.GlobalFaceDetector == nil { + return nil, ErrFaceDetectorNotInitialized + } + + destinationFaceGroup, err := userOwnedFaceGroup(db, user, destinationFaceGroupID) + if err != nil { + return nil, err + } + + sourceFaceGroup, err := userOwnedFaceGroup(db, user, sourceFaceGroupID) + if err != nil { + return nil, err + } + + updateError := db.Transaction(func(tx *gorm.DB) error { + if err := tx.Model(&models.ImageFace{}). + Where(faceGroupIDIsQuestion, sourceFaceGroup.ID). + Update("face_group_id", destinationFaceGroup.ID).Error; err != nil { + return err + } + + if err := tx.Delete(&sourceFaceGroup).Error; err != nil { + return err + } + + return nil + }) + + if updateError != nil { + return nil, updateError + } + + face_detection.GlobalFaceDetector.MergeCategories(int32(sourceFaceGroupID), int32(destinationFaceGroupID)) + + return destinationFaceGroup, nil +} + +// MoveImageFaces is the resolver for the moveImageFaces field. +func (r *mutationResolver) MoveImageFaces(ctx context.Context, imageFaceIDs []int, destinationFaceGroupID int) (*models.FaceGroup, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return nil, errors.New("unauthorized") + } + + if face_detection.GlobalFaceDetector == nil { + return nil, ErrFaceDetectorNotInitialized + } + + userOwnedImageFaceIDs := make([]int, 0) + var destFaceGroup *models.FaceGroup + + transErr := db.Transaction(func(tx *gorm.DB) error { + + var err error + destFaceGroup, err = userOwnedFaceGroup(tx, user, destinationFaceGroupID) + if err != nil { + return err + } + + userOwnedImageFaces, err := getUserOwnedImageFaces(tx, user, imageFaceIDs) + if err != nil { + return err + } + + for _, imageFace := range userOwnedImageFaces { + userOwnedImageFaceIDs = append(userOwnedImageFaceIDs, imageFace.ID) + } + + var sourceFaceGroups []*models.FaceGroup + if err := tx. + Joins("LEFT JOIN image_faces ON image_faces.face_group_id = face_groups.id"). + Where(imageFacesIDInQuestion, userOwnedImageFaceIDs). + Find(&sourceFaceGroups).Error; err != nil { + return err + } + + if err := tx. + Model(&models.ImageFace{}). + Where("id IN (?)", userOwnedImageFaceIDs). + Update("face_group_id", destFaceGroup.ID).Error; err != nil { + return err + } + + // delete face groups if they have become empty + if err := deleteEmptyFaceGroups(sourceFaceGroups, tx); err != nil { + return err + } + + return nil + }) + + if transErr != nil { + return nil, transErr + } + + face_detection.GlobalFaceDetector.MergeImageFaces(userOwnedImageFaceIDs, int32(destFaceGroup.ID)) + + return destFaceGroup, nil +} + +// RecognizeUnlabeledFaces is the resolver for the recognizeUnlabeledFaces field. +func (r *mutationResolver) RecognizeUnlabeledFaces(ctx context.Context) ([]*models.ImageFace, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return nil, errors.New("unauthorized") + } + + if face_detection.GlobalFaceDetector == nil { + return nil, ErrFaceDetectorNotInitialized + } + + var updatedImageFaces []*models.ImageFace + + transactionError := db.Transaction(func(tx *gorm.DB) error { + var err error + updatedImageFaces, err = face_detection.GlobalFaceDetector.RecognizeUnlabeledFaces(tx, user) + + return err + }) + + if transactionError != nil { + return nil, transactionError + } + + return updatedImageFaces, nil +} + +// DetachImageFaces is the resolver for the detachImageFaces field. +func (r *mutationResolver) DetachImageFaces(ctx context.Context, imageFaceIDs []int) (*models.FaceGroup, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return nil, errors.New("unauthorized") + } + + if face_detection.GlobalFaceDetector == nil { + return nil, ErrFaceDetectorNotInitialized + } + + userOwnedImageFaceIDs := make([]int, 0) + newFaceGroup := models.FaceGroup{} + + transactionError := db.Transaction(func(tx *gorm.DB) error { + + userOwnedImageFaces, err := getUserOwnedImageFaces(tx, user, imageFaceIDs) + if err != nil { + return err + } + + for _, imageFace := range userOwnedImageFaces { + userOwnedImageFaceIDs = append(userOwnedImageFaceIDs, imageFace.ID) + } + + if err := tx.Save(&newFaceGroup).Error; err != nil { + return err + } + + if err := tx. + Model(&models.ImageFace{}). + Where("id IN (?)", userOwnedImageFaceIDs). + Update("face_group_id", newFaceGroup.ID).Error; err != nil { + return err + } + + return nil + }) + + if transactionError != nil { + return nil, transactionError + } + + face_detection.GlobalFaceDetector.MergeImageFaces(userOwnedImageFaceIDs, int32(newFaceGroup.ID)) + + return &newFaceGroup, nil +} + +// MyFaceGroups is the resolver for the myFaceGroups field. +func (r *queryResolver) MyFaceGroups(ctx context.Context, paginate *models.Pagination) ([]*models.FaceGroup, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return nil, errors.New("unauthorized") + } + + if face_detection.GlobalFaceDetector == nil { + return nil, ErrFaceDetectorNotInitialized + } + + if err := user.FillAlbums(db); err != nil { + return nil, err + } + + userAlbumIDs := make([]int, len(user.Albums)) + for i, album := range user.Albums { + userAlbumIDs[i] = album.ID + } + + faceGroupQuery := db. + Joins("JOIN image_faces ON image_faces.face_group_id = face_groups.id"). + Where("image_faces.media_id IN (?)", + db.Select("media.id").Table("media").Where(mediaAlbumIDInQuestion, userAlbumIDs)). + Group("image_faces.face_group_id"). + Group("face_groups.id"). + Order("CASE WHEN label IS NULL THEN 1 ELSE 0 END"). + Order("COUNT(image_faces.id) DESC") + + faceGroupQuery = models.FormatSQL(faceGroupQuery, nil, paginate) + + var faceGroups []*models.FaceGroup + if err := faceGroupQuery.Find(&faceGroups).Error; err != nil { + return nil, err + } + + return faceGroups, nil +} + +// FaceGroup is the resolver for the faceGroup field. +func (r *queryResolver) FaceGroup(ctx context.Context, id int) (*models.FaceGroup, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return nil, errors.New("unauthorized") + } + + if face_detection.GlobalFaceDetector == nil { + return nil, ErrFaceDetectorNotInitialized + } + + if err := user.FillAlbums(db); err != nil { + return nil, err + } + + userAlbumIDs := make([]int, len(user.Albums)) + for i, album := range user.Albums { + userAlbumIDs[i] = album.ID + } + + faceGroupQuery := db. + Joins("LEFT JOIN image_faces ON image_faces.face_group_id = face_groups.id"). + Joins("LEFT JOIN media ON image_faces.media_id = media.id"). + Where("face_groups.id = ?", id). + Where(mediaAlbumIDInQuestion, userAlbumIDs) + + var faceGroup models.FaceGroup + if err := faceGroupQuery.Find(&faceGroup).Error; err != nil { + return nil, err + } + + return &faceGroup, nil +} + +// FaceGroup returns api.FaceGroupResolver implementation. +func (r *Resolver) FaceGroup() api.FaceGroupResolver { return &faceGroupResolver{r} } + +// ImageFace returns api.ImageFaceResolver implementation. +func (r *Resolver) ImageFace() api.ImageFaceResolver { return &imageFaceResolver{r} } + +type faceGroupResolver struct{ *Resolver } +type imageFaceResolver struct{ *Resolver } diff --git a/api/graphql/resolvers/faces.go b/api/graphql/resolvers/faces.go index d8d254c2..77af6206 100644 --- a/api/graphql/resolvers/faces.go +++ b/api/graphql/resolvers/faces.go @@ -1,432 +1,19 @@ package resolvers import ( - "context" + "errors" + "fmt" - api "github.com/photoview/photoview/api/graphql" - "github.com/photoview/photoview/api/graphql/auth" "github.com/photoview/photoview/api/graphql/models" - "github.com/photoview/photoview/api/scanner/face_detection" - "github.com/pkg/errors" "gorm.io/gorm" ) -const faceGroupIDisQuestion = "face_group_id = ?" -const mediaAlbumIDinQuestion = "media.album_id IN (?)" -const imageFacesIDinQuestion = "image_faces.id IN (?)" +const faceGroupIDIsQuestion = "face_group_id = ?" +const mediaAlbumIDInQuestion = "media.album_id IN (?)" +const imageFacesIDInQuestion = "image_faces.id IN (?)" var ErrFaceDetectorNotInitialized = errors.New("face detector not initialized") -type imageFaceResolver struct { - *Resolver -} - -type faceGroupResolver struct { - *Resolver -} - -func (r *Resolver) ImageFace() api.ImageFaceResolver { - return imageFaceResolver{r} -} - -func (r *Resolver) FaceGroup() api.FaceGroupResolver { - return faceGroupResolver{r} -} - -func (r imageFaceResolver) FaceGroup(ctx context.Context, obj *models.ImageFace) (*models.FaceGroup, error) { - if obj.FaceGroup != nil { - return obj.FaceGroup, nil - } - - if face_detection.GlobalFaceDetector == nil { - return nil, ErrFaceDetectorNotInitialized - } - - var faceGroup models.FaceGroup - if err := r.DB(ctx).Model(&obj).Association("FaceGroup").Find(&faceGroup); err != nil { - return nil, err - } - - obj.FaceGroup = &faceGroup - - return &faceGroup, nil -} - -func (r imageFaceResolver) Media(ctx context.Context, obj *models.ImageFace) (*models.Media, error) { - if err := obj.FillMedia(r.DB(ctx)); err != nil { - return nil, err - } - - return &obj.Media, nil -} - -func (r faceGroupResolver) ImageFaces(ctx context.Context, obj *models.FaceGroup, - paginate *models.Pagination) ([]*models.ImageFace, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return nil, errors.New("unauthorized") - } - - if face_detection.GlobalFaceDetector == nil { - return nil, ErrFaceDetectorNotInitialized - } - - if err := user.FillAlbums(db); err != nil { - return nil, err - } - - userAlbumIDs := make([]int, len(user.Albums)) - for i, album := range user.Albums { - userAlbumIDs[i] = album.ID - } - - query := db. - Joins("Media"). - Where(faceGroupIDisQuestion, obj.ID). - Where("album_id IN (?)", userAlbumIDs) - - query = models.FormatSQL(query, nil, paginate) - - var imageFaces []*models.ImageFace - if err := query.Find(&imageFaces).Error; err != nil { - return nil, err - } - - return imageFaces, nil -} - -func (r faceGroupResolver) ImageFaceCount(ctx context.Context, obj *models.FaceGroup) (int, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return -1, errors.New("unauthorized") - } - - if face_detection.GlobalFaceDetector == nil { - return -1, ErrFaceDetectorNotInitialized - } - - if err := user.FillAlbums(db); err != nil { - return -1, err - } - - userAlbumIDs := make([]int, len(user.Albums)) - for i, album := range user.Albums { - userAlbumIDs[i] = album.ID - } - - query := db. - Model(&models.ImageFace{}). - Joins("Media"). - Where(faceGroupIDisQuestion, obj.ID). - Where("album_id IN (?)", userAlbumIDs) - - var count int64 - if err := query.Count(&count).Error; err != nil { - return -1, err - } - - return int(count), nil -} - -func (r *queryResolver) FaceGroup(ctx context.Context, id int) (*models.FaceGroup, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return nil, errors.New("unauthorized") - } - - if face_detection.GlobalFaceDetector == nil { - return nil, ErrFaceDetectorNotInitialized - } - - if err := user.FillAlbums(db); err != nil { - return nil, err - } - - userAlbumIDs := make([]int, len(user.Albums)) - for i, album := range user.Albums { - userAlbumIDs[i] = album.ID - } - - faceGroupQuery := db. - Joins("LEFT JOIN image_faces ON image_faces.face_group_id = face_groups.id"). - Joins("LEFT JOIN media ON image_faces.media_id = media.id"). - Where("face_groups.id = ?", id). - Where(mediaAlbumIDinQuestion, userAlbumIDs) - - var faceGroup models.FaceGroup - if err := faceGroupQuery.Find(&faceGroup).Error; err != nil { - return nil, err - } - - return &faceGroup, nil -} - -func (r *queryResolver) MyFaceGroups(ctx context.Context, paginate *models.Pagination) ([]*models.FaceGroup, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return nil, errors.New("unauthorized") - } - - if face_detection.GlobalFaceDetector == nil { - return nil, ErrFaceDetectorNotInitialized - } - - if err := user.FillAlbums(db); err != nil { - return nil, err - } - - userAlbumIDs := make([]int, len(user.Albums)) - for i, album := range user.Albums { - userAlbumIDs[i] = album.ID - } - - faceGroupQuery := db. - Joins("JOIN image_faces ON image_faces.face_group_id = face_groups.id"). - Where("image_faces.media_id IN (?)", - db.Select("media.id").Table("media").Where(mediaAlbumIDinQuestion, userAlbumIDs)). - Group("image_faces.face_group_id"). - Group("face_groups.id"). - Order("CASE WHEN label IS NULL THEN 1 ELSE 0 END"). - Order("COUNT(image_faces.id) DESC") - - faceGroupQuery = models.FormatSQL(faceGroupQuery, nil, paginate) - - var faceGroups []*models.FaceGroup - if err := faceGroupQuery.Find(&faceGroups).Error; err != nil { - return nil, err - } - - return faceGroups, nil -} - -func (r *mutationResolver) SetFaceGroupLabel(ctx context.Context, faceGroupID int, - label *string) (*models.FaceGroup, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return nil, errors.New("unauthorized") - } - - if face_detection.GlobalFaceDetector == nil { - return nil, ErrFaceDetectorNotInitialized - } - - faceGroup, err := userOwnedFaceGroup(db, user, faceGroupID) - if err != nil { - return nil, err - } - - if err := db.Model(faceGroup).Update("label", label).Error; err != nil { - return nil, err - } - - return faceGroup, nil -} - -func (r *mutationResolver) CombineFaceGroups(ctx context.Context, destinationFaceGroupID int, - sourceFaceGroupID int) (*models.FaceGroup, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return nil, errors.New("unauthorized") - } - - if face_detection.GlobalFaceDetector == nil { - return nil, ErrFaceDetectorNotInitialized - } - - destinationFaceGroup, err := userOwnedFaceGroup(db, user, destinationFaceGroupID) - if err != nil { - return nil, err - } - - sourceFaceGroup, err := userOwnedFaceGroup(db, user, sourceFaceGroupID) - if err != nil { - return nil, err - } - - updateError := db.Transaction(func(tx *gorm.DB) error { - if err := tx.Model(&models.ImageFace{}). - Where(faceGroupIDisQuestion, sourceFaceGroup.ID). - Update("face_group_id", destinationFaceGroup.ID).Error; err != nil { - return err - } - - if err := tx.Delete(&sourceFaceGroup).Error; err != nil { - return err - } - - return nil - }) - - if updateError != nil { - return nil, updateError - } - - face_detection.GlobalFaceDetector.MergeCategories(int32(sourceFaceGroupID), int32(destinationFaceGroupID)) - - return destinationFaceGroup, nil -} - -func (r *mutationResolver) MoveImageFaces(ctx context.Context, imageFaceIDs []int, - destinationFaceGroupID int) (*models.FaceGroup, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return nil, errors.New("unauthorized") - } - - if face_detection.GlobalFaceDetector == nil { - return nil, ErrFaceDetectorNotInitialized - } - - userOwnedImageFaceIDs := make([]int, 0) - var destFaceGroup *models.FaceGroup - - transErr := db.Transaction(func(tx *gorm.DB) error { - - var err error - destFaceGroup, err = userOwnedFaceGroup(tx, user, destinationFaceGroupID) - if err != nil { - return err - } - - userOwnedImageFaces, err := getUserOwnedImageFaces(tx, user, imageFaceIDs) - if err != nil { - return err - } - - for _, imageFace := range userOwnedImageFaces { - userOwnedImageFaceIDs = append(userOwnedImageFaceIDs, imageFace.ID) - } - - var sourceFaceGroups []*models.FaceGroup - if err := tx. - Joins("LEFT JOIN image_faces ON image_faces.face_group_id = face_groups.id"). - Where(imageFacesIDinQuestion, userOwnedImageFaceIDs). - Find(&sourceFaceGroups).Error; err != nil { - return err - } - - if err := tx. - Model(&models.ImageFace{}). - Where("id IN (?)", userOwnedImageFaceIDs). - Update("face_group_id", destFaceGroup.ID).Error; err != nil { - return err - } - - // delete face groups if they have become empty - if err := deleteEmptyFaceGroups(sourceFaceGroups, tx); err != nil { - return err - } - - return nil - }) - - if transErr != nil { - return nil, transErr - } - - face_detection.GlobalFaceDetector.MergeImageFaces(userOwnedImageFaceIDs, int32(destFaceGroup.ID)) - - return destFaceGroup, nil -} - -func deleteEmptyFaceGroups(sourceFaceGroups []*models.FaceGroup, tx *gorm.DB) error { - for _, faceGroup := range sourceFaceGroups { - var count int64 - if err := tx.Model(&models.ImageFace{}).Where(faceGroupIDisQuestion, faceGroup.ID).Count(&count).Error; err != nil { - return err - } - - if count == 0 { - if err := tx.Delete(&faceGroup).Error; err != nil { - return err - } - } - } - return nil -} - -func (r *mutationResolver) RecognizeUnlabeledFaces(ctx context.Context) ([]*models.ImageFace, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return nil, errors.New("unauthorized") - } - - if face_detection.GlobalFaceDetector == nil { - return nil, ErrFaceDetectorNotInitialized - } - - var updatedImageFaces []*models.ImageFace - - transactionError := db.Transaction(func(tx *gorm.DB) error { - var err error - updatedImageFaces, err = face_detection.GlobalFaceDetector.RecognizeUnlabeledFaces(tx, user) - - return err - }) - - if transactionError != nil { - return nil, transactionError - } - - return updatedImageFaces, nil -} - -func (r *mutationResolver) DetachImageFaces(ctx context.Context, imageFaceIDs []int) (*models.FaceGroup, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return nil, errors.New("unauthorized") - } - - if face_detection.GlobalFaceDetector == nil { - return nil, ErrFaceDetectorNotInitialized - } - - userOwnedImageFaceIDs := make([]int, 0) - newFaceGroup := models.FaceGroup{} - - transactionError := db.Transaction(func(tx *gorm.DB) error { - - userOwnedImageFaces, err := getUserOwnedImageFaces(tx, user, imageFaceIDs) - if err != nil { - return err - } - - for _, imageFace := range userOwnedImageFaces { - userOwnedImageFaceIDs = append(userOwnedImageFaceIDs, imageFace.ID) - } - - if err := tx.Save(&newFaceGroup).Error; err != nil { - return err - } - - if err := tx. - Model(&models.ImageFace{}). - Where("id IN (?)", userOwnedImageFaceIDs). - Update("face_group_id", newFaceGroup.ID).Error; err != nil { - return err - } - - return nil - }) - - if transactionError != nil { - return nil, transactionError - } - - face_detection.GlobalFaceDetector.MergeImageFaces(userOwnedImageFaceIDs, int32(newFaceGroup.ID)) - - return &newFaceGroup, nil -} - func userOwnedFaceGroup(db *gorm.DB, user *models.User, faceGroupID int) (*models.FaceGroup, error) { if user.Admin { var faceGroup models.FaceGroup @@ -451,18 +38,18 @@ func userOwnedFaceGroup(db *gorm.DB, user *models.User, faceGroupID int) (*model Select("image_faces.id"). Table("image_faces"). Joins("JOIN media ON media.id = image_faces.media_id"). - Where(mediaAlbumIDinQuestion, userAlbumIDs) + Where(mediaAlbumIDInQuestion, userAlbumIDs) faceGroupQuery := db. Model(&models.FaceGroup{}). Joins("JOIN image_faces ON face_groups.id = image_faces.face_group_id"). Where("face_groups.id = ?", faceGroupID). - Where(imageFacesIDinQuestion, imageFaceQuery) + Where(imageFacesIDInQuestion, imageFaceQuery) var faceGroup models.FaceGroup if err := faceGroupQuery.Find(&faceGroup).Error; err != nil { if err == gorm.ErrRecordNotFound { - return nil, errors.Wrap(err, "face group does not exist or is not owned by the user") + return nil, fmt.Errorf("face group does not exist or is not owned by the user: %w", err) } return nil, err } @@ -483,11 +70,27 @@ func getUserOwnedImageFaces(tx *gorm.DB, user *models.User, imageFaceIDs []int) var userOwnedImageFaces []*models.ImageFace if err := tx. Joins("JOIN media ON media.id = image_faces.media_id"). - Where(mediaAlbumIDinQuestion, userAlbumIDs). - Where(imageFacesIDinQuestion, imageFaceIDs). + Where(mediaAlbumIDInQuestion, userAlbumIDs). + Where(imageFacesIDInQuestion, imageFaceIDs). Find(&userOwnedImageFaces).Error; err != nil { return nil, err } return userOwnedImageFaces, nil } + +func deleteEmptyFaceGroups(sourceFaceGroups []*models.FaceGroup, tx *gorm.DB) error { + for _, faceGroup := range sourceFaceGroups { + var count int64 + if err := tx.Model(&models.ImageFace{}).Where(faceGroupIDIsQuestion, faceGroup.ID).Count(&count).Error; err != nil { + return err + } + + if count == 0 { + if err := tx.Delete(&faceGroup).Error; err != nil { + return err + } + } + } + return nil +} diff --git a/api/graphql/resolvers/faces.graphql b/api/graphql/resolvers/faces.graphql new file mode 100644 index 00000000..c78cbe4f --- /dev/null +++ b/api/graphql/resolvers/faces.graphql @@ -0,0 +1,53 @@ +"A bounding box of where a face is present on an image. The values map from 0 to 1 as a fraction of the image width/height" +type FaceRectangle { + minX: Float! + maxX: Float! + minY: Float! + maxY: Float! +} + +"A collection of faces of a particular person" +type FaceGroup { + id: ID! + "The name of the person" + label: String + imageFaces(paginate: Pagination): [ImageFace!]! + "The total number of images in this collection" + imageFaceCount: Int! +} + +"A single face on a particular image" +type ImageFace { + id: ID! + "A reference to the image the face appears on" + media: Media! + "A bounding box of where on the image the face is present" + rectangle: FaceRectangle! + "The `FaceGroup` that contains this `ImageFace`" + faceGroup: FaceGroup! +} + +extend type Query { + "Get a list of `FaceGroup`s for the logged in user" + myFaceGroups(paginate: Pagination): [FaceGroup!]! @isAuthorized + + "Get a particular `FaceGroup` specified by its ID" + faceGroup(id: ID!): FaceGroup! @isAuthorized +} + +extend type Mutation { + "Assign a label to a face group, set label to null to remove the current one" + setFaceGroupLabel(faceGroupID: ID!, label: String): FaceGroup! @isAuthorized + + "Merge two face groups into a single one, all ImageFaces from source will be moved to destination" + combineFaceGroups(destinationFaceGroupID: ID!, sourceFaceGroupID: ID!): FaceGroup! @isAuthorized + + "Move a list of ImageFaces to another face group" + moveImageFaces(imageFaceIDs: [ID!]!, destinationFaceGroupID: ID!): FaceGroup! @isAuthorized + + "Check all unlabeled faces to see if they match a labeled FaceGroup, and move them if they match" + recognizeUnlabeledFaces: [ImageFace!]! @isAuthorized + + "Move a list of ImageFaces to a new face group" + detachImageFaces(imageFaceIDs: [ID!]!): FaceGroup! @isAuthorized +} diff --git a/api/graphql/resolvers/media.go b/api/graphql/resolvers/media.generated.go similarity index 55% rename from api/graphql/resolvers/media.go rename to api/graphql/resolvers/media.generated.go index d874639d..7d88200f 100644 --- a/api/graphql/resolvers/media.go +++ b/api/graphql/resolvers/media.generated.go @@ -1,7 +1,13 @@ package resolvers +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.55 + import ( "context" + "errors" + "fmt" "strings" "github.com/photoview/photoview/api/dataloader" @@ -10,94 +16,32 @@ import ( "github.com/photoview/photoview/api/graphql/models" "github.com/photoview/photoview/api/graphql/models/actions" "github.com/photoview/photoview/api/scanner/face_detection" - "github.com/pkg/errors" ) -func (r *queryResolver) MyMedia(ctx context.Context, order *models.Ordering, paginate *models.Pagination) ([]*models.Media, error) { - - user := auth.UserFromContext(ctx) - if user == nil { - return nil, errors.New("unauthorized") - } - - return actions.MyMedia(r.DB(ctx), user, order, paginate) +// Thumbnail is the resolver for the thumbnail field. +func (r *mediaResolver) Thumbnail(ctx context.Context, obj *models.Media) (*models.MediaURL, error) { + return dataloader.For(ctx).MediaThumbnail.Load(obj.ID) } -func (r *queryResolver) Media(ctx context.Context, id int, tokenCredentials *models.ShareTokenCredentials) (*models.Media, error) { - - db := r.DB(ctx) - if tokenCredentials != nil { - - shareToken, err := r.ShareToken(ctx, *tokenCredentials) - if err != nil { - return nil, err - } - - if *shareToken.MediaID == id { - return shareToken.Media, nil - } +// HighRes is the resolver for the highRes field. +func (r *mediaResolver) HighRes(ctx context.Context, obj *models.Media) (*models.MediaURL, error) { + if obj.Type != models.MediaTypePhoto { + return nil, nil } - user := auth.UserFromContext(ctx) - if user == nil { - return nil, auth.ErrUnauthorized - } - - var media models.Media - - err := db. - Joins("Album"). - Where("media.id = ?", id). - Where("EXISTS (SELECT * FROM user_albums WHERE user_albums.album_id = media.album_id AND user_albums.user_id = ?)", - user.ID). - Where("media.id IN (?)", db.Model(&models.MediaURL{}).Select("media_id").Where("media_urls.media_id = media.id")). - First(&media).Error - - if err != nil { - return nil, errors.Wrap(err, "could not get media by media_id and user_id from database") - } - - return &media, nil + return dataloader.For(ctx).MediaHighres.Load(obj.ID) } -func (r *queryResolver) MediaList(ctx context.Context, ids []int) ([]*models.Media, error) { - db := r.DB(ctx) - user := auth.UserFromContext(ctx) - if user == nil { - return nil, auth.ErrUnauthorized +// VideoWeb is the resolver for the videoWeb field. +func (r *mediaResolver) VideoWeb(ctx context.Context, obj *models.Media) (*models.MediaURL, error) { + if obj.Type != models.MediaTypeVideo { + return nil, nil } - if len(ids) == 0 { - return nil, errors.New("no ids provided") - } - - var media []*models.Media - err := db.Model(&media). - Joins("LEFT JOIN user_albums ON user_albums.album_id = media.album_id"). - Where("media.id IN ?", ids). - Where("user_albums.user_id = ?", user.ID). - Find(&media).Error - - if err != nil { - return nil, errors.Wrap(err, "could not get media list by media_id and user_id from database") - } - - return media, nil -} - -type mediaResolver struct { - *Resolver -} - -func (r *Resolver) Media() api.MediaResolver { - return &mediaResolver{r} -} - -func (r *mediaResolver) Type(ctx context.Context, media *models.Media) (models.MediaType, error) { - formattedType := models.MediaType(strings.Title(string(media.Type))) - return formattedType, nil + return dataloader.For(ctx).MediaVideoWeb.Load(obj.ID) } +// Album is the resolver for the album field. func (r *mediaResolver) Album(ctx context.Context, obj *models.Media) (*models.Album, error) { var album models.Album err := r.DB(ctx).Find(&album, obj.AlbumID).Error @@ -107,20 +51,54 @@ func (r *mediaResolver) Album(ctx context.Context, obj *models.Media) (*models.A return &album, nil } -func (r *mediaResolver) Shares(ctx context.Context, media *models.Media) ([]*models.ShareToken, error) { +// Exif is the resolver for the exif field. +func (r *mediaResolver) Exif(ctx context.Context, obj *models.Media) (*models.MediaEXIF, error) { + if obj.Exif != nil { + return obj.Exif, nil + } + + var exif models.MediaEXIF + if err := r.DB(ctx).Model(obj).Association("Exif").Find(&exif); err != nil { + return nil, err + } + + return &exif, nil +} + +// Favorite is the resolver for the favorite field. +func (r *mediaResolver) Favorite(ctx context.Context, obj *models.Media) (bool, error) { + user := auth.UserFromContext(ctx) + if user == nil { + return false, auth.ErrUnauthorized + } + + return dataloader.For(ctx).UserMediaFavorite.Load(&models.UserMediaData{ + UserID: user.ID, + MediaID: obj.ID, + }) +} + +// Type is the resolver for the type field. +func (r *mediaResolver) Type(ctx context.Context, obj *models.Media) (models.MediaType, error) { + formattedType := models.MediaType(strings.Title(string(obj.Type))) + return formattedType, nil +} + +// Shares is the resolver for the shares field. +func (r *mediaResolver) Shares(ctx context.Context, obj *models.Media) ([]*models.ShareToken, error) { var shareTokens []*models.ShareToken - if err := r.DB(ctx).Where("media_id = ?", media.ID).Find(&shareTokens).Error; err != nil { - return nil, errors.Wrapf(err, "get shares for media (%s)", media.Path) + if err := r.DB(ctx).Where("media_id = ?", obj.ID).Find(&shareTokens).Error; err != nil { + return nil, fmt.Errorf("get shares for media (%s): %w", obj.Path, err) } return shareTokens, nil } -func (r *mediaResolver) Downloads(ctx context.Context, media *models.Media) ([]*models.MediaDownload, error) { - +// Downloads is the resolver for the downloads field. +func (r *mediaResolver) Downloads(ctx context.Context, obj *models.Media) ([]*models.MediaDownload, error) { var mediaUrls []*models.MediaURL - if err := r.DB(ctx).Where("media_id = ?", media.ID).Find(&mediaUrls).Error; err != nil { - return nil, errors.Wrapf(err, "get downloads for media (%s)", media.Path) + if err := r.DB(ctx).Where("media_id = ?", obj.ID).Find(&mediaUrls).Error; err != nil { + return nil, fmt.Errorf("get downloads for media (%s): %w", obj.Path, err) } downloads := make([]*models.MediaDownload, 0) @@ -150,53 +128,26 @@ func (r *mediaResolver) Downloads(ctx context.Context, media *models.Media) ([]* return downloads, nil } -func (r *mediaResolver) HighRes(ctx context.Context, media *models.Media) (*models.MediaURL, error) { - if media.Type != models.MediaTypePhoto { - return nil, nil +// Faces is the resolver for the faces field. +func (r *mediaResolver) Faces(ctx context.Context, obj *models.Media) ([]*models.ImageFace, error) { + if face_detection.GlobalFaceDetector == nil { + return []*models.ImageFace{}, nil } - return dataloader.For(ctx).MediaHighres.Load(media.ID) -} - -func (r *mediaResolver) Thumbnail(ctx context.Context, media *models.Media) (*models.MediaURL, error) { - return dataloader.For(ctx).MediaThumbnail.Load(media.ID) -} - -func (r *mediaResolver) VideoWeb(ctx context.Context, media *models.Media) (*models.MediaURL, error) { - if media.Type != models.MediaTypeVideo { - return nil, nil + if obj.Faces != nil { + return obj.Faces, nil } - return dataloader.For(ctx).MediaVideoWeb.Load(media.ID) -} - -func (r *mediaResolver) Exif(ctx context.Context, media *models.Media) (*models.MediaEXIF, error) { - if media.Exif != nil { - return media.Exif, nil - } - - var exif models.MediaEXIF - if err := r.DB(ctx).Model(&media).Association("Exif").Find(&exif); err != nil { + var faces []*models.ImageFace + if err := r.DB(ctx).Model(obj).Association("Faces").Find(&faces); err != nil { return nil, err } - return &exif, nil -} - -func (r *mediaResolver) Favorite(ctx context.Context, media *models.Media) (bool, error) { - user := auth.UserFromContext(ctx) - if user == nil { - return false, auth.ErrUnauthorized - } - - return dataloader.For(ctx).UserMediaFavorite.Load(&models.UserMediaData{ - UserID: user.ID, - MediaID: media.ID, - }) + return faces, nil } +// FavoriteMedia is the resolver for the favoriteMedia field. func (r *mutationResolver) FavoriteMedia(ctx context.Context, mediaID int, favorite bool) (*models.Media, error) { - user := auth.UserFromContext(ctx) if user == nil { return nil, auth.ErrUnauthorized @@ -205,19 +156,80 @@ func (r *mutationResolver) FavoriteMedia(ctx context.Context, mediaID int, favor return user.FavoriteMedia(r.DB(ctx), mediaID, favorite) } -func (r *mediaResolver) Faces(ctx context.Context, media *models.Media) ([]*models.ImageFace, error) { - if face_detection.GlobalFaceDetector == nil { - return []*models.ImageFace{}, nil +// MyMedia is the resolver for the myMedia field. +func (r *queryResolver) MyMedia(ctx context.Context, order *models.Ordering, paginate *models.Pagination) ([]*models.Media, error) { + user := auth.UserFromContext(ctx) + if user == nil { + return nil, errors.New("unauthorized") } - if media.Faces != nil { - return media.Faces, nil - } - - var faces []*models.ImageFace - if err := r.DB(ctx).Model(&media).Association("Faces").Find(&faces); err != nil { - return nil, err - } - - return faces, nil + return actions.MyMedia(r.DB(ctx), user, order, paginate) } + +// Media is the resolver for the media field. +func (r *queryResolver) Media(ctx context.Context, id int, tokenCredentials *models.ShareTokenCredentials) (*models.Media, error) { + db := r.DB(ctx) + if tokenCredentials != nil { + + shareToken, err := r.ShareToken(ctx, *tokenCredentials) + if err != nil { + return nil, err + } + + if *shareToken.MediaID == id { + return shareToken.Media, nil + } + } + + user := auth.UserFromContext(ctx) + if user == nil { + return nil, auth.ErrUnauthorized + } + + var media models.Media + + err := db. + Joins("Album"). + Where("media.id = ?", id). + Where("EXISTS (SELECT * FROM user_albums WHERE user_albums.album_id = media.album_id AND user_albums.user_id = ?)", + user.ID). + Where("media.id IN (?)", db.Model(&models.MediaURL{}).Select("media_id").Where("media_urls.media_id = media.id")). + First(&media).Error + + if err != nil { + return nil, fmt.Errorf("could not get media by media_id and user_id from database: %w", err) + } + + return &media, nil +} + +// MediaList is the resolver for the mediaList field. +func (r *queryResolver) MediaList(ctx context.Context, ids []int) ([]*models.Media, error) { + db := r.DB(ctx) + user := auth.UserFromContext(ctx) + if user == nil { + return nil, auth.ErrUnauthorized + } + + if len(ids) == 0 { + return nil, errors.New("no ids provided") + } + + var media []*models.Media + err := db.Model(&media). + Joins("LEFT JOIN user_albums ON user_albums.album_id = media.album_id"). + Where("media.id IN ?", ids). + Where("user_albums.user_id = ?", user.ID). + Find(&media).Error + + if err != nil { + return nil, fmt.Errorf("could not get media list by media_id and user_id from database: %w", err) + } + + return media, nil +} + +// Media returns api.MediaResolver implementation. +func (r *Resolver) Media() api.MediaResolver { return &mediaResolver{r} } + +type mediaResolver struct{ *Resolver } diff --git a/api/graphql/resolvers/media.graphql b/api/graphql/resolvers/media.graphql new file mode 100644 index 00000000..01157dba --- /dev/null +++ b/api/graphql/resolvers/media.graphql @@ -0,0 +1,100 @@ +type MediaURL { + "URL for previewing the image" + url: String! + "Width of the image in pixels" + width: Int! + "Height of the image in pixels" + height: Int! + "The file size of the resource in bytes" + fileSize: Int! +} + +type MediaDownload { + "A description of the role of the media file" + title: String! + mediaUrl: MediaURL! +} + +enum MediaType { + Photo + Video +} + +"EXIF metadata from the camera" +type MediaEXIF { + id: ID! + media: Media! + "The description of the image" + description: String + "The model name of the camera" + camera: String + "The maker of the camera" + maker: String + "The name of the lens" + lens: String + dateShot: Time + "The exposure time of the image" + exposure: Float + "The aperature stops of the image" + aperture: Float + "The ISO setting of the image" + iso: Int + "The focal length of the lens, when the image was taken" + focalLength: Float + "A formatted description of the flash settings, when the image was taken" + flash: Int + "An index describing the mode for adjusting the exposure of the image" + exposureProgram: Int + "GPS coordinates of where the image was taken" + coordinates: Coordinates +} + +type Media { + id: ID! + title: String! + "Local filepath for the media" + path: String! + "URL to display the media in a smaller resolution" + thumbnail: MediaURL + "URL to display the photo in full resolution, will be null for videos" + highRes: MediaURL + "URL to get the video in a web format that can be played in the browser, will be null for photos" + videoWeb: MediaURL + "The album that holds the media" + album: Album! + exif: MediaEXIF + videoMetadata: VideoMetadata + favorite: Boolean! + type: MediaType! + "The date the image was shot or the date it was imported as a fallback" + date: Time! + "A short string that can be used to generate a blured version of the media, to show while the original is loading" + blurhash: String + + "A list of share tokens pointing to this media, owned byt the logged in user" + shares: [ShareToken!]! + "A list of different versions of files for this media that can be downloaded by the user" + downloads: [MediaDownload!]! + + "A list of faces present on the image" + faces: [ImageFace!]! +} + +extend type Query { + "List of media owned by the logged in user" + myMedia(order: Ordering, paginate: Pagination): [Media!]! @isAuthorized + + """ + Get media by id, user must own the media or be admin. + If valid tokenCredentials are provided, the media may be retrived without further authentication + """ + media(id: ID!, tokenCredentials: ShareTokenCredentials): Media! + + "Get a list of media by their ids, user must own the media or be admin" + mediaList(ids: [ID!]!): [Media!]! +} + +extend type Mutation { + "Mark or unmark a media as being a favorite" + favoriteMedia(mediaId: ID!, favorite: Boolean!): Media! @isAuthorized +} diff --git a/api/graphql/resolvers/mediaGeoJson.go b/api/graphql/resolvers/media_geo_json.generated.go similarity index 56% rename from api/graphql/resolvers/mediaGeoJson.go rename to api/graphql/resolvers/media_geo_json.generated.go index 89985aa2..8b813a49 100644 --- a/api/graphql/resolvers/mediaGeoJson.go +++ b/api/graphql/resolvers/media_geo_json.generated.go @@ -1,5 +1,9 @@ package resolvers +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.55 + import ( "context" "os" @@ -9,67 +13,8 @@ import ( "github.com/photoview/photoview/api/utils" ) -type geoMedia struct { - MediaID int - MediaTitle string - ThumbnailName string - ThumbnailWidth int - ThumbnailHeight int - Latitude float64 - Longitude float64 -} - -type geoJSONFeatureCollection struct { - Type string `json:"type"` - Features []geoJSONFeature `json:"features"` -} - -type geoJSONFeature struct { - Type string `json:"type"` - Properties interface{} `json:"properties"` - Geometry geoJSONFeatureGeometry `json:"geometry"` -} - -type geoJSONMediaProperties struct { - MediaID int `json:"media_id"` - MediaTitle string `json:"media_title"` - Thumbnail struct { - URL string `json:"url"` - Width int `json:"width"` - Height int `json:"height"` - } `json:"thumbnail"` -} - -type geoJSONFeatureGeometry struct { - Type string `json:"type"` - Coordinates [2]float64 `json:"coordinates"` -} - -func makeGeoJSONFeatureCollection(features []geoJSONFeature) geoJSONFeatureCollection { - return geoJSONFeatureCollection{ - Type: "FeatureCollection", - Features: features, - } -} - -func makeGeoJSONFeature(properties interface{}, geometry geoJSONFeatureGeometry) geoJSONFeature { - return geoJSONFeature{ - Type: "Feature", - Properties: properties, - Geometry: geometry, - } -} - -func makeGeoJSONFeatureGeometryPoint(lat float64, long float64) geoJSONFeatureGeometry { - coordinates := [2]float64{long, lat} - - return geoJSONFeatureGeometry{ - Type: "Point", - Coordinates: coordinates, - } -} - -func (r *queryResolver) MyMediaGeoJSON(ctx context.Context) (interface{}, error) { +// MyMediaGeoJSON is the resolver for the myMediaGeoJson field. +func (r *queryResolver) MyMediaGeoJSON(ctx context.Context) (any, error) { user := auth.UserFromContext(ctx) if user == nil { return nil, auth.ErrUnauthorized @@ -124,6 +69,7 @@ func (r *queryResolver) MyMediaGeoJSON(ctx context.Context) (interface{}, error) return featureCollection, nil } +// MapboxToken is the resolver for the mapboxToken field. func (r *queryResolver) MapboxToken(ctx context.Context) (*string, error) { mapboxTokenEnv := os.Getenv("MAPBOX_TOKEN") if mapboxTokenEnv == "" { diff --git a/api/graphql/resolvers/media_geo_json.go b/api/graphql/resolvers/media_geo_json.go new file mode 100644 index 00000000..2016d9b1 --- /dev/null +++ b/api/graphql/resolvers/media_geo_json.go @@ -0,0 +1,61 @@ +package resolvers + +type geoMedia struct { + MediaID int + MediaTitle string + ThumbnailName string + ThumbnailWidth int + ThumbnailHeight int + Latitude float64 + Longitude float64 +} + +type geoJSONFeatureCollection struct { + Type string `json:"type"` + Features []geoJSONFeature `json:"features"` +} + +type geoJSONFeature struct { + Type string `json:"type"` + Properties interface{} `json:"properties"` + Geometry geoJSONFeatureGeometry `json:"geometry"` +} + +type geoJSONMediaProperties struct { + MediaID int `json:"media_id"` + MediaTitle string `json:"media_title"` + Thumbnail struct { + URL string `json:"url"` + Width int `json:"width"` + Height int `json:"height"` + } `json:"thumbnail"` +} + +type geoJSONFeatureGeometry struct { + Type string `json:"type"` + Coordinates [2]float64 `json:"coordinates"` +} + +func makeGeoJSONFeatureCollection(features []geoJSONFeature) geoJSONFeatureCollection { + return geoJSONFeatureCollection{ + Type: "FeatureCollection", + Features: features, + } +} + +func makeGeoJSONFeature(properties interface{}, geometry geoJSONFeatureGeometry) geoJSONFeature { + return geoJSONFeature{ + Type: "Feature", + Properties: properties, + Geometry: geometry, + } +} + +func makeGeoJSONFeatureGeometryPoint(lat float64, long float64) geoJSONFeatureGeometry { + coordinates := [2]float64{long, lat} + + return geoJSONFeatureGeometry{ + Type: "Point", + Coordinates: coordinates, + } +} diff --git a/api/graphql/resolvers/media_geo_json.graphql b/api/graphql/resolvers/media_geo_json.graphql new file mode 100644 index 00000000..66a339bc --- /dev/null +++ b/api/graphql/resolvers/media_geo_json.graphql @@ -0,0 +1,7 @@ +extend type Query { + "Get media owned by the logged in user, returned in GeoJson format" + myMediaGeoJson: Any! @isAuthorized + + "Get the mapbox api token, returns null if mapbox is not enabled" + mapboxToken: String +} diff --git a/api/graphql/resolvers/root.go b/api/graphql/resolvers/resolver.go similarity index 100% rename from api/graphql/resolvers/root.go rename to api/graphql/resolvers/resolver.go diff --git a/api/graphql/schema.graphql b/api/graphql/resolvers/schema.graphql similarity index 57% rename from api/graphql/schema.graphql rename to api/graphql/resolvers/schema.graphql index f6c3d576..56c8333d 100644 --- a/api/graphql/schema.graphql +++ b/api/graphql/resolvers/schema.graphql @@ -44,34 +44,6 @@ type Query { "User preferences for the logged in user" myUserPreferences: UserPreferences! @isAuthorized - "List of albums owned by the logged in user." - myAlbums( - order: Ordering, - paginate: Pagination - "Return only albums from the root directory of the user" - onlyRoot: Boolean - "Return also albums with no media directly in them" - showEmpty: Boolean - "Show only albums having favorites" - onlyWithFavorites: Boolean - ): [Album!]! @isAuthorized - """ - Get album by id, user must own the album or be admin - If valid tokenCredentials are provided, the album may be retrived without further authentication - """ - album(id: ID!, tokenCredentials: ShareTokenCredentials): Album! - - "List of media owned by the logged in user" - myMedia(order: Ordering, paginate: Pagination): [Media!]! @isAuthorized - """ - Get media by id, user must own the media or be admin. - If valid tokenCredentials are provided, the media may be retrived without further authentication - """ - media(id: ID!, tokenCredentials: ShareTokenCredentials): Media! - - "Get a list of media by their ids, user must own the media or be admin" - mediaList(ids: [ID!]!): [Media!]! - """ Get a list of media, ordered first by day, then by album if multiple media was found for the same day. """ @@ -82,11 +54,6 @@ type Query { fromDate: Time ): [Media!]! @isAuthorized - "Get media owned by the logged in user, returned in GeoJson format" - myMediaGeoJson: Any! @isAuthorized - "Get the mapbox api token, returns null if mapbox is not enabled" - mapboxToken: String - "Fetch a share token containing an `Album` or `Media`" shareToken(credentials: ShareTokenCredentials!): ShareToken! "Check if the `ShareToken` credentials are valid" @@ -94,11 +61,6 @@ type Query { "Perform a search query on the contents of the media library" search(query: String!, limitMedia: Int, limitAlbums: Int): SearchResult! - - "Get a list of `FaceGroup`s for the logged in user" - myFaceGroups(paginate: Pagination): [FaceGroup!]! @isAuthorized - "Get a particular `FaceGroup` specified by its ID" - faceGroup(id: ID!): FaceGroup! @isAuthorized } type Mutation { @@ -126,9 +88,6 @@ type Mutation { "Set a password for a token, if null is passed for the password argument, the password will be cleared" protectShareToken(token: String!, password: String): ShareToken! @isAuthorized - "Mark or unmark a media as being a favorite" - favoriteMedia(mediaId: ID!, favorite: Boolean!): Media! @isAuthorized - "Update a user, fields left as `null` will not be changed" updateUser( id: ID! @@ -168,22 +127,6 @@ type Mutation { "Change user preferences for the logged in user" changeUserPreferences(language: String): UserPreferences! @isAuthorized - - "Reset the assigned cover photo for an album" - resetAlbumCover(albumID: ID!): Album! @isAuthorized - "Assign a cover photo to an album" - setAlbumCover(coverID: ID!): Album! @isAuthorized - - "Assign a label to a face group, set label to null to remove the current one" - setFaceGroupLabel(faceGroupID: ID!, label: String): FaceGroup! @isAuthorized - "Merge two face groups into a single one, all ImageFaces from source will be moved to destination" - combineFaceGroups(destinationFaceGroupID: ID!, sourceFaceGroupID: ID!): FaceGroup! @isAuthorized - "Move a list of ImageFaces to another face group" - moveImageFaces(imageFaceIDs: [ID!]!, destinationFaceGroupID: ID!): FaceGroup! @isAuthorized - "Check all unlabeled faces to see if they match a labeled FaceGroup, and move them if they match" - recognizeUnlabeledFaces: [ImageFace!]! @isAuthorized - "Move a list of ImageFaces to a new face group" - detachImageFaces(imageFaceIDs: [ID!]!): FaceGroup! @isAuthorized } type Subscription { @@ -310,121 +253,6 @@ type UserPreferences { language: LanguageTranslation } -type Album { - id: ID! - title: String! - - "The media inside this album" - media( - order: Ordering, - paginate: Pagination - "Return only the favorited media" - onlyFavorites: Boolean - ): [Media!]! - - "The albums contained in this album" - subAlbums( - order: Ordering, - paginate: Pagination - ): [Album!]! - - "The album which contains this album" - parentAlbum: Album - "The user who owns this album" - owner: User! - "The path on the filesystem of the server, where this album is located" - filePath: String! - "An image in this album used for previewing this album" - thumbnail: Media - "A breadcrumb list of all parent albums down to this one" - path: [Album!]! - - "A list of share tokens pointing to this album, owned by the logged in user" - shares: [ShareToken!]! -} - -type MediaURL { - "URL for previewing the image" - url: String! - "Width of the image in pixels" - width: Int! - "Height of the image in pixels" - height: Int! - "The file size of the resource in bytes" - fileSize: Int! -} - -type MediaDownload { - "A description of the role of the media file" - title: String! - mediaUrl: MediaURL! -} - -enum MediaType { - Photo - Video -} - -type Media { - id: ID! - title: String! - "Local filepath for the media" - path: String! - "URL to display the media in a smaller resolution" - thumbnail: MediaURL - "URL to display the photo in full resolution, will be null for videos" - highRes: MediaURL - "URL to get the video in a web format that can be played in the browser, will be null for photos" - videoWeb: MediaURL - "The album that holds the media" - album: Album! - exif: MediaEXIF - videoMetadata: VideoMetadata - favorite: Boolean! - type: MediaType! - "The date the image was shot or the date it was imported as a fallback" - date: Time! - "A short string that can be used to generate a blured version of the media, to show while the original is loading" - blurhash: String - - "A list of share tokens pointing to this media, owned byt the logged in user" - shares: [ShareToken!]! - "A list of different versions of files for this media that can be downloaded by the user" - downloads: [MediaDownload!]! - - "A list of faces present on the image" - faces: [ImageFace!]! -} - -"EXIF metadata from the camera" -type MediaEXIF { - id: ID! - media: Media! - "The description of the image" - description: String - "The model name of the camera" - camera: String - "The maker of the camera" - maker: String - "The name of the lens" - lens: String - dateShot: Time - "The exposure time of the image" - exposure: Float - "The aperature stops of the image" - aperture: Float - "The ISO setting of the image" - iso: Int - "The focal length of the lens, when the image was taken" - focalLength: Float - "A formatted description of the flash settings, when the image was taken" - flash: Int - "An index describing the mode for adjusting the exposure of the image" - exposureProgram: Int - "GPS coordinates of where the image was taken" - coordinates: Coordinates -} - type Coordinates { "GPS latitude in degrees" latitude: Float! @@ -466,32 +294,3 @@ type TimelineGroup { "The day shared for all media in this timeline group" date: Time! } - -"A collection of faces of a particular person" -type FaceGroup { - id: ID! - "The name of the person" - label: String - imageFaces(paginate: Pagination): [ImageFace!]! - "The total number of images in this collection" - imageFaceCount: Int! -} - -"A single face on a particular image" -type ImageFace { - id: ID! - "A reference to the image the face appears on" - media: Media! - "A bounding box of where on the image the face is present" - rectangle: FaceRectangle! - "The `FaceGroup` that contains this `ImageFace`" - faceGroup: FaceGroup! -} - -"A bounding box of where a face is present on an image. The values map from 0 to 1 as a fraction of the image width/height" -type FaceRectangle { - minX: Float! - maxX: Float! - minY: Float! - maxY: Float! -}