Questions tagged [typegraphql]
TypeGraphQL is a library that provides you some decorators, and you can use these decorators to define your parts of schema.
319
questions
1
vote
0
answers
20
views
Getting error argument of type '{ username: string; password: string; }' is not assignable to parameter of type 'RequiredEntityData<User>'
My project working fine but I'm keep getting red underline at this line of code:
{
username: options.username,
password: hasedPassword
}
When I hover it, it said:
Argument of type '{ username: ...
0
votes
1
answer
39
views
Why the data appears on mutation, but does not appear on query?
I have students and they can enroll on different courses. When I create a new student, I have courses ids (array) as an argument to get the course information by the id. I am passing the information ...
-1
votes
1
answer
39
views
Type 'Promise<Course>[]' is not assignable to type 'Course[]'
I want to create a many-to-many relationship between two objects - courses and students. I use MongoDB. When creating a new student I want to be able to add the courses. In createStudent mutation I am ...
0
votes
0
answers
20
views
input type inheritance with typegraphql
With a commercial application, I want to accept a payment details from user. That payment could be either credit card details or bank account details.I am using typegraphql.
I have a Payment interface ...
0
votes
0
answers
18
views
How to get User Access Control in NestJs Guard for authorizations?
I am new in @Nestjs. I am using graphql in @Nestjs. I have a question in this field. How can I access UserSchema or UserModel from AuthGuard.ts?
Here in AuthGuard.ts I am checking request context ...
0
votes
0
answers
7
views
Problems to filter with GRAPHQL (strapi)
I have a footer type:
type Footer {
id: ID!
created_at: DateTime!
updated_at: DateTime!
name: String
title: String
channel: Channel
footerMenu: [ComponentFooterFooterItem]
...
0
votes
1
answer
28
views
Graphql NestJS: Undefined type error. Make sure you are providing an explicit type
Could see exception with the below type definition.
UnhandledPromiseRejectionWarning: Error: Undefined type error. Make sure you are providing an explicit type for the "rows" of the "...
3
votes
1
answer
68
views
Using Uint8Array as an Argument for mutation in typegraphql
I need to save a public key to my postgres database from graphql. Using a Uint8Array seems the best option to save this with (let me know if you have a better suggestion). Therefore I have the entity:
...
0
votes
0
answers
13
views
Add rest apis with multiple enpoints in node-graphql-apollo server
I am using graphql with apollo-server-express.
I am having some queries and mutations that are working fine like below on port 4000
http://localhost:4000 and all the queries and mutations are there
...
0
votes
0
answers
8
views
how I can add a custom scalar with different formats in type-graphql to generate GraphQL schema
I tried to generate a GraphQl schema using type-graphql lib I want the field value to accept any data type but it only takes a string. I have created a custom scalar with the name SettingValueScalar ...
0
votes
1
answer
20
views
Context is empty in GraphQL middleware
I'm sending from frontend authorization token in headers and then I want to check validity of this token in some endpoints using middleware and context, but context is always empty.
I'm using type-...
0
votes
1
answer
31
views
How can I create a TypeORM Postgres connection with Heroku using Typegraphql?
I want to create a TypeORM Postgres connection with Heroku using Typegraphql, but I receiving the following error message:
'createConnection' is deprecated.ts(6385)
globals.d.ts(34, 4): The ...
1
vote
0
answers
22
views
How to use mixins in TypeGraphQL to replicate "traits" and extend types?
I am trying to replicate the idea of "traits" from PHP into TypeGraphQL types. However, between abstract classes and mixins, I got a bit lost and can't figure out what even to google....
I ...
0
votes
0
answers
26
views
Connection closed before full header was received in flutter app with apollo server as backend
Created an flutter app with typegraphql and apollo server in backend. Application works fine. But at random times it throws an error,
OperationException(linkException: ServerException(...
0
votes
0
answers
12
views
Typegraphql resolver for existing class
How can I write a resolver in typegraphql for a class I can not edit myself?
Normally I would have the situation that I write a class e.g.
@ObjectType()
export class User {
@Field()
f_name!: ...
1
vote
2
answers
66
views
I have a graphQL query and wanted to convert it GraphQL Transformer v1 to v2
I was working on an existing project using amplify with GraphQl API.
The query shows issues with @Key as Your GraphQL Schema is using "@key" directive from an older version of the GraphQL ...
0
votes
0
answers
61
views
TypeORM EntityMetadataNotFoundError: No metadata for \"Score\" was found
My project has 2 seperate connection datasources. One is to a readonly mysql database, the other is a postgres database.
Everything on the mysql database works fine. But I'm having issues with the ...
0
votes
0
answers
35
views
GraphQL subscription isn't triggered after PubSub publish
I'm trying to create a basic subscriptions system using WebSockets, TypeGraphQL and Apollo Server. I've created the WS server and it seems to work correctly.
import express from 'express'
import cors ...
0
votes
0
answers
16
views
How to do GraphQL query in NestJs like in WikiJs?
I found this query in Graphql wikijs.
UserQuery: {
async list(obj, args, context, info) {
return WIKI.models.users.query()
.select('id', 'email', 'name', 'providerKey', 'isSystem', '...
0
votes
0
answers
48
views
How to configure custom key for data that has composite primary key in @urql/exchange-graphcache cacheExchange
On the frontend I have a Cart, it has buttons to call a GraphQL mutation to increase or decrease the quantity of a product. The mutation worked as expected, except for one thing is that the quantity ...
0
votes
1
answer
93
views
How to create a many-to-many relationship type-graphql typeorm
I'm working on a project using type-graphql and typeorm. I have two entities: Meals and Ingredients, and I wish to create a many to many relationship between these two entities.
I have added the ...
1
vote
0
answers
40
views
Typegoose, graphql, how to update fields with object types
I have a user schema:
@ObjectType()
export class User {
@Field(() => String)
_id: string;
@Field(() => String)
@prop({ required: true })
userName: string;
@Field(() => UserType)
...
0
votes
0
answers
45
views
TypeGraphql graphql upload import cannot be found
Goal
I'm making a project with TypeGraphql and i want to implement user profile picture.
Problem
When i try to import:
import { GraphQLUpload, FileUpload } from "graphql-upload";
docker ...
0
votes
0
answers
31
views
Graphql prisma string replace
I have graphql prisma api. Currently there is lyric field in Track table.
"Let it [Am]be, let it [C/G]be, let it [F]be, let it [C]be"
if I search using contain in graphql like example "...
0
votes
0
answers
50
views
Resolving a Graphql query from different data sources
I have a graphql server I've created using ApolloServer and Type-Graphql.
I have two types defined on my graphql server:
User{
id:string;
name:string
email:string;
...
}
UserPrefrences{
...
0
votes
0
answers
20
views
Understanding React-Relay Connections in the Context of Type-GraphQL
The below code excerpt comes from the React-Relay docs on Rendering Connections. I am wondering if someone could provide me with an example of what the underlying schema definition (using `type-...
0
votes
1
answer
23
views
Graphql Prisma OR operator not working for two columns
I tried to query track records which either title or lyric contain "cat". But only record return if both title and lyric have cat. May I know how to query by OR operator.
Query
query Tracks($...
0
votes
0
answers
11
views
How do you mock a join in typegraph-ql?
Say you have a join between user
@Field(() => [Transaction])
@OneToMany(() => Transaction, (transaction) => transaction.user)
transactions!: Transaction[];
and transaction
@Field(() =...
0
votes
2
answers
36
views
graphql prisma query get artists who has song track
I have three table, artist, album and track. I want to query artist who have at least one song track.
Here is my graphql prisma schema. May I know how write the query?
generator client {
provider = &...
0
votes
0
answers
94
views
Graphql query by count
I have grphql query with count for detail table.
Artist
Album
Track
Here is my query
query Artists($take: Int, $skip: Int, $orderBy: [ArtistOrderByWithRelationInput!]) {
artists(take: $take, skip: $...
0
votes
1
answer
174
views
Error: Cannot find module 'src/entities/Post'
so i am creating a graphQL server using type-graph and mikro-orm
everything was fine till i got this error that says => Error: Cannot find module 'src/entities/Post' and that module exists as you ...
0
votes
1
answer
25
views
How to get authorization from request headers in custom TypeGraphQL AuthChecker
I'm making a custom AuthChecker for a school project using TypeORM/GraphQL/ApolloServer, and I'm given a template for an AuthChecker looking like this:
export const authChecker: AuthChecker<Context&...
0
votes
0
answers
9
views
How do you write unit tests for field type GraphQLJSON for object types in @nestjs/graphql [duplicate]
I'm attempting to write unit tests for classes which model API responses for nestjs/graphql but I'm running into issues. Basically I'm not sure how to unit test fields that are decorated with @Field((...
0
votes
1
answer
30
views
GraohQL: how to create a query parameter constraint
How do I validate a GraphQL query parameter. I want the bookings query not to receive negative values on page parameter.
I am using these modules for typescript types generation, is it possible to ...
1
vote
1
answer
21
views
Type mismatch does NOT create error during "compilation" time
I would like to understand way there are no errors in this resolver even where there is a type mismatch.
I am saying that the Query should return an Int but it actually returns a String.
If I execute ...
0
votes
0
answers
76
views
Access Postgres table data in Apollo GraphQL environment via Python
I am trying to access data from a Postgres table using Python in a GraphQL API via ApolloGraphQL. But the query returns empty result. Strangely it is been returned in Logs as seen because I had a ...
0
votes
1
answer
125
views
Mongoose: Property 'forEach' does not exist on type 'ObjectId | [BaseAction]'
I just get this error.
Property 'forEach' does not exist on type 'ObjectId | [BaseAction]'.
The error is on the last line, the code is :
ServiceModel.findOne({name: "slack"}).populate({
...
0
votes
0
answers
68
views
How to use pass TypeGraphQL resolver into buildSubgraphSchema when federating a GraphQL service
I am trying to federate a service but having no luck passing through the schema and resolvers to the buildSubgraphSchema method in the Apollo constructor. Is this even possible?
1
vote
2
answers
272
views
Property is missing in type prisma/client/index, when adding a custom type to Prisma schema
My custom type "Observations" doesn't seem to be generating correctly as I am getting this error message
Property 'observations' is missing in type
'import("/Users/thomasandrew/...
1
vote
1
answer
64
views
How can I add item to many-to-many relationed table with TypeORM
I need help with a many-to-many problem with typeorm, typegraphql. I tried many ways to add items to the M-T-M relation table but couldn't do it. I followed TypeORM documentation but I think I am ...
2
votes
0
answers
201
views
How to get the schema of an Apollo federation without running the whole code?
I want to implement operational and composition checks on my federated graph. To do this, I need either a schema file or I need to pipe the results of the graph introspection query into the rover ...
0
votes
1
answer
33
views
GrahpQL Mutation not returning value of FieldResolver
I'm using TypeGraphQL and Typegoose to have and API for category trees stored by a reference to the parent. One FieldResolver of it is returning an array of ancestors (using graphLookup).
@...
0
votes
0
answers
70
views
GraphQL mutation not returning a newly registered user that is successfully create in postgresql
I am writing a graphql mutation for registering new users. This mutation should return an array of errors or a User object. For some reason when there are errors. The mutation is returning them. But ...
0
votes
1
answer
42
views
TypeGraphQL - Not able to match all the interfaces of a union
Summary
The goal is to declare the return type of a mutation using a union in order to express multiple states: Success and user errors
Being able to select concrete types according to the use cases:
...
0
votes
1
answer
160
views
typegraphql-prisma: Unable to infer GraphQL type from TypeScript reflection system
I've got an application (remix-run) with prisma and mongodb. I would like to use typescript-prisma to generate graphql resolvers. In my schema.prisma, I have created a new generator
generator ...
1
vote
0
answers
31
views
Converting graphql schema to sql schema
Im trying to make a character creation system and am a little stumped on some logic/code in order to make it work.
At a high level, the model would look something like this:
Player {
id: ID!
name: ...
0
votes
0
answers
13
views
How to have each element of an object keep its type without naming them implicitly in Typescript (typegoose,typegraphql)
export interface ObjectInterface{
[key: string]: string | number | string[];
}
this is a interface I'm using, imported to the function(given below) from types.ts
the code below is for a function ...
0
votes
0
answers
717
views
Array of String Data Type In GraphQL
I'm just learning GraphQL, but I'm confused with GraphQL schema. I have a GraphQL schema which has a string array data type
My GraphQL Schema like this:
type GetRecommender {
resourceId: Int!
...
0
votes
1
answer
145
views
Why can't TypeGraphQL determine the type of a generic?
I'm trying to define generic type definitions for building connections and edges in GraphQL. I'm keeping with the Relay spec, except that I'm also including the conventional nodes connection property ...
1
vote
1
answer
87
views
TypeORM One-To-One relation foreign key not working with TypeGraphQL
I would like to migrate some endpoints for a REST API developed in NodeJs to GraphQL endpoints.
TypeOrm has been used for the database communication, so I figured out that there is a library type-...