circlesland / o-platform

GNU Affero General Public License v3.0
3 stars 1 forks source link

Store Editor #809

Closed codeho closed 2 years ago

codeho commented 2 years ago

Query all shops

query {
  shops {
    id
    name
    largeBannerUrl
    smallBannerUrl
    categories {
      name
      description
      entries {
        product {
          id
          title
          description
          pricePerUnit
        }
      }
    }
  }
}

Query single shop

query {
  shop(id:5) {
    id
    name
    largeBannerUrl
    smallBannerUrl
    categories {
      name
      description
      entries {
        product {
          id
          title
          description
          pricePerUnit
        }
      }
    }
  }
}

Add new Shop (UpsertShopDocument):

mutation {
  upsertShop(shop:{
    enabled: true
    name: "GQL-Shop"
    description: "Hier kannste GraphQL kaufen"
    largeBannerUrl: "nix"
    smallBannerUrl: "nix"
    sortOrder: 0
    ownerId: 262
    openingHours: "Von Morgens bis Abends"
    shopListingStyle: REGULAR
    productListingStyle: TILES
  }) {
    id
  }
}

Update existing Shop (UpsertShopDocument):

mutation {
  upsertShop(shop:{
    id: 5
    enabled: true
    name: "GQL-Shop"
    description: "Hier kannste GraphQL kaufen"
    largeBannerUrl: "nix"
    smallBannerUrl: "nix"
    sortOrder: 0
    ownerId: 262
    openingHours: "Immer"
    shopListingStyle: REGULAR
    productListingStyle: TILES
  }) {
    id
  }
}

Add or update categories (UpsertShopCategoriesDocument):

mutation {
  upsertShopCategories(shopCategories:[{
    id: 32
    shopId: 5
    name: "Über-Feuerwerk"
    description: "Kawumm!"
    largeBannerUrl: "nix"
    smallBannerUrl: "nix"
    sortOrder: 1
  }, {
    shopId: 6
    name: "Books"
    description: ""
    largeBannerUrl: "nix"
    smallBannerUrl: "nix"
    sortOrder: 3
  }]) {
    inserted
    updated
  }
}

Add or update CategoryEntries (UpsertShopCategoryEntriesDocument):

mutation {
  upsertShopCategoryEntries(shopCategoryEntries:[{
    shopCategoryId: 32
    productId: 122
    productVersion: 1
    sortOrder: 1
  },{
    id: 67
    shopCategoryId: 32
    productId: 158
    productVersion: 1
    sortOrder: 3
  }]) {
    inserted
    updated
  }
}
jaensen commented 2 years ago

related #814