Tag: typegraphql
-
Use custom decorator to add extra fields to TypeGraphQL @ObjectType class
0 Is there a way to create a custom class-level decorator that adds two parameters to a TypeGraphQL @ObjectType class? Example: @ObjectType() @Timestampable // custom decorator class User { @Field() email: string; } The @Timestampable decorator should add the createdAt and updatedAt props to the User class and the new props should show up in…
-
Currently trying to create a graphql resolver mutation for reset Password
0 I’m facing a unusual error while accessing the reset password button. the error: Uncaught (in promise) ApolloError: error:0200009F:rsa routines::pkcs decoding error can anyone help me with this I’m trying to set the new password when i click the reset password button I’m using typegraphql, typeorm, react reactjs typescript graphql typeorm typegraphql Share Follow asked…
-
Mongoose not able to create a schema
0 Everything loaded fine before I had added a new schema. This is the resolver: import { Arg, Mutation, Query, Resolver } from "type-graphql"; import { Order } from "./order.schema"; import OrderService from "./order.service"; @Resolver() export default class OrderResolver { constructor(private orderService: OrderService) { this.orderService = new OrderService(); } @Mutation(() => Order) createOrder(@Arg("input") input: any)…
-
Jest – TypeGraphQL Invalid or Unexpected Token
0 I’m trying to create unit tests on my GraphQL API. This is the test file: import { graphql } from "graphql"; import { createSchema } from "../src/schema"; describe("BlacklistResolver", () => { it("fetches blacklist", async () => { const schema = await createSchema(); const query = ` query GetBlacklist($organisationId: String!) { getBlacklist(organisationId: $organisationId) } `;…
-
How to use mixins in TypeGraphQL to replicate “traits” and extend types?
1 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 would like to have a bunch of traits that I can add to my types to reduce the amount of…