Remove Album.coverID + fix thumbnail refresh
- Album.coverID has been removed from `schema.graphql` - Make sure the proper informations are fetched from the set/reset album cover mutations such that Apollo can update the cache accordingly.
This commit is contained in:
parent
5610fe0c00
commit
feeb9e0a40
|
@ -57,7 +57,6 @@ type DirectiveRoot struct {
|
||||||
|
|
||||||
type ComplexityRoot struct {
|
type ComplexityRoot struct {
|
||||||
Album struct {
|
Album struct {
|
||||||
CoverID func(childComplexity int) int
|
|
||||||
FilePath func(childComplexity int) int
|
FilePath func(childComplexity int) int
|
||||||
ID func(childComplexity int) int
|
ID func(childComplexity int) int
|
||||||
Media func(childComplexity int, order *models.Ordering, paginate *models.Pagination, onlyFavorites *bool) int
|
Media func(childComplexity int, order *models.Ordering, paginate *models.Pagination, onlyFavorites *bool) int
|
||||||
|
@ -371,13 +370,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||||
_ = ec
|
_ = ec
|
||||||
switch typeName + "." + field {
|
switch typeName + "." + field {
|
||||||
|
|
||||||
case "Album.coverID":
|
|
||||||
if e.complexity.Album.CoverID == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.Album.CoverID(childComplexity), true
|
|
||||||
|
|
||||||
case "Album.filePath":
|
case "Album.filePath":
|
||||||
if e.complexity.Album.FilePath == nil {
|
if e.complexity.Album.FilePath == nil {
|
||||||
break
|
break
|
||||||
|
@ -1947,7 +1939,7 @@ type Album {
|
||||||
|
|
||||||
shares: [ShareToken!]!
|
shares: [ShareToken!]!
|
||||||
|
|
||||||
coverID: Int
|
#coverID: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type MediaURL {
|
type MediaURL {
|
||||||
|
@ -3337,38 +3329,6 @@ func (ec *executionContext) _Album_shares(ctx context.Context, field graphql.Col
|
||||||
return ec.marshalNShareToken2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenᚄ(ctx, field.Selections, res)
|
return ec.marshalNShareToken2ᚕᚖgithubᚗcomᚋphotoviewᚋphotoviewᚋapiᚋgraphqlᚋmodelsᚐShareTokenᚄ(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Album_coverID(ctx context.Context, field graphql.CollectedField, obj *models.Album) (ret graphql.Marshaler) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
ec.Error(ctx, ec.Recover(ctx, r))
|
|
||||||
ret = graphql.Null
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
fc := &graphql.FieldContext{
|
|
||||||
Object: "Album",
|
|
||||||
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.CoverID, nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
ec.Error(ctx, err)
|
|
||||||
return graphql.Null
|
|
||||||
}
|
|
||||||
if resTmp == nil {
|
|
||||||
return graphql.Null
|
|
||||||
}
|
|
||||||
res := resTmp.(*int)
|
|
||||||
fc.Result = res
|
|
||||||
return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) _AuthorizeResult_success(ctx context.Context, field graphql.CollectedField, obj *models.AuthorizeResult) (ret graphql.Marshaler) {
|
func (ec *executionContext) _AuthorizeResult_success(ctx context.Context, field graphql.CollectedField, obj *models.AuthorizeResult) (ret graphql.Marshaler) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
|
@ -10361,8 +10321,6 @@ func (ec *executionContext) _Album(ctx context.Context, sel ast.SelectionSet, ob
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
case "coverID":
|
|
||||||
out.Values[i] = ec._Album_coverID(ctx, field, obj)
|
|
||||||
default:
|
default:
|
||||||
panic("unknown field " + strconv.Quote(field.Name))
|
panic("unknown field " + strconv.Quote(field.Name))
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,8 +278,6 @@ type Album {
|
||||||
path: [Album!]!
|
path: [Album!]!
|
||||||
|
|
||||||
shares: [ShareToken!]!
|
shares: [ShareToken!]!
|
||||||
|
|
||||||
coverID: Int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type MediaURL {
|
type MediaURL {
|
||||||
|
|
|
@ -25,6 +25,7 @@ const ALBUM_QUERY = gql`
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
thumbnail {
|
thumbnail {
|
||||||
|
id
|
||||||
thumbnail {
|
thumbnail {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
|
@ -93,7 +94,6 @@ function AlbumPage({ match }: AlbumPageProps) {
|
||||||
offset: 0,
|
offset: 0,
|
||||||
limit: 200,
|
limit: 200,
|
||||||
},
|
},
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const { containerElem, finished: finishedLoadingMore } =
|
const { containerElem, finished: finishedLoadingMore } =
|
||||||
|
|
|
@ -19,6 +19,7 @@ export interface albumQuery_album_subAlbums_thumbnail_thumbnail {
|
||||||
|
|
||||||
export interface albumQuery_album_subAlbums_thumbnail {
|
export interface albumQuery_album_subAlbums_thumbnail {
|
||||||
__typename: 'Media'
|
__typename: 'Media'
|
||||||
|
id: string
|
||||||
/**
|
/**
|
||||||
* URL to display the media in a smaller resolution
|
* URL to display the media in a smaller resolution
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,6 +10,7 @@ const getAlbumsQuery = gql`
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
thumbnail {
|
thumbnail {
|
||||||
|
id
|
||||||
thumbnail {
|
thumbnail {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
|
@ -19,9 +20,7 @@ const getAlbumsQuery = gql`
|
||||||
`
|
`
|
||||||
|
|
||||||
const AlbumsPage = () => {
|
const AlbumsPage = () => {
|
||||||
const { error, data } = useQuery<getMyAlbums>(getAlbumsQuery, {
|
const { error, data } = useQuery<getMyAlbums>(getAlbumsQuery)
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
})
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout title="Albums">
|
<Layout title="Albums">
|
||||||
|
|
|
@ -8,34 +8,35 @@
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface getMyAlbums_myAlbums_thumbnail_thumbnail {
|
export interface getMyAlbums_myAlbums_thumbnail_thumbnail {
|
||||||
__typename: "MediaURL";
|
__typename: 'MediaURL'
|
||||||
/**
|
/**
|
||||||
* URL for previewing the image
|
* URL for previewing the image
|
||||||
*/
|
*/
|
||||||
url: string;
|
url: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface getMyAlbums_myAlbums_thumbnail {
|
export interface getMyAlbums_myAlbums_thumbnail {
|
||||||
__typename: "Media";
|
__typename: 'Media'
|
||||||
|
id: string
|
||||||
/**
|
/**
|
||||||
* URL to display the media in a smaller resolution
|
* URL to display the media in a smaller resolution
|
||||||
*/
|
*/
|
||||||
thumbnail: getMyAlbums_myAlbums_thumbnail_thumbnail | null;
|
thumbnail: getMyAlbums_myAlbums_thumbnail_thumbnail | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface getMyAlbums_myAlbums {
|
export interface getMyAlbums_myAlbums {
|
||||||
__typename: "Album";
|
__typename: 'Album'
|
||||||
id: string;
|
id: string
|
||||||
title: string;
|
title: string
|
||||||
/**
|
/**
|
||||||
* An image in this album used for previewing this album
|
* An image in this album used for previewing this album
|
||||||
*/
|
*/
|
||||||
thumbnail: getMyAlbums_myAlbums_thumbnail | null;
|
thumbnail: getMyAlbums_myAlbums_thumbnail | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface getMyAlbums {
|
export interface getMyAlbums {
|
||||||
/**
|
/**
|
||||||
* List of albums owned by the logged in user.
|
* List of albums owned by the logged in user.
|
||||||
*/
|
*/
|
||||||
myAlbums: getMyAlbums_myAlbums[];
|
myAlbums: getMyAlbums_myAlbums[]
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ export const SHARE_ALBUM_QUERY = gql`
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
thumbnail {
|
thumbnail {
|
||||||
|
id
|
||||||
thumbnail {
|
thumbnail {
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ export interface shareAlbumQuery_album_subAlbums_thumbnail_thumbnail {
|
||||||
|
|
||||||
export interface shareAlbumQuery_album_subAlbums_thumbnail {
|
export interface shareAlbumQuery_album_subAlbums_thumbnail {
|
||||||
__typename: 'Media'
|
__typename: 'Media'
|
||||||
|
id: string
|
||||||
/**
|
/**
|
||||||
* URL to display the media in a smaller resolution
|
* URL to display the media in a smaller resolution
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,13 +17,25 @@ const RESET_ALBUM_COVER_MUTATION = gql`
|
||||||
mutation resetAlbumCover($albumID: ID!) {
|
mutation resetAlbumCover($albumID: ID!) {
|
||||||
resetAlbumCover(albumID: $albumID) {
|
resetAlbumCover(albumID: $albumID) {
|
||||||
id
|
id
|
||||||
|
thumbnail {
|
||||||
|
id
|
||||||
|
thumbnail {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
const SET_ALBUM_COVER_MUTATION = gql`
|
const SET_ALBUM_COVER_MUTATION = gql`
|
||||||
mutation setAlbumCover($coverID: ID!) {
|
mutation setAlbumCover($coverID: ID!) {
|
||||||
setAlbumCover(coverID: $coverID) {
|
setAlbumCover(coverID: $coverID) {
|
||||||
coverID
|
id
|
||||||
|
thumbnail {
|
||||||
|
id
|
||||||
|
thumbnail {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
|
@ -7,9 +7,30 @@
|
||||||
// GraphQL mutation operation: resetAlbumCover
|
// GraphQL mutation operation: resetAlbumCover
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
|
export interface resetAlbumCover_resetAlbumCover_thumbnail_thumbnail {
|
||||||
|
__typename: 'MediaURL'
|
||||||
|
/**
|
||||||
|
* URL for previewing the image
|
||||||
|
*/
|
||||||
|
url: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface resetAlbumCover_resetAlbumCover_thumbnail {
|
||||||
|
__typename: 'Media'
|
||||||
|
id: string
|
||||||
|
/**
|
||||||
|
* URL to display the media in a smaller resolution
|
||||||
|
*/
|
||||||
|
thumbnail: resetAlbumCover_resetAlbumCover_thumbnail_thumbnail | null
|
||||||
|
}
|
||||||
|
|
||||||
export interface resetAlbumCover_resetAlbumCover {
|
export interface resetAlbumCover_resetAlbumCover {
|
||||||
__typename: 'Album'
|
__typename: 'Album'
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* An image in this album used for previewing this album
|
||||||
|
*/
|
||||||
|
thumbnail: resetAlbumCover_resetAlbumCover_thumbnail | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface resetAlbumCover {
|
export interface resetAlbumCover {
|
||||||
|
|
|
@ -7,9 +7,30 @@
|
||||||
// GraphQL mutation operation: setAlbumCover
|
// GraphQL mutation operation: setAlbumCover
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
|
export interface setAlbumCover_setAlbumCover_thumbnail_thumbnail {
|
||||||
|
__typename: 'MediaURL'
|
||||||
|
/**
|
||||||
|
* URL for previewing the image
|
||||||
|
*/
|
||||||
|
url: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface setAlbumCover_setAlbumCover_thumbnail {
|
||||||
|
__typename: 'Media'
|
||||||
|
id: string
|
||||||
|
/**
|
||||||
|
* URL to display the media in a smaller resolution
|
||||||
|
*/
|
||||||
|
thumbnail: setAlbumCover_setAlbumCover_thumbnail_thumbnail | null
|
||||||
|
}
|
||||||
|
|
||||||
export interface setAlbumCover_setAlbumCover {
|
export interface setAlbumCover_setAlbumCover {
|
||||||
__typename: 'Album'
|
__typename: 'Album'
|
||||||
coverID: number
|
id: string
|
||||||
|
/**
|
||||||
|
* An image in this album used for previewing this album
|
||||||
|
*/
|
||||||
|
thumbnail: setAlbumCover_setAlbumCover_thumbnail | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface setAlbumCover {
|
export interface setAlbumCover {
|
||||||
|
|
Loading…
Reference in New Issue