0

How can I change the format in Grapql Type

My Queries Look like below

type GetAllProducts{
id: ID!
title: String
description: String
userId: Int
featured: Int
isFree: Boolean
isBlocked: Boolean
instantBuy: Boolean
groupsId: String
}

My Expected Result looks like below

"data": {
"getAllProducts": [
{
"id": "10112",
"images": [
"https://res.cloudinary.com/deonpjx2g/image/upload/v1655384211/fileStorage/uploads/products/10112/i9gngghwzzmy9gthckxy.png"
],
"featured": null,
"userId": 10018,
"isFree": true,
"instantBuy": false,
"isBlocked": false,
"title": "etgre",
"description": "ete",
"groupsId": null
},

My question is How to make the key image in Array Format (like image:['https://res.cloudinary.com'])

N69S
  • 16,110
  • 3
  • 22
  • 36
Manimaran
  • 405
  • 2
  • 8
  • 20

1 Answers1

1

just put it in the bracket and return the result as an array.

type GetAllProducts{
    id: ID!
    title: String
    description: String
    userId: Int
    featured: Int
    isFree: Boolean
    isBlocked: Boolean
    instantBuy: Boolean
    groupsId: String
    image: [String]
}
mostafa
  • 196
  • 4