diff --git a/README.md b/README.md index 5995997..f2bed7c 100644 --- a/README.md +++ b/README.md @@ -95,10 +95,10 @@ Note: Certain mutations and queries may require the user to be authenticated and ```graphql mutation { - register(input: { + register(registerInput: { name: "John Doe", email: "johndoe@example.com", - password: "password123" + password: "pass123" }) { id name @@ -113,9 +113,9 @@ mutation { ```graphql mutation { - login(input: { + login(loginnput: { email: "johndoe@example.com", - password: "password123" + password: "pass123" }) { accessToken message diff --git a/src/components/auth/auth.service.ts b/src/components/auth/auth.service.ts index 5bab6f4..ee185f4 100644 --- a/src/components/auth/auth.service.ts +++ b/src/components/auth/auth.service.ts @@ -21,7 +21,7 @@ export class AuthService { } private createJwt(payload: string | Buffer | Record) { - return this.jwtService.sign(payload); + return this.jwtService.sign({ id: payload }); } public async register({ email, name, password }: RegisterInput) { diff --git a/src/components/product/product.repo.ts b/src/components/product/product.repo.ts index c46930f..aab55f9 100644 --- a/src/components/product/product.repo.ts +++ b/src/components/product/product.repo.ts @@ -125,7 +125,7 @@ class ProductRepo { .limit(limit) .skip((page - 1) * limit); - const productsCount = await this.productModel.find().count(); + const productsCount = await this.productModel.countDocuments(); return { products,