Wooo API!
This commit is contained in:
@@ -60,6 +60,7 @@ type ComplexityRoot struct {
|
||||
}
|
||||
|
||||
AuthResponse struct {
|
||||
Device func(childComplexity int) int
|
||||
Error func(childComplexity int) int
|
||||
Result func(childComplexity int) int
|
||||
}
|
||||
@@ -72,6 +73,7 @@ type ComplexityRoot struct {
|
||||
Type func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
User func(childComplexity int) int
|
||||
UserID func(childComplexity int) int
|
||||
}
|
||||
|
||||
DeviceResponse struct {
|
||||
@@ -92,6 +94,7 @@ type ComplexityRoot struct {
|
||||
Tags func(childComplexity int) int
|
||||
UpdatedAt func(childComplexity int) int
|
||||
User func(childComplexity int) int
|
||||
UserID func(childComplexity int) int
|
||||
}
|
||||
|
||||
MediaItemResponse struct {
|
||||
@@ -118,7 +121,7 @@ type ComplexityRoot struct {
|
||||
Albums func(childComplexity int, filter *model.AlbumFilter, count *int, page *int) int
|
||||
Device func(childComplexity int, id string) int
|
||||
Devices func(childComplexity int, filter *model.DeviceFilter, count *int, page *int) int
|
||||
Login func(childComplexity int, user string, password string) int
|
||||
Login func(childComplexity int, user string, password string, deviceID *string) int
|
||||
Logout func(childComplexity int) int
|
||||
Me func(childComplexity int) int
|
||||
MediaItem func(childComplexity int, id string) int
|
||||
@@ -168,8 +171,8 @@ type MutationResolver interface {
|
||||
CreateUser(ctx context.Context, input model.NewUser) (*model.User, error)
|
||||
}
|
||||
type QueryResolver interface {
|
||||
Login(ctx context.Context, user string, password string) (model.AuthResult, error)
|
||||
Logout(ctx context.Context) (model.AuthResult, error)
|
||||
Login(ctx context.Context, user string, password string, deviceID *string) (*model.AuthResponse, error)
|
||||
Logout(ctx context.Context) (*model.AuthResponse, error)
|
||||
MediaItem(ctx context.Context, id string) (*model.MediaItem, error)
|
||||
Device(ctx context.Context, id string) (*model.Device, error)
|
||||
Album(ctx context.Context, id string) (*model.Album, error)
|
||||
@@ -240,6 +243,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.AlbumResponse.PageInfo(childComplexity), true
|
||||
|
||||
case "AuthResponse.Device":
|
||||
if e.complexity.AuthResponse.Device == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.AuthResponse.Device(childComplexity), true
|
||||
|
||||
case "AuthResponse.Error":
|
||||
if e.complexity.AuthResponse.Error == nil {
|
||||
break
|
||||
@@ -303,6 +313,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Device.User(childComplexity), true
|
||||
|
||||
case "Device.userID":
|
||||
if e.complexity.Device.UserID == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Device.UserID(childComplexity), true
|
||||
|
||||
case "DeviceResponse.data":
|
||||
if e.complexity.DeviceResponse.Data == nil {
|
||||
break
|
||||
@@ -401,6 +418,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.MediaItem.User(childComplexity), true
|
||||
|
||||
case "MediaItem.userID":
|
||||
if e.complexity.MediaItem.UserID == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.MediaItem.UserID(childComplexity), true
|
||||
|
||||
case "MediaItemResponse.data":
|
||||
if e.complexity.MediaItemResponse.Data == nil {
|
||||
break
|
||||
@@ -554,7 +578,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
return 0, false
|
||||
}
|
||||
|
||||
return e.complexity.Query.Login(childComplexity, args["user"].(string), args["password"].(string)), true
|
||||
return e.complexity.Query.Login(childComplexity, args["user"].(string), args["password"].(string), args["deviceID"].(*string)), true
|
||||
|
||||
case "Query.logout":
|
||||
if e.complexity.Query.Logout == nil {
|
||||
@@ -876,6 +900,7 @@ enum AuthResult {
|
||||
|
||||
type AuthResponse {
|
||||
Result: AuthResult!
|
||||
Device: Device
|
||||
Error: String
|
||||
}
|
||||
|
||||
@@ -972,17 +997,18 @@ input AuthTypeFilter {
|
||||
# ------------------------------------------------------------
|
||||
|
||||
type Device {
|
||||
id: ID @meta(gorm: "primarykey;not null")
|
||||
id: ID! @meta(gorm: "primaryKey;not null")
|
||||
createdAt: Time
|
||||
updatedAt: Time
|
||||
name: String! @meta(gorm: "not null")
|
||||
type: DeviceType! @meta(gorm: "default:Unknown;not null")
|
||||
user: User @meta(gorm: "ForeignKey:ID;not null")
|
||||
userID: ID! @meta(gorm: "not null")
|
||||
user: User! @meta(gorm: "foreignKey:ID;references:UserID;not null")
|
||||
refreshKey: String
|
||||
}
|
||||
|
||||
type User {
|
||||
id: ID @meta(gorm: "primarykey;not null")
|
||||
id: ID! @meta(gorm: "primaryKey;not null")
|
||||
createdAt: Time
|
||||
updatedAt: Time
|
||||
email: String! @meta(gorm: "not null;unique")
|
||||
@@ -995,7 +1021,7 @@ type User {
|
||||
}
|
||||
|
||||
type MediaItem {
|
||||
id: ID @meta(gorm: "primarykey;not null")
|
||||
id: ID! @meta(gorm: "primaryKey;not null")
|
||||
createdAt: Time
|
||||
updatedAt: Time
|
||||
exifDate: Time
|
||||
@@ -1006,18 +1032,19 @@ type MediaItem {
|
||||
origName: String! @meta(gorm: "not null")
|
||||
tags: [Tag] @meta(gorm: "many2many:media_tags")
|
||||
albums: [Album] @meta(gorm: "many2many:media_albums")
|
||||
user: User @meta(gorm: "ForeignKey:ID;not null")
|
||||
userID: ID! @meta(gorm: "not null")
|
||||
user: User! @meta(gorm: "foreignKey:ID;references:UserID;not null")
|
||||
}
|
||||
|
||||
type Tag {
|
||||
id: ID @meta(gorm: "primarykey;not null")
|
||||
id: ID! @meta(gorm: "primaryKey;not null")
|
||||
createdAt: Time
|
||||
updatedAt: Time
|
||||
name: String! @meta(gorm: "unique;not null")
|
||||
}
|
||||
|
||||
type Album {
|
||||
id: ID @meta(gorm: "primarykey;not null")
|
||||
id: ID! @meta(gorm: "primaryKey;not null")
|
||||
createdAt: Time
|
||||
updatedAt: Time
|
||||
name: String! @meta(gorm: "unique;not null")
|
||||
@@ -1165,8 +1192,9 @@ type Query {
|
||||
login(
|
||||
user: String!
|
||||
password: String!
|
||||
): AuthResult!
|
||||
logout: AuthResult! @hasMinRole(role: User)
|
||||
deviceID: ID
|
||||
): AuthResponse!
|
||||
logout: AuthResponse! @hasMinRole(role: User)
|
||||
|
||||
# Single Item
|
||||
mediaItem(id: ID!): MediaItem! @hasMinRole(role: User)
|
||||
@@ -1456,6 +1484,15 @@ func (ec *executionContext) field_Query_login_args(ctx context.Context, rawArgs
|
||||
}
|
||||
}
|
||||
args["password"] = arg1
|
||||
var arg2 *string
|
||||
if tmp, ok := rawArgs["deviceID"]; ok {
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deviceID"))
|
||||
arg2, err = ec.unmarshalOID2ᚖstring(ctx, tmp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
args["deviceID"] = arg2
|
||||
return args, nil
|
||||
}
|
||||
|
||||
@@ -1663,7 +1700,7 @@ func (ec *executionContext) _Album_id(ctx context.Context, field graphql.Collect
|
||||
return obj.ID, nil
|
||||
}
|
||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primarykey;not null")
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primaryKey;not null")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1680,21 +1717,24 @@ func (ec *executionContext) _Album_id(ctx context.Context, field graphql.Collect
|
||||
if tmp == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if data, ok := tmp.(*string); ok {
|
||||
if data, ok := tmp.(string); ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, 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.(*string)
|
||||
res := resTmp.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
|
||||
return ec.marshalNID2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Album_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Album) (ret graphql.Marshaler) {
|
||||
@@ -1922,6 +1962,38 @@ func (ec *executionContext) _AuthResponse_Result(ctx context.Context, field grap
|
||||
return ec.marshalNAuthResult2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐAuthResult(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _AuthResponse_Device(ctx context.Context, field graphql.CollectedField, obj *model.AuthResponse) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "AuthResponse",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.Device, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*model.Device)
|
||||
fc.Result = res
|
||||
return ec.marshalODevice2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐDevice(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _AuthResponse_Error(ctx context.Context, field graphql.CollectedField, obj *model.AuthResponse) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -1976,7 +2048,7 @@ func (ec *executionContext) _Device_id(ctx context.Context, field graphql.Collec
|
||||
return obj.ID, nil
|
||||
}
|
||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primarykey;not null")
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primaryKey;not null")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1993,21 +2065,24 @@ func (ec *executionContext) _Device_id(ctx context.Context, field graphql.Collec
|
||||
if tmp == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if data, ok := tmp.(*string); ok {
|
||||
if data, ok := tmp.(string); ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, 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.(*string)
|
||||
res := resTmp.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
|
||||
return ec.marshalNID2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Device_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Device) (ret graphql.Marshaler) {
|
||||
@@ -2192,6 +2267,65 @@ func (ec *executionContext) _Device_type(ctx context.Context, field graphql.Coll
|
||||
return ec.marshalNDeviceType2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐDeviceType(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Device_userID(ctx context.Context, field graphql.CollectedField, obj *model.Device) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Device",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
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 obj.UserID, nil
|
||||
}
|
||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "not null")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ec.directives.Meta == nil {
|
||||
return nil, errors.New("directive meta is not implemented")
|
||||
}
|
||||
return ec.directives.Meta(ctx, obj, directive0, gorm)
|
||||
}
|
||||
|
||||
tmp, err := directive1(rctx)
|
||||
if err != nil {
|
||||
return nil, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
if tmp == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if data, ok := tmp.(string); ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, 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.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalNID2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Device_user(ctx context.Context, field graphql.CollectedField, obj *model.Device) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -2214,7 +2348,7 @@ func (ec *executionContext) _Device_user(ctx context.Context, field graphql.Coll
|
||||
return obj.User, nil
|
||||
}
|
||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "ForeignKey:ID;not null")
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "foreignKey:ID;references:UserID;not null")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -2241,11 +2375,14 @@ func (ec *executionContext) _Device_user(ctx context.Context, field graphql.Coll
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*model.User)
|
||||
fc.Result = res
|
||||
return ec.marshalOUser2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res)
|
||||
return ec.marshalNUser2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Device_refreshKey(ctx context.Context, field graphql.CollectedField, obj *model.Device) (ret graphql.Marshaler) {
|
||||
@@ -2369,7 +2506,7 @@ func (ec *executionContext) _MediaItem_id(ctx context.Context, field graphql.Col
|
||||
return obj.ID, nil
|
||||
}
|
||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primarykey;not null")
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primaryKey;not null")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -2386,21 +2523,24 @@ func (ec *executionContext) _MediaItem_id(ctx context.Context, field graphql.Col
|
||||
if tmp == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if data, ok := tmp.(*string); ok {
|
||||
if data, ok := tmp.(string); ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, 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.(*string)
|
||||
res := resTmp.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
|
||||
return ec.marshalNID2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _MediaItem_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.MediaItem) (ret graphql.Marshaler) {
|
||||
@@ -2852,6 +2992,65 @@ func (ec *executionContext) _MediaItem_albums(ctx context.Context, field graphql
|
||||
return ec.marshalOAlbum2ᚕᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐAlbum(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _MediaItem_userID(ctx context.Context, field graphql.CollectedField, obj *model.MediaItem) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "MediaItem",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
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 obj.UserID, nil
|
||||
}
|
||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "not null")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ec.directives.Meta == nil {
|
||||
return nil, errors.New("directive meta is not implemented")
|
||||
}
|
||||
return ec.directives.Meta(ctx, obj, directive0, gorm)
|
||||
}
|
||||
|
||||
tmp, err := directive1(rctx)
|
||||
if err != nil {
|
||||
return nil, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
if tmp == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if data, ok := tmp.(string); ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, 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.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalNID2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _MediaItem_user(ctx context.Context, field graphql.CollectedField, obj *model.MediaItem) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -2874,7 +3073,7 @@ func (ec *executionContext) _MediaItem_user(ctx context.Context, field graphql.C
|
||||
return obj.User, nil
|
||||
}
|
||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "ForeignKey:ID;not null")
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "foreignKey:ID;references:UserID;not null")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -2901,11 +3100,14 @@ func (ec *executionContext) _MediaItem_user(ctx context.Context, field graphql.C
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*model.User)
|
||||
fc.Result = res
|
||||
return ec.marshalOUser2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res)
|
||||
return ec.marshalNUser2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐUser(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _MediaItemResponse_data(ctx context.Context, field graphql.CollectedField, obj *model.MediaItemResponse) (ret graphql.Marshaler) {
|
||||
@@ -3435,7 +3637,7 @@ func (ec *executionContext) _Query_login(ctx context.Context, field graphql.Coll
|
||||
fc.Args = args
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return ec.resolvers.Query().Login(rctx, args["user"].(string), args["password"].(string))
|
||||
return ec.resolvers.Query().Login(rctx, args["user"].(string), args["password"].(string), args["deviceID"].(*string))
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
@@ -3447,9 +3649,9 @@ func (ec *executionContext) _Query_login(ctx context.Context, field graphql.Coll
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(model.AuthResult)
|
||||
res := resTmp.(*model.AuthResponse)
|
||||
fc.Result = res
|
||||
return ec.marshalNAuthResult2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐAuthResult(ctx, field.Selections, res)
|
||||
return ec.marshalNAuthResponse2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐAuthResponse(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_logout(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
@@ -3491,10 +3693,10 @@ func (ec *executionContext) _Query_logout(ctx context.Context, field graphql.Col
|
||||
if tmp == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if data, ok := tmp.(model.AuthResult); ok {
|
||||
if data, ok := tmp.(*model.AuthResponse); ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be reichard.io/imagini/graph/model.AuthResult`, tmp)
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be *reichard.io/imagini/graph/model.AuthResponse`, tmp)
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
@@ -3506,9 +3708,9 @@ func (ec *executionContext) _Query_logout(ctx context.Context, field graphql.Col
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(model.AuthResult)
|
||||
res := resTmp.(*model.AuthResponse)
|
||||
fc.Result = res
|
||||
return ec.marshalNAuthResult2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐAuthResult(ctx, field.Selections, res)
|
||||
return ec.marshalNAuthResponse2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐAuthResponse(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_mediaItem(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
@@ -4323,7 +4525,7 @@ func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.Collected
|
||||
return obj.ID, nil
|
||||
}
|
||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primarykey;not null")
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primaryKey;not null")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -4340,21 +4542,24 @@ func (ec *executionContext) _Tag_id(ctx context.Context, field graphql.Collected
|
||||
if tmp == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if data, ok := tmp.(*string); ok {
|
||||
if data, ok := tmp.(string); ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, 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.(*string)
|
||||
res := resTmp.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
|
||||
return ec.marshalNID2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Tag_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Tag) (ret graphql.Marshaler) {
|
||||
@@ -4569,7 +4774,7 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte
|
||||
return obj.ID, nil
|
||||
}
|
||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primarykey;not null")
|
||||
gorm, err := ec.unmarshalOString2ᚖstring(ctx, "primaryKey;not null")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -4586,21 +4791,24 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte
|
||||
if tmp == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if data, ok := tmp.(*string); ok {
|
||||
if data, ok := tmp.(string); ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)
|
||||
return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, 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.(*string)
|
||||
res := resTmp.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalOID2ᚖstring(ctx, field.Selections, res)
|
||||
return ec.marshalNID2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _User_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) {
|
||||
@@ -7282,6 +7490,9 @@ func (ec *executionContext) _Album(ctx context.Context, sel ast.SelectionSet, ob
|
||||
out.Values[i] = graphql.MarshalString("Album")
|
||||
case "id":
|
||||
out.Values[i] = ec._Album_id(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "createdAt":
|
||||
out.Values[i] = ec._Album_createdAt(ctx, field, obj)
|
||||
case "updatedAt":
|
||||
@@ -7347,6 +7558,8 @@ func (ec *executionContext) _AuthResponse(ctx context.Context, sel ast.Selection
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "Device":
|
||||
out.Values[i] = ec._AuthResponse_Device(ctx, field, obj)
|
||||
case "Error":
|
||||
out.Values[i] = ec._AuthResponse_Error(ctx, field, obj)
|
||||
default:
|
||||
@@ -7373,6 +7586,9 @@ func (ec *executionContext) _Device(ctx context.Context, sel ast.SelectionSet, o
|
||||
out.Values[i] = graphql.MarshalString("Device")
|
||||
case "id":
|
||||
out.Values[i] = ec._Device_id(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "createdAt":
|
||||
out.Values[i] = ec._Device_createdAt(ctx, field, obj)
|
||||
case "updatedAt":
|
||||
@@ -7387,8 +7603,16 @@ func (ec *executionContext) _Device(ctx context.Context, sel ast.SelectionSet, o
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "userID":
|
||||
out.Values[i] = ec._Device_userID(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "user":
|
||||
out.Values[i] = ec._Device_user(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "refreshKey":
|
||||
out.Values[i] = ec._Device_refreshKey(ctx, field, obj)
|
||||
default:
|
||||
@@ -7444,6 +7668,9 @@ func (ec *executionContext) _MediaItem(ctx context.Context, sel ast.SelectionSet
|
||||
out.Values[i] = graphql.MarshalString("MediaItem")
|
||||
case "id":
|
||||
out.Values[i] = ec._MediaItem_id(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "createdAt":
|
||||
out.Values[i] = ec._MediaItem_createdAt(ctx, field, obj)
|
||||
case "updatedAt":
|
||||
@@ -7473,8 +7700,16 @@ func (ec *executionContext) _MediaItem(ctx context.Context, sel ast.SelectionSet
|
||||
out.Values[i] = ec._MediaItem_tags(ctx, field, obj)
|
||||
case "albums":
|
||||
out.Values[i] = ec._MediaItem_albums(ctx, field, obj)
|
||||
case "userID":
|
||||
out.Values[i] = ec._MediaItem_userID(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "user":
|
||||
out.Values[i] = ec._MediaItem_user(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
default:
|
||||
panic("unknown field " + strconv.Quote(field.Name))
|
||||
}
|
||||
@@ -7828,6 +8063,9 @@ func (ec *executionContext) _Tag(ctx context.Context, sel ast.SelectionSet, obj
|
||||
out.Values[i] = graphql.MarshalString("Tag")
|
||||
case "id":
|
||||
out.Values[i] = ec._Tag_id(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "createdAt":
|
||||
out.Values[i] = ec._Tag_createdAt(ctx, field, obj)
|
||||
case "updatedAt":
|
||||
@@ -7890,6 +8128,9 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj
|
||||
out.Values[i] = graphql.MarshalString("User")
|
||||
case "id":
|
||||
out.Values[i] = ec._User_id(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "createdAt":
|
||||
out.Values[i] = ec._User_createdAt(ctx, field, obj)
|
||||
case "updatedAt":
|
||||
@@ -8233,6 +8474,20 @@ func (ec *executionContext) marshalNAlbumResponse2ᚖreichardᚗioᚋimaginiᚋg
|
||||
return ec._AlbumResponse(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNAuthResponse2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐAuthResponse(ctx context.Context, sel ast.SelectionSet, v model.AuthResponse) graphql.Marshaler {
|
||||
return ec._AuthResponse(ctx, sel, &v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNAuthResponse2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐAuthResponse(ctx context.Context, sel ast.SelectionSet, v *model.AuthResponse) graphql.Marshaler {
|
||||
if v == nil {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
return ec._AuthResponse(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNAuthResult2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐAuthResult(ctx context.Context, v interface{}) (model.AuthResult, error) {
|
||||
var res model.AuthResult
|
||||
err := res.UnmarshalGQL(v)
|
||||
|
||||
Reference in New Issue
Block a user