Enable GraphQL! #1
@ -115,19 +115,19 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Query struct {
|
Query struct {
|
||||||
Album func(childComplexity int, id string) int
|
Album func(childComplexity int, id string, delete *bool) int
|
||||||
Albums func(childComplexity int, filter *model.AlbumFilter, count *int, page *int) int
|
Albums func(childComplexity int, delete *bool, filter *model.AlbumFilter, count *int, page *int) int
|
||||||
Device func(childComplexity int, id string) int
|
Device func(childComplexity int, id string, delete *bool) int
|
||||||
Devices func(childComplexity int, filter *model.DeviceFilter, count *int, page *int) int
|
Devices func(childComplexity int, delete *bool, filter *model.DeviceFilter, count *int, page *int) int
|
||||||
Login func(childComplexity int, user string, password string, deviceID *string) int
|
Login func(childComplexity int, user string, password string, deviceID *string) int
|
||||||
Logout func(childComplexity int) int
|
Logout func(childComplexity int) int
|
||||||
Me func(childComplexity int) int
|
Me func(childComplexity int, delete *bool) int
|
||||||
MediaItem func(childComplexity int, id string) int
|
MediaItem func(childComplexity int, id string, delete *bool) int
|
||||||
MediaItems func(childComplexity int, filter *model.MediaItemFilter, count *int, page *int) int
|
MediaItems func(childComplexity int, delete *bool, filter *model.MediaItemFilter, count *int, page *int) int
|
||||||
Tag func(childComplexity int, id string) int
|
Tag func(childComplexity int, id string, delete *bool) int
|
||||||
Tags func(childComplexity int, filter *model.TagFilter, count *int, page *int) int
|
Tags func(childComplexity int, delete *bool, filter *model.TagFilter, count *int, page *int) int
|
||||||
User func(childComplexity int, id string) int
|
User func(childComplexity int, id string, delete *bool) int
|
||||||
Users func(childComplexity int, filter *model.UserFilter, count *int, page *int) int
|
Users func(childComplexity int, delete *bool, filter *model.UserFilter, count *int, page *int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
Tag struct {
|
Tag struct {
|
||||||
@ -172,17 +172,17 @@ type MutationResolver interface {
|
|||||||
type QueryResolver interface {
|
type QueryResolver interface {
|
||||||
Login(ctx context.Context, user string, password string, deviceID *string) (*model.AuthResponse, error)
|
Login(ctx context.Context, user string, password string, deviceID *string) (*model.AuthResponse, error)
|
||||||
Logout(ctx context.Context) (*model.AuthResponse, error)
|
Logout(ctx context.Context) (*model.AuthResponse, error)
|
||||||
MediaItem(ctx context.Context, id string) (*model.MediaItem, error)
|
MediaItem(ctx context.Context, id string, delete *bool) (*model.MediaItem, error)
|
||||||
Device(ctx context.Context, id string) (*model.Device, error)
|
Device(ctx context.Context, id string, delete *bool) (*model.Device, error)
|
||||||
Album(ctx context.Context, id string) (*model.Album, error)
|
Album(ctx context.Context, id string, delete *bool) (*model.Album, error)
|
||||||
User(ctx context.Context, id string) (*model.User, error)
|
User(ctx context.Context, id string, delete *bool) (*model.User, error)
|
||||||
Tag(ctx context.Context, id string) (*model.Tag, error)
|
Tag(ctx context.Context, id string, delete *bool) (*model.Tag, error)
|
||||||
Me(ctx context.Context) (*model.User, error)
|
Me(ctx context.Context, delete *bool) (*model.User, error)
|
||||||
MediaItems(ctx context.Context, filter *model.MediaItemFilter, count *int, page *int) (*model.MediaItemResponse, error)
|
MediaItems(ctx context.Context, delete *bool, filter *model.MediaItemFilter, count *int, page *int) (*model.MediaItemResponse, error)
|
||||||
Devices(ctx context.Context, filter *model.DeviceFilter, count *int, page *int) (*model.DeviceResponse, error)
|
Devices(ctx context.Context, delete *bool, filter *model.DeviceFilter, count *int, page *int) (*model.DeviceResponse, error)
|
||||||
Albums(ctx context.Context, filter *model.AlbumFilter, count *int, page *int) (*model.AlbumResponse, error)
|
Albums(ctx context.Context, delete *bool, filter *model.AlbumFilter, count *int, page *int) (*model.AlbumResponse, error)
|
||||||
Tags(ctx context.Context, filter *model.TagFilter, count *int, page *int) (*model.TagResponse, error)
|
Tags(ctx context.Context, delete *bool, filter *model.TagFilter, count *int, page *int) (*model.TagResponse, error)
|
||||||
Users(ctx context.Context, filter *model.UserFilter, count *int, page *int) (*model.UserResponse, error)
|
Users(ctx context.Context, delete *bool, filter *model.UserFilter, count *int, page *int) (*model.UserResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type executableSchema struct {
|
type executableSchema struct {
|
||||||
@ -503,7 +503,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.Album(childComplexity, args["id"].(string)), true
|
return e.complexity.Query.Album(childComplexity, args["id"].(string), args["delete"].(*bool)), true
|
||||||
|
|
||||||
case "Query.albums":
|
case "Query.albums":
|
||||||
if e.complexity.Query.Albums == nil {
|
if e.complexity.Query.Albums == nil {
|
||||||
@ -515,7 +515,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.Albums(childComplexity, args["filter"].(*model.AlbumFilter), args["count"].(*int), args["page"].(*int)), true
|
return e.complexity.Query.Albums(childComplexity, args["delete"].(*bool), args["filter"].(*model.AlbumFilter), args["count"].(*int), args["page"].(*int)), true
|
||||||
|
|
||||||
case "Query.device":
|
case "Query.device":
|
||||||
if e.complexity.Query.Device == nil {
|
if e.complexity.Query.Device == nil {
|
||||||
@ -527,7 +527,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.Device(childComplexity, args["id"].(string)), true
|
return e.complexity.Query.Device(childComplexity, args["id"].(string), args["delete"].(*bool)), true
|
||||||
|
|
||||||
case "Query.devices":
|
case "Query.devices":
|
||||||
if e.complexity.Query.Devices == nil {
|
if e.complexity.Query.Devices == nil {
|
||||||
@ -539,7 +539,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.Devices(childComplexity, args["filter"].(*model.DeviceFilter), args["count"].(*int), args["page"].(*int)), true
|
return e.complexity.Query.Devices(childComplexity, args["delete"].(*bool), args["filter"].(*model.DeviceFilter), args["count"].(*int), args["page"].(*int)), true
|
||||||
|
|
||||||
case "Query.login":
|
case "Query.login":
|
||||||
if e.complexity.Query.Login == nil {
|
if e.complexity.Query.Login == nil {
|
||||||
@ -565,7 +565,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.Me(childComplexity), true
|
args, err := ec.field_Query_me_args(context.TODO(), rawArgs)
|
||||||
|
if err != nil {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Query.Me(childComplexity, args["delete"].(*bool)), true
|
||||||
|
|
||||||
case "Query.mediaItem":
|
case "Query.mediaItem":
|
||||||
if e.complexity.Query.MediaItem == nil {
|
if e.complexity.Query.MediaItem == nil {
|
||||||
@ -577,7 +582,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.MediaItem(childComplexity, args["id"].(string)), true
|
return e.complexity.Query.MediaItem(childComplexity, args["id"].(string), args["delete"].(*bool)), true
|
||||||
|
|
||||||
case "Query.mediaItems":
|
case "Query.mediaItems":
|
||||||
if e.complexity.Query.MediaItems == nil {
|
if e.complexity.Query.MediaItems == nil {
|
||||||
@ -589,7 +594,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.MediaItems(childComplexity, args["filter"].(*model.MediaItemFilter), args["count"].(*int), args["page"].(*int)), true
|
return e.complexity.Query.MediaItems(childComplexity, args["delete"].(*bool), args["filter"].(*model.MediaItemFilter), args["count"].(*int), args["page"].(*int)), true
|
||||||
|
|
||||||
case "Query.tag":
|
case "Query.tag":
|
||||||
if e.complexity.Query.Tag == nil {
|
if e.complexity.Query.Tag == nil {
|
||||||
@ -601,7 +606,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.Tag(childComplexity, args["id"].(string)), true
|
return e.complexity.Query.Tag(childComplexity, args["id"].(string), args["delete"].(*bool)), true
|
||||||
|
|
||||||
case "Query.tags":
|
case "Query.tags":
|
||||||
if e.complexity.Query.Tags == nil {
|
if e.complexity.Query.Tags == nil {
|
||||||
@ -613,7 +618,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.Tags(childComplexity, args["filter"].(*model.TagFilter), args["count"].(*int), args["page"].(*int)), true
|
return e.complexity.Query.Tags(childComplexity, args["delete"].(*bool), args["filter"].(*model.TagFilter), args["count"].(*int), args["page"].(*int)), true
|
||||||
|
|
||||||
case "Query.user":
|
case "Query.user":
|
||||||
if e.complexity.Query.User == nil {
|
if e.complexity.Query.User == nil {
|
||||||
@ -625,7 +630,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.User(childComplexity, args["id"].(string)), true
|
return e.complexity.Query.User(childComplexity, args["id"].(string), args["delete"].(*bool)), true
|
||||||
|
|
||||||
case "Query.users":
|
case "Query.users":
|
||||||
if e.complexity.Query.Users == nil {
|
if e.complexity.Query.Users == nil {
|
||||||
@ -637,7 +642,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Query.Users(childComplexity, args["filter"].(*model.UserFilter), args["count"].(*int), args["page"].(*int)), true
|
return e.complexity.Query.Users(childComplexity, args["delete"].(*bool), args["filter"].(*model.UserFilter), args["count"].(*int), args["page"].(*int)), true
|
||||||
|
|
||||||
case "Tag.createdAt":
|
case "Tag.createdAt":
|
||||||
if e.complexity.Tag.CreatedAt == nil {
|
if e.complexity.Tag.CreatedAt == nil {
|
||||||
@ -1036,6 +1041,7 @@ type Album {
|
|||||||
createdAt: Time
|
createdAt: Time
|
||||||
updatedAt: Time
|
updatedAt: Time
|
||||||
name: String! @meta(gorm: "unique;not null")
|
name: String! @meta(gorm: "unique;not null")
|
||||||
|
# userID: ID! @meta(gorm: "not null")
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@ -1171,7 +1177,6 @@ type AlbumResponse {
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
type Query {
|
type Query {
|
||||||
|
|
||||||
# Authentication
|
# Authentication
|
||||||
login(
|
login(
|
||||||
user: String!
|
user: String!
|
||||||
@ -1181,39 +1186,59 @@ type Query {
|
|||||||
logout: AuthResponse! @hasMinRole(role: User)
|
logout: AuthResponse! @hasMinRole(role: User)
|
||||||
|
|
||||||
# Single Item
|
# Single Item
|
||||||
mediaItem(id: ID!): MediaItem! @hasMinRole(role: User)
|
mediaItem(
|
||||||
device(id: ID!): Device! @hasMinRole(role: User)
|
id: ID!
|
||||||
album(id: ID!): Album! @hasMinRole(role: User)
|
delete: Boolean
|
||||||
user(id: ID!): User! @hasMinRole(role: Admin)
|
): MediaItem! @hasMinRole(role: User)
|
||||||
tag(id: ID!): Tag! @hasMinRole(role: User)
|
device(
|
||||||
me: User! @hasMinRole(role: User)
|
id: ID!
|
||||||
|
delete: Boolean
|
||||||
|
): Device! @hasMinRole(role: User)
|
||||||
|
album(
|
||||||
|
id: ID!
|
||||||
|
delete: Boolean
|
||||||
|
): Album! @hasMinRole(role: User)
|
||||||
|
user(
|
||||||
|
id: ID!
|
||||||
|
delete: Boolean
|
||||||
|
): User! @hasMinRole(role: Admin) # TODO: Delete All User Content
|
||||||
|
tag(
|
||||||
|
id: ID!
|
||||||
|
delete: Boolean
|
||||||
|
): Tag! @hasMinRole(role: User)
|
||||||
|
me(delete: Boolean): User! @hasMinRole(role: User)
|
||||||
|
|
||||||
# All
|
# All
|
||||||
mediaItems(
|
mediaItems(
|
||||||
|
delete: Boolean
|
||||||
filter: MediaItemFilter
|
filter: MediaItemFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): MediaItemResponse! @hasMinRole(role: User)
|
): MediaItemResponse! @hasMinRole(role: User)
|
||||||
devices(
|
devices(
|
||||||
|
delete: Boolean
|
||||||
filter: DeviceFilter
|
filter: DeviceFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): DeviceResponse! @hasMinRole(role: User)
|
): DeviceResponse! @hasMinRole(role: User)
|
||||||
albums(
|
albums(
|
||||||
|
delete: Boolean
|
||||||
filter: AlbumFilter
|
filter: AlbumFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): AlbumResponse! @hasMinRole(role: User)
|
): AlbumResponse! @hasMinRole(role: User)
|
||||||
tags(
|
tags(
|
||||||
|
delete: Boolean
|
||||||
filter: TagFilter
|
filter: TagFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): TagResponse! @hasMinRole(role: User)
|
): TagResponse! @hasMinRole(role: User)
|
||||||
users(
|
users(
|
||||||
|
delete: Boolean
|
||||||
filter: UserFilter
|
filter: UserFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): UserResponse! @hasMinRole(role: Admin)
|
): UserResponse! @hasMinRole(role: Admin) # TODO: Delete All User Content
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
@ -1347,39 +1372,57 @@ func (ec *executionContext) field_Query_album_args(ctx context.Context, rawArgs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["id"] = arg0
|
args["id"] = arg0
|
||||||
|
var arg1 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg1
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_albums_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_albums_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
var arg0 *model.AlbumFilter
|
var arg0 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg0
|
||||||
|
var arg1 *model.AlbumFilter
|
||||||
if tmp, ok := rawArgs["filter"]; ok {
|
if tmp, ok := rawArgs["filter"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
||||||
arg0, err = ec.unmarshalOAlbumFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐAlbumFilter(ctx, tmp)
|
arg1, err = ec.unmarshalOAlbumFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐAlbumFilter(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["filter"] = arg0
|
args["filter"] = arg1
|
||||||
var arg1 *int
|
var arg2 *int
|
||||||
if tmp, ok := rawArgs["count"]; ok {
|
if tmp, ok := rawArgs["count"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
||||||
arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args["count"] = arg1
|
|
||||||
var arg2 *int
|
|
||||||
if tmp, ok := rawArgs["page"]; ok {
|
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
|
||||||
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["page"] = arg2
|
args["count"] = arg2
|
||||||
|
var arg3 *int
|
||||||
|
if tmp, ok := rawArgs["page"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
||||||
|
arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["page"] = arg3
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1395,39 +1438,57 @@ func (ec *executionContext) field_Query_device_args(ctx context.Context, rawArgs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["id"] = arg0
|
args["id"] = arg0
|
||||||
|
var arg1 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg1
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_devices_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_devices_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
var arg0 *model.DeviceFilter
|
var arg0 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg0
|
||||||
|
var arg1 *model.DeviceFilter
|
||||||
if tmp, ok := rawArgs["filter"]; ok {
|
if tmp, ok := rawArgs["filter"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
||||||
arg0, err = ec.unmarshalODeviceFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐDeviceFilter(ctx, tmp)
|
arg1, err = ec.unmarshalODeviceFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐDeviceFilter(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["filter"] = arg0
|
args["filter"] = arg1
|
||||||
var arg1 *int
|
var arg2 *int
|
||||||
if tmp, ok := rawArgs["count"]; ok {
|
if tmp, ok := rawArgs["count"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
||||||
arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args["count"] = arg1
|
|
||||||
var arg2 *int
|
|
||||||
if tmp, ok := rawArgs["page"]; ok {
|
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
|
||||||
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["page"] = arg2
|
args["count"] = arg2
|
||||||
|
var arg3 *int
|
||||||
|
if tmp, ok := rawArgs["page"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
||||||
|
arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["page"] = arg3
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1464,6 +1525,21 @@ func (ec *executionContext) field_Query_login_args(ctx context.Context, rawArgs
|
|||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) field_Query_me_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["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg0
|
||||||
|
return args, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_mediaItem_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_mediaItem_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
@ -1476,39 +1552,57 @@ func (ec *executionContext) field_Query_mediaItem_args(ctx context.Context, rawA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["id"] = arg0
|
args["id"] = arg0
|
||||||
|
var arg1 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg1
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_mediaItems_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_mediaItems_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
var arg0 *model.MediaItemFilter
|
var arg0 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg0
|
||||||
|
var arg1 *model.MediaItemFilter
|
||||||
if tmp, ok := rawArgs["filter"]; ok {
|
if tmp, ok := rawArgs["filter"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
||||||
arg0, err = ec.unmarshalOMediaItemFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐMediaItemFilter(ctx, tmp)
|
arg1, err = ec.unmarshalOMediaItemFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐMediaItemFilter(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["filter"] = arg0
|
args["filter"] = arg1
|
||||||
var arg1 *int
|
var arg2 *int
|
||||||
if tmp, ok := rawArgs["count"]; ok {
|
if tmp, ok := rawArgs["count"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
||||||
arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args["count"] = arg1
|
|
||||||
var arg2 *int
|
|
||||||
if tmp, ok := rawArgs["page"]; ok {
|
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
|
||||||
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["page"] = arg2
|
args["count"] = arg2
|
||||||
|
var arg3 *int
|
||||||
|
if tmp, ok := rawArgs["page"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
||||||
|
arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["page"] = arg3
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1524,39 +1618,57 @@ func (ec *executionContext) field_Query_tag_args(ctx context.Context, rawArgs ma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["id"] = arg0
|
args["id"] = arg0
|
||||||
|
var arg1 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg1
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_tags_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_tags_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
var arg0 *model.TagFilter
|
var arg0 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg0
|
||||||
|
var arg1 *model.TagFilter
|
||||||
if tmp, ok := rawArgs["filter"]; ok {
|
if tmp, ok := rawArgs["filter"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
||||||
arg0, err = ec.unmarshalOTagFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐTagFilter(ctx, tmp)
|
arg1, err = ec.unmarshalOTagFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐTagFilter(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["filter"] = arg0
|
args["filter"] = arg1
|
||||||
var arg1 *int
|
var arg2 *int
|
||||||
if tmp, ok := rawArgs["count"]; ok {
|
if tmp, ok := rawArgs["count"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
||||||
arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args["count"] = arg1
|
|
||||||
var arg2 *int
|
|
||||||
if tmp, ok := rawArgs["page"]; ok {
|
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
|
||||||
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["page"] = arg2
|
args["count"] = arg2
|
||||||
|
var arg3 *int
|
||||||
|
if tmp, ok := rawArgs["page"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
||||||
|
arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["page"] = arg3
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1572,39 +1684,57 @@ func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["id"] = arg0
|
args["id"] = arg0
|
||||||
|
var arg1 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg1
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_users_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_users_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
var arg0 *model.UserFilter
|
var arg0 *bool
|
||||||
|
if tmp, ok := rawArgs["delete"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("delete"))
|
||||||
|
arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["delete"] = arg0
|
||||||
|
var arg1 *model.UserFilter
|
||||||
if tmp, ok := rawArgs["filter"]; ok {
|
if tmp, ok := rawArgs["filter"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
||||||
arg0, err = ec.unmarshalOUserFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐUserFilter(ctx, tmp)
|
arg1, err = ec.unmarshalOUserFilter2ᚖreichardᚗioᚋimaginiᚋgraphᚋmodelᚐUserFilter(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["filter"] = arg0
|
args["filter"] = arg1
|
||||||
var arg1 *int
|
var arg2 *int
|
||||||
if tmp, ok := rawArgs["count"]; ok {
|
if tmp, ok := rawArgs["count"]; ok {
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("count"))
|
||||||
arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args["count"] = arg1
|
|
||||||
var arg2 *int
|
|
||||||
if tmp, ok := rawArgs["page"]; ok {
|
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
|
||||||
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
arg2, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args["page"] = arg2
|
args["count"] = arg2
|
||||||
|
var arg3 *int
|
||||||
|
if tmp, ok := rawArgs["page"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page"))
|
||||||
|
arg3, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["page"] = arg3
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3543,7 +3673,7 @@ func (ec *executionContext) _Query_mediaItem(ctx context.Context, field graphql.
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().MediaItem(rctx, args["id"].(string))
|
return ec.resolvers.Query().MediaItem(rctx, args["id"].(string), args["delete"].(*bool))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
||||||
@ -3609,7 +3739,7 @@ func (ec *executionContext) _Query_device(ctx context.Context, field graphql.Col
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().Device(rctx, args["id"].(string))
|
return ec.resolvers.Query().Device(rctx, args["id"].(string), args["delete"].(*bool))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
||||||
@ -3675,7 +3805,7 @@ func (ec *executionContext) _Query_album(ctx context.Context, field graphql.Coll
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().Album(rctx, args["id"].(string))
|
return ec.resolvers.Query().Album(rctx, args["id"].(string), args["delete"].(*bool))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
||||||
@ -3741,7 +3871,7 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().User(rctx, args["id"].(string))
|
return ec.resolvers.Query().User(rctx, args["id"].(string), args["delete"].(*bool))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "Admin")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "Admin")
|
||||||
@ -3807,7 +3937,7 @@ func (ec *executionContext) _Query_tag(ctx context.Context, field graphql.Collec
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().Tag(rctx, args["id"].(string))
|
return ec.resolvers.Query().Tag(rctx, args["id"].(string), args["delete"].(*bool))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
||||||
@ -3863,10 +3993,17 @@ func (ec *executionContext) _Query_me(ctx context.Context, field graphql.Collect
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx = graphql.WithFieldContext(ctx, fc)
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
rawArgs := field.ArgumentMap(ec.Variables)
|
||||||
|
args, err := ec.field_Query_me_args(ctx, rawArgs)
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
fc.Args = args
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().Me(rctx)
|
return ec.resolvers.Query().Me(rctx, args["delete"].(*bool))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
||||||
@ -3932,7 +4069,7 @@ func (ec *executionContext) _Query_mediaItems(ctx context.Context, field graphql
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().MediaItems(rctx, args["filter"].(*model.MediaItemFilter), args["count"].(*int), args["page"].(*int))
|
return ec.resolvers.Query().MediaItems(rctx, args["delete"].(*bool), args["filter"].(*model.MediaItemFilter), args["count"].(*int), args["page"].(*int))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
||||||
@ -3998,7 +4135,7 @@ func (ec *executionContext) _Query_devices(ctx context.Context, field graphql.Co
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().Devices(rctx, args["filter"].(*model.DeviceFilter), args["count"].(*int), args["page"].(*int))
|
return ec.resolvers.Query().Devices(rctx, args["delete"].(*bool), args["filter"].(*model.DeviceFilter), args["count"].(*int), args["page"].(*int))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
||||||
@ -4064,7 +4201,7 @@ func (ec *executionContext) _Query_albums(ctx context.Context, field graphql.Col
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().Albums(rctx, args["filter"].(*model.AlbumFilter), args["count"].(*int), args["page"].(*int))
|
return ec.resolvers.Query().Albums(rctx, args["delete"].(*bool), args["filter"].(*model.AlbumFilter), args["count"].(*int), args["page"].(*int))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
||||||
@ -4130,7 +4267,7 @@ func (ec *executionContext) _Query_tags(ctx context.Context, field graphql.Colle
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().Tags(rctx, args["filter"].(*model.TagFilter), args["count"].(*int), args["page"].(*int))
|
return ec.resolvers.Query().Tags(rctx, args["delete"].(*bool), args["filter"].(*model.TagFilter), args["count"].(*int), args["page"].(*int))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "User")
|
||||||
@ -4196,7 +4333,7 @@ func (ec *executionContext) _Query_users(ctx context.Context, field graphql.Coll
|
|||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
directive0 := func(rctx context.Context) (interface{}, error) {
|
directive0 := func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().Users(rctx, args["filter"].(*model.UserFilter), args["count"].(*int), args["page"].(*int))
|
return ec.resolvers.Query().Users(rctx, args["delete"].(*bool), args["filter"].(*model.UserFilter), args["count"].(*int), args["page"].(*int))
|
||||||
}
|
}
|
||||||
directive1 := func(ctx context.Context) (interface{}, error) {
|
directive1 := func(ctx context.Context) (interface{}, error) {
|
||||||
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "Admin")
|
role, err := ec.unmarshalNRole2reichardᚗioᚋimaginiᚋgraphᚋmodelᚐRole(ctx, "Admin")
|
||||||
|
@ -191,6 +191,7 @@ type Album {
|
|||||||
createdAt: Time
|
createdAt: Time
|
||||||
updatedAt: Time
|
updatedAt: Time
|
||||||
name: String! @meta(gorm: "unique;not null")
|
name: String! @meta(gorm: "unique;not null")
|
||||||
|
# userID: ID! @meta(gorm: "not null")
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@ -326,7 +327,6 @@ type AlbumResponse {
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
type Query {
|
type Query {
|
||||||
|
|
||||||
# Authentication
|
# Authentication
|
||||||
login(
|
login(
|
||||||
user: String!
|
user: String!
|
||||||
@ -336,39 +336,59 @@ type Query {
|
|||||||
logout: AuthResponse! @hasMinRole(role: User)
|
logout: AuthResponse! @hasMinRole(role: User)
|
||||||
|
|
||||||
# Single Item
|
# Single Item
|
||||||
mediaItem(id: ID!): MediaItem! @hasMinRole(role: User)
|
mediaItem(
|
||||||
device(id: ID!): Device! @hasMinRole(role: User)
|
id: ID!
|
||||||
album(id: ID!): Album! @hasMinRole(role: User)
|
delete: Boolean
|
||||||
user(id: ID!): User! @hasMinRole(role: Admin)
|
): MediaItem! @hasMinRole(role: User)
|
||||||
tag(id: ID!): Tag! @hasMinRole(role: User)
|
device(
|
||||||
me: User! @hasMinRole(role: User)
|
id: ID!
|
||||||
|
delete: Boolean
|
||||||
|
): Device! @hasMinRole(role: User)
|
||||||
|
album(
|
||||||
|
id: ID!
|
||||||
|
delete: Boolean
|
||||||
|
): Album! @hasMinRole(role: User)
|
||||||
|
user(
|
||||||
|
id: ID!
|
||||||
|
delete: Boolean
|
||||||
|
): User! @hasMinRole(role: Admin) # TODO: Delete All User Content
|
||||||
|
tag(
|
||||||
|
id: ID!
|
||||||
|
delete: Boolean
|
||||||
|
): Tag! @hasMinRole(role: User)
|
||||||
|
me(delete: Boolean): User! @hasMinRole(role: User)
|
||||||
|
|
||||||
# All
|
# All
|
||||||
mediaItems(
|
mediaItems(
|
||||||
|
delete: Boolean
|
||||||
filter: MediaItemFilter
|
filter: MediaItemFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): MediaItemResponse! @hasMinRole(role: User)
|
): MediaItemResponse! @hasMinRole(role: User)
|
||||||
devices(
|
devices(
|
||||||
|
delete: Boolean
|
||||||
filter: DeviceFilter
|
filter: DeviceFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): DeviceResponse! @hasMinRole(role: User)
|
): DeviceResponse! @hasMinRole(role: User)
|
||||||
albums(
|
albums(
|
||||||
|
delete: Boolean
|
||||||
filter: AlbumFilter
|
filter: AlbumFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): AlbumResponse! @hasMinRole(role: User)
|
): AlbumResponse! @hasMinRole(role: User)
|
||||||
tags(
|
tags(
|
||||||
|
delete: Boolean
|
||||||
filter: TagFilter
|
filter: TagFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): TagResponse! @hasMinRole(role: User)
|
): TagResponse! @hasMinRole(role: User)
|
||||||
users(
|
users(
|
||||||
|
delete: Boolean
|
||||||
filter: UserFilter
|
filter: UserFilter
|
||||||
count: Int
|
count: Int
|
||||||
page: Int
|
page: Int
|
||||||
): UserResponse! @hasMinRole(role: Admin)
|
): UserResponse! @hasMinRole(role: Admin) # TODO: Delete All User Content
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -21,7 +20,6 @@ import (
|
|||||||
"reichard.io/imagini/graph/model"
|
"reichard.io/imagini/graph/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Done
|
|
||||||
func (r *mutationResolver) CreateMediaItem(ctx context.Context, input model.NewMediaItem) (*model.MediaItem, error) {
|
func (r *mutationResolver) CreateMediaItem(ctx context.Context, input model.NewMediaItem) (*model.MediaItem, error) {
|
||||||
// Get Context
|
// Get Context
|
||||||
authContext := ctx.Value("auth").(*model.AuthContext)
|
authContext := ctx.Value("auth").(*model.AuthContext)
|
||||||
@ -101,11 +99,37 @@ func (r *mutationResolver) CreateMediaItem(ctx context.Context, input model.NewM
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *mutationResolver) CreateAlbum(ctx context.Context, input model.NewAlbum) (*model.Album, error) {
|
func (r *mutationResolver) CreateAlbum(ctx context.Context, input model.NewAlbum) (*model.Album, error) {
|
||||||
panic(fmt.Errorf("not implemented"))
|
// Get Context
|
||||||
|
authContext := ctx.Value("auth").(*model.AuthContext)
|
||||||
|
accessToken := *authContext.AccessToken
|
||||||
|
_, ok := accessToken.Get("sub")
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("Upload Failed")
|
||||||
|
}
|
||||||
|
|
||||||
|
album := &model.Album{
|
||||||
|
Name: input.Name,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := r.DB.CreateAlbum(album)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return album, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *mutationResolver) CreateTag(ctx context.Context, input model.NewTag) (*model.Tag, error) {
|
func (r *mutationResolver) CreateTag(ctx context.Context, input model.NewTag) (*model.Tag, error) {
|
||||||
panic(fmt.Errorf("not implemented"))
|
tag := &model.Tag{
|
||||||
|
Name: input.Name,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := r.DB.CreateTag(tag)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return tag, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *mutationResolver) CreateUser(ctx context.Context, input model.NewUser) (*model.User, error) {
|
func (r *mutationResolver) CreateUser(ctx context.Context, input model.NewUser) (*model.User, error) {
|
||||||
@ -198,50 +222,172 @@ func (r *queryResolver) Logout(ctx context.Context) (*model.AuthResponse, error)
|
|||||||
return &model.AuthResponse{Result: model.AuthResultSuccess}, nil
|
return &model.AuthResponse{Result: model.AuthResultSuccess}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) MediaItem(ctx context.Context, id string) (*model.MediaItem, error) {
|
func (r *queryResolver) MediaItem(ctx context.Context, id string, delete *bool) (*model.MediaItem, error) {
|
||||||
panic(fmt.Errorf("not implemented"))
|
// TODO: User Specific
|
||||||
|
deviceID, err := uuid.Parse(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("Invalid ID Format")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) Device(ctx context.Context, id string) (*model.Device, error) {
|
foundMediaItem := &model.MediaItem{ID: deviceID.String()}
|
||||||
panic(fmt.Errorf("not implemented"))
|
count, err := r.DB.MediaItem(foundMediaItem)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("DB Error")
|
||||||
|
} else if count != 1 {
|
||||||
|
return nil, errors.New("MediaItem Not Found")
|
||||||
|
}
|
||||||
|
return foundMediaItem, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) Album(ctx context.Context, id string) (*model.Album, error) {
|
func (r *queryResolver) Device(ctx context.Context, id string, delete *bool) (*model.Device, error) {
|
||||||
panic(fmt.Errorf("not implemented"))
|
// TODO: User Specific
|
||||||
|
deviceID, err := uuid.Parse(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("Invalid ID Format")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) User(ctx context.Context, id string) (*model.User, error) {
|
foundDevice := &model.Device{ID: deviceID.String()}
|
||||||
panic(fmt.Errorf("not implemented"))
|
count, err := r.DB.Device(foundDevice)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("DB Error")
|
||||||
|
} else if count != 1 {
|
||||||
|
return nil, errors.New("Device Not Found")
|
||||||
|
}
|
||||||
|
return foundDevice, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) Tag(ctx context.Context, id string) (*model.Tag, error) {
|
func (r *queryResolver) Album(ctx context.Context, id string, delete *bool) (*model.Album, error) {
|
||||||
panic(fmt.Errorf("not implemented"))
|
// TODO: User Specific
|
||||||
|
albumID, err := uuid.Parse(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("Invalid ID Format")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) Me(ctx context.Context) (*model.User, error) {
|
foundAlbum := &model.Album{ID: albumID.String()}
|
||||||
panic(fmt.Errorf("not implemented"))
|
count, err := r.DB.Album(foundAlbum)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("DB Error")
|
||||||
|
} else if count != 1 {
|
||||||
|
return nil, errors.New("Album Not Found")
|
||||||
|
}
|
||||||
|
return foundAlbum, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) MediaItems(ctx context.Context, filter *model.MediaItemFilter, count *int, page *int) (*model.MediaItemResponse, error) {
|
func (r *queryResolver) User(ctx context.Context, id string, delete *bool) (*model.User, error) {
|
||||||
panic(fmt.Errorf("not implemented"))
|
userID, err := uuid.Parse(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("Invalid ID Format")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) Devices(ctx context.Context, filter *model.DeviceFilter, count *int, page *int) (*model.DeviceResponse, error) {
|
foundUser := &model.User{ID: userID.String()}
|
||||||
panic(fmt.Errorf("not implemented"))
|
count, err := r.DB.User(foundUser)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("DB Error")
|
||||||
|
} else if count != 1 {
|
||||||
|
return nil, errors.New("User Not Found")
|
||||||
|
}
|
||||||
|
return foundUser, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) Albums(ctx context.Context, filter *model.AlbumFilter, count *int, page *int) (*model.AlbumResponse, error) {
|
func (r *queryResolver) Tag(ctx context.Context, id string, delete *bool) (*model.Tag, error) {
|
||||||
panic(fmt.Errorf("not implemented"))
|
tagID, err := uuid.Parse(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("Invalid ID Format")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) Tags(ctx context.Context, filter *model.TagFilter, count *int, page *int) (*model.TagResponse, error) {
|
foundTag := &model.Tag{ID: tagID.String()}
|
||||||
panic(fmt.Errorf("not implemented"))
|
count, err := r.DB.Tag(foundTag)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("DB Error")
|
||||||
|
} else if count != 1 {
|
||||||
|
return nil, errors.New("Tag Not Found")
|
||||||
|
}
|
||||||
|
return foundTag, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *queryResolver) Users(ctx context.Context, filter *model.UserFilter, count *int, page *int) (*model.UserResponse, error) {
|
func (r *queryResolver) Me(ctx context.Context, delete *bool) (*model.User, error) {
|
||||||
|
// Get Context
|
||||||
|
authContext := ctx.Value("auth").(*model.AuthContext)
|
||||||
|
accessToken := *authContext.AccessToken
|
||||||
|
userID, ok := accessToken.Get("sub")
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("Context Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
foundUser := &model.User{ID: userID.(string)}
|
||||||
|
count, err := r.DB.User(foundUser)
|
||||||
|
if err != nil || count != 1 {
|
||||||
|
return nil, errors.New("DB Error")
|
||||||
|
}
|
||||||
|
return foundUser, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *queryResolver) MediaItems(ctx context.Context, delete *bool, filter *model.MediaItemFilter, count *int, page *int) (*model.MediaItemResponse, error) {
|
||||||
|
resp, totalCount, err := r.DB.MediaItems()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("Context Error")
|
||||||
|
}
|
||||||
|
return &model.MediaItemResponse{
|
||||||
|
Data: resp,
|
||||||
|
PageInfo: &model.PageInfo{
|
||||||
|
Count: int(totalCount),
|
||||||
|
Page: 0,
|
||||||
|
Total: int(totalCount),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *queryResolver) Devices(ctx context.Context, delete *bool, filter *model.DeviceFilter, count *int, page *int) (*model.DeviceResponse, error) {
|
||||||
|
// TODO: User Specific
|
||||||
|
resp, totalCount, err := r.DB.Devices()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("Context Error")
|
||||||
|
}
|
||||||
|
return &model.DeviceResponse{
|
||||||
|
Data: resp,
|
||||||
|
PageInfo: &model.PageInfo{
|
||||||
|
Count: int(totalCount),
|
||||||
|
Page: 0,
|
||||||
|
Total: int(totalCount),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *queryResolver) Albums(ctx context.Context, delete *bool, filter *model.AlbumFilter, count *int, page *int) (*model.AlbumResponse, error) {
|
||||||
|
// TODO: User Specific
|
||||||
|
resp, totalCount, err := r.DB.Albums()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("Context Error")
|
||||||
|
}
|
||||||
|
return &model.AlbumResponse{
|
||||||
|
Data: resp,
|
||||||
|
PageInfo: &model.PageInfo{
|
||||||
|
Count: int(totalCount),
|
||||||
|
Page: 0,
|
||||||
|
Total: int(totalCount),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *queryResolver) Tags(ctx context.Context, delete *bool, filter *model.TagFilter, count *int, page *int) (*model.TagResponse, error) {
|
||||||
|
resp, totalCount, err := r.DB.Tags()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("Context Error")
|
||||||
|
}
|
||||||
|
return &model.TagResponse{
|
||||||
|
Data: resp,
|
||||||
|
PageInfo: &model.PageInfo{
|
||||||
|
Count: int(totalCount),
|
||||||
|
Page: 0,
|
||||||
|
Total: int(totalCount),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *queryResolver) Users(ctx context.Context, delete *bool, filter *model.UserFilter, count *int, page *int) (*model.UserResponse, error) {
|
||||||
resp, totalCount, err := r.DB.Users()
|
resp, totalCount, err := r.DB.Users()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf("DB Error"))
|
return nil, errors.New("Context Error")
|
||||||
}
|
}
|
||||||
return &model.UserResponse{
|
return &model.UserResponse{
|
||||||
Data: resp,
|
Data: resp,
|
||||||
|
@ -1 +1,30 @@
|
|||||||
package db
|
package db
|
||||||
|
|
||||||
|
import (
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"reichard.io/imagini/graph/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (dbm *DBManager) CreateAlbum(album *model.Album) error {
|
||||||
|
log.Debug("[db] Creating album: ", album.Name)
|
||||||
|
err := dbm.db.Create(album).Error
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dbm *DBManager) Album(album *model.Album) (int64, error) {
|
||||||
|
var count int64
|
||||||
|
err := dbm.db.Where(album).First(album).Count(&count).Error
|
||||||
|
return count, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dbm *DBManager) Albums() ([]*model.Album, int64, error) {
|
||||||
|
var foundAlbums []*model.Album
|
||||||
|
var count int64
|
||||||
|
err := dbm.db.Find(&foundAlbums).Count(&count).Error
|
||||||
|
return foundAlbums, count, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dbm *DBManager) DeleteAlbum(album *model.Album) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -21,6 +21,13 @@ func (dbm *DBManager) Device(device *model.Device) (int64, error) {
|
|||||||
return count, err
|
return count, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (dbm *DBManager) Devices() ([]*model.Device, int64, error) {
|
||||||
|
var foundDevices []*model.Device
|
||||||
|
var count int64
|
||||||
|
err := dbm.db.Find(&foundDevices).Count(&count).Error
|
||||||
|
return foundDevices, count, err
|
||||||
|
}
|
||||||
|
|
||||||
func (dbm *DBManager) DeleteDevice(user *model.Device) error {
|
func (dbm *DBManager) DeleteDevice(user *model.Device) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,15 @@ func (dbm *DBManager) CreateMediaItem(mediaItem *model.MediaItem) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dbm *DBManager) MediaItems(mediaItemFilter *model.MediaItem) ([]model.MediaItem, int64, error) {
|
func (dbm *DBManager) MediaItem(mediaItem *model.MediaItem) (int64, error) {
|
||||||
var mediaItems []model.MediaItem
|
|
||||||
var count int64
|
var count int64
|
||||||
|
err := dbm.db.Where(mediaItem).First(mediaItem).Count(&count).Error
|
||||||
|
return count, err
|
||||||
|
}
|
||||||
|
|
||||||
err := dbm.db.Where(mediaItemFilter).Find(&mediaItems).Count(&count).Error
|
func (dbm *DBManager) MediaItems() ([]*model.MediaItem, int64, error) {
|
||||||
|
var mediaItems []*model.MediaItem
|
||||||
|
var count int64
|
||||||
|
err := dbm.db.Find(&mediaItems).Count(&count).Error
|
||||||
return mediaItems, count, err
|
return mediaItems, count, err
|
||||||
}
|
}
|
||||||
|
@ -1 +1,30 @@
|
|||||||
package db
|
package db
|
||||||
|
|
||||||
|
import (
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"reichard.io/imagini/graph/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (dbm *DBManager) CreateTag(tag *model.Tag) error {
|
||||||
|
log.Debug("[db] Creating tag: ", tag.Name)
|
||||||
|
err := dbm.db.Create(tag).Error
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dbm *DBManager) Tag(tag *model.Tag) (int64, error) {
|
||||||
|
var count int64
|
||||||
|
err := dbm.db.Where(tag).First(tag).Count(&count).Error
|
||||||
|
return count, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dbm *DBManager) Tags() ([]*model.Tag, int64, error) {
|
||||||
|
var foundTags []*model.Tag
|
||||||
|
var count int64
|
||||||
|
err := dbm.db.Find(&foundTags).Count(&count).Error
|
||||||
|
return foundTags, count, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dbm *DBManager) DeleteTag(tag *model.Tag) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user