Skip to content

Commit d3756b9

Browse files
committed
chore: update to latest dependences
1 parent 3692f25 commit d3756b9

File tree

3 files changed

+20568
-9741
lines changed

3 files changed

+20568
-9741
lines changed

README.md

+30-30
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ npm install @nestjs/graphql graphql-tools graphql apollo-server-express type-gra
4848
Update the `src/app.module.ts` as follow.
4949

5050
```ts
51-
import { Module } from "@nestjs/common";
52-
import { GraphQLModule } from "@nestjs/graphql";
53-
import { AppController } from "./app.controller";
54-
import { AppService } from "./app.service";
51+
import { Module } from '@nestjs/common';
52+
import { GraphQLModule } from '@nestjs/graphql';
53+
import { AppController } from './app.controller';
54+
import { AppService } from './app.service';
5555

5656
@Module({
5757
imports: [
@@ -113,7 +113,7 @@ export class AppModule {}
113113
Create the following file `src/user/user.entity.ts`.
114114

115115
```ts
116-
import { Field, ID, ObjectType } from "@nestjs/graphql";
116+
import { Field, ID, ObjectType } from '@nestjs/graphql';
117117

118118
@ObjectType()
119119
export class User {
@@ -131,7 +131,7 @@ export class User {
131131
Create the following file `src/user/create-user.input.ts`.
132132

133133
```ts
134-
import { Field, InputType } from "@nestjs/graphql";
134+
import { Field, InputType } from '@nestjs/graphql';
135135

136136
@InputType()
137137
export class CreateUserInput {
@@ -148,16 +148,16 @@ export class CreateUserInput {
148148
Update `src/user/user.resolver.ts` and add the `users` query and `createUser` mutation.
149149

150150
```ts
151-
import { Args, Mutation, Query, Resolver } from "@nestjs/graphql";
152-
import { CreateUserInput } from "./create-user.input";
153-
import { User } from "./user.entity";
151+
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
152+
import { CreateUserInput } from './create-user.input';
153+
import { User } from './user.entity';
154154

155155
const users: User[] = [];
156156

157-
@Resolver("User")
157+
@Resolver('User')
158158
export class UserResolver {
159159
@Mutation(() => User)
160-
createUser(@Args("input") input: CreateUserInput) {
160+
createUser(@Args('input') input: CreateUserInput) {
161161
const user = new User();
162162
user.name = input.name;
163163
user.nickName = input.nickName;
@@ -240,7 +240,7 @@ Goto the GraphQL Playground - http://localhost:4000/graphql.
240240
Install the required packages.
241241

242242
```bash
243-
npm install @nestjs/typeorm typeorm mysql
243+
npm install @nestjs/typeorm typeorm mysql2
244244
```
245245

246246
Add the TypeOrmModule Configuration into `src/app.module.ts` as follow.
@@ -294,14 +294,14 @@ export class UserModule {}
294294
Update the following file `src/user/user.entity.ts`.
295295

296296
```ts
297-
import { Field, ID, ObjectType } from "@nestjs/graphql";
298-
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
297+
import { Field, ID, ObjectType } from '@nestjs/graphql';
298+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
299299

300300
@ObjectType()
301301
@Entity()
302302
export class User {
303303
@Field(() => ID)
304-
@PrimaryGeneratedColumn("uuid")
304+
@PrimaryGeneratedColumn('uuid')
305305
id: string;
306306

307307
@Field()
@@ -325,17 +325,17 @@ nest generate service user --no-spec
325325
Update the generated file `src/user/user.service.ts` as follow.
326326

327327
```ts
328-
import { Injectable } from "@nestjs/common";
329-
import { InjectRepository } from "@nestjs/typeorm";
330-
import { Repository } from "typeorm";
331-
import { CreateUserInput } from "./create-user.input";
332-
import { User } from "./user.entity";
328+
import { Injectable } from '@nestjs/common';
329+
import { InjectRepository } from '@nestjs/typeorm';
330+
import { Repository } from 'typeorm';
331+
import { CreateUserInput } from './create-user.input';
332+
import { User } from './user.entity';
333333

334334
@Injectable()
335335
export class UserService {
336336
constructor(
337337
@InjectRepository(User)
338-
private readonly userRepository: Repository<User>
338+
private readonly userRepository: Repository<User>,
339339
) {}
340340

341341
create(input: CreateUserInput) {
@@ -363,18 +363,18 @@ export class UserService {
363363
Update the following file `src/user/user.resolver.ts`.
364364

365365
```ts
366-
import { NotFoundException } from "@nestjs/common";
367-
import { Args, Mutation, Query, Resolver, ID } from "@nestjs/graphql";
368-
import { CreateUserInput } from "./create-user.input";
369-
import { User } from "./user.entity";
370-
import { UserService } from "./user.service";
366+
import { NotFoundException } from '@nestjs/common';
367+
import { Args, Mutation, Query, Resolver, ID } from '@nestjs/graphql';
368+
import { CreateUserInput } from './create-user.input';
369+
import { User } from './user.entity';
370+
import { UserService } from './user.service';
371371

372372
@Resolver(User)
373373
export class UserResolver {
374374
constructor(private readonly userService: UserService) {}
375375

376376
@Query(() => User)
377-
async user(@Args({ name: "id", type: () => ID }) id: string) {
377+
async user(@Args({ name: 'id', type: () => ID }) id: string) {
378378
const user = await this.userService.findOneById(id);
379379
if (!user) {
380380
throw new NotFoundException(id);
@@ -383,12 +383,12 @@ export class UserResolver {
383383
}
384384

385385
@Mutation(() => User)
386-
createUser(@Args("input") input: CreateUserInput) {
386+
createUser(@Args('input') input: CreateUserInput) {
387387
return this.userService.create(input);
388388
}
389389

390390
@Mutation(() => ID, { nullable: true })
391-
async deleteUser(@Args({ name: "id", type: () => ID }) id: string) {
391+
async deleteUser(@Args({ name: 'id', type: () => ID }) id: string) {
392392
return (await this.userService.delete(id)) ? id : null;
393393
}
394394

@@ -509,4 +509,4 @@ Goto the GraphQL Playground - http://localhost:4000/graphql.
509509
+--------------------------------------+------+----------+
510510
| eb777cfa-65d4-4a36-9344-5452284647e6 | Mary | NULL |
511511
+--------------------------------------+------+----------+
512-
```
512+
```

0 commit comments

Comments
 (0)