0 I’m trying to test out the apollo graphql codegen for angular. as such I created a net 5 server that hosts Grapqhl endpoint at https://localhost:8081/api/graphql/. It loads fine and no worries. I’ve then created a dummy angular project with apollo graphql in it and installed the code gen as per these two guides: https://www.graphql-code-generator.com/docs/getting-started/installation […]
0 My schema: type Mutation { createOrder(order: OrderDTO!): Order! } type Subscription { onNewOrder(minimumPrice: Float): Order @aws_subscribe(mutations: ["createOrder"]) } My Lambda resolver for createOrder mutation: exports.handler = async function (event: OrderEvent): Promise<OrderWithPrice> { const order = await orderRepository.createOrder(event); … return { …order, totalPrice: await calculateTotalPrice(order) } }; The user should pass minimumPrice parameter on subscription […]
0 I’m trying to use graphiql UI but due of Spring Security, I receive 401. What’s the way to keep /graphql endpoint secured but let /graphiql request to graphql endpoint? I’m on Spring Boot 3.1.4 and Spring For Graphql 1.2.3 If I permitall /graphql it works but I loss security. I Tried also to put […]
0 I want to return all items that are not in my arrays. Some think like below but in graphql-aws world: query( collection(db, "users"), where("id", "not-in", […likedUserIds, …dislikedUserIds]) ) I tried: const { data } = await API.graphql( graphqlOperation(getUsers, { filter: { id: { ne: […likedUserIds, …dislikedUserIds]} }, }) ); But this says "Variable ‘ne’ […]
0 I’m trying to query and return a sorted list (ABC-sort on title) where all items above a specified limit, say 10, include all columns. For everything after that index, include only metadata like id and title. Is this possible in a single GQL query or do I need one query for full data and […]
1 I’m working in a SvelteKit project and want to use gql codegen, but all queries are typed as unknown. Ts file: import { graphql } from ‘$lib/gql/index.js’; export const getPostById = graphql(` query GET_ARTICLE($id: bigint!) { articles_by_pk(id: $id) { content created_at slug updated_at title } } `); codegen.ts import type { CodegenConfig } from […]
0 If I wanted to use the lower level Postgres package from NPM called pg inside my Apollo server so I don’t have to use an ORM. Is it considered bad practice to pass the connection into the resolver directly? Example: // ./db/index.ts import { Pool } from ‘pg’ const pool = new Pool({ user: […]
0 I have some problems using graphql-codegen. Here’s the best description I can give, hope it helps with the resolution. My work environment: Windows 10 Non-admin user NodeJS 16.0.0 NPM 7.24.2 Typescript 5.2.2 Apollo server express 3.12.1 GraphQL 15.8.0 The error is obtained when (according to the documentation) I init with this command: npx graphql-code-generator […]
0 I’m a grapql newby and struggling to get the parent props from current page. In gatsby-node.js I create all wordpress pages with: createPage({ path: `${page.node.uri}`, component: PageTemplate, context: { id: page.node.id, title: page.node.title, parentId: page.node.parentId }, }) Then on the page I use following to get data from current page with: query($id: String!) { […]
0 I’m implementing a Graphql resolver for complex datatype. I try to use a data loader to avoid N+1 problem. I have a datatype with a counter. Therefore, in one graphql query I need to perform user counting multiple times for defferent types. Currently, I’m trying to combine multiple COUNT(*) queries within one SQL query. […]