lsst-epo / .github

Defaults
0 stars 0 forks source link

GraphQL backend-frontend interface documentation #31

Open ericdrosas87 opened 1 week ago

ericdrosas87 commented 1 week ago

User story

As a developer planning implementation of the gallery pages on the client, I need to first document the graphQL queries necessary to retrieve album data from Craft with filter and sort examples to streamline frontend development.

Definition of done

I've documented the graphQL queries as they align with the graphQL use cases.

ericdrosas87 commented 1 week ago

Example of sort by descending:

query MyQuery {
  entries {
    ... on galleryItems_galleryItem_Entry {
      id
      title
      albumAsGallery(sortByDesc: "default.DateCreated") {
        id
        approvalStatus
        owner
        size
        smartTags
        url {
          HighJPG
        }
        additional {
          AltTextEN
          AltTextES
          CaptionEN
          CaptionES
          Credit
          Description
        }
        default {
          DateCreated
          Author
          Copyright
        }
      }
    }
  }
}
ericdrosas87 commented 1 week ago

Example of sorting and filtering:

query MyQuery {
  entries {
    ... on galleryItems_galleryItem_Entry {
      id
      title
      albumAsGallery(sortByDesc: "default.DateCreated", 
        whereIn: {key: "tag", values: ["Cat", "cybercat"]}
      ) {
        id
        approvalStatus
        owner
        size
        smartTags
        url {
          HighJPG
        }
        additional {
          AltTextEN
          AltTextES
          CaptionEN
          CaptionES
          Credit
          Description
        }
        default {
          DateCreated
          Author
          Copyright
        }
        tag
      }
    }
  }
}
ericdrosas87 commented 1 week ago

Filtering is case-insensitive:

query MyQuery {
  entries {
    ... on galleryItems_galleryItem_Entry {
      id
      title
      albumAsGallery(
        sortByDesc: "default.DateCreated"
        whereIn: {key: "tag", values: ["cAt", "CYBERCAT"]}
      ) {
        id
        approvalStatus
        owner
        size
        smartTags
        url {
          HighJPG
        }
        tag
      }
    }
  }
}