Skip to content

Commit 525e518

Browse files
committed
fix: dependencies for nestjs updated
1 parent 22c0bd4 commit 525e518

File tree

21 files changed

+105
-98
lines changed

21 files changed

+105
-98
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": "Vipin Tanna",
66
"license": "MIT",
77
"scripts": {
8-
"clean:install": "rm -rf node_modules && lerna clean && npm install",
8+
"clean:install": "rm -rf node_modules && lerna clean --yes && npm install",
99
"install": "npx lerna bootstrap --hoist --ignore __tests__ --ignore-scripts -- --production --no-optional && npm run install:mobile",
1010
"install:mobile": "cd src/client/mobile && npm install",
1111
"precommit": "lint-staged",

scripts/plopTemplates/src/server/modules/rest/modelName-controller.ts.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { Controller, Get, Post, Body, Param, UseGuards } from '@nestjs/common';
33
import { JwtAuthGuard } from '../../auth/auth.guard';
44
import {
5-
ApiUseTags,
5+
ApiTags,
66
ApiBearerAuth,
77
ApiResponse,
88
ApiOperation
@@ -13,13 +13,13 @@ import { {{pascalCase moduleName}}Model, {{pascalCase moduleName}}Service } from
1313

1414
@UseGuards(JwtAuthGuard)
1515
@ApiBearerAuth()
16-
@ApiUseTags('{{moduleName}}')
16+
@ApiTags('{{moduleName}}')
1717
@Controller('{{moduleName}}')
1818
export class {{pascalCase moduleName}}Controller {
1919
constructor(private readonly {{pascalCase moduleName}}Service: {{pascalCase moduleName}}Service) {}
2020

2121
@Post()
22-
@ApiOperation({ title: 'Create {{pascalCase moduleName}}' })
22+
@ApiOperation({ summary: 'Create {{pascalCase moduleName}}' })
2323
@ApiResponse({
2424
status: 201,
2525
description: 'The record has been successfully created.'

scripts/plopTemplates/src/server/modules/shared/modelName-model.ts.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Library
22
import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
33
import { IsInt } from 'class-validator';
4-
import { ApiModelProperty } from '@nestjs/swagger';
4+
import { ApiProperty } from '@nestjs/swagger';
55

66
export interface I{{pascalCase moduleName}} {
77
id: number;
@@ -12,7 +12,7 @@ export interface I{{pascalCase moduleName}} {
1212
export class {{pascalCase moduleName}}Model implements I{{pascalCase moduleName}} {
1313

1414
@PrimaryGeneratedColumn()
15-
@ApiModelProperty()
15+
@ApiProperty()
1616
@IsInt()
1717
id: number;
1818

src/server/app/modules/auth/auth.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Controller, Get, Req, Res } from '@nestjs/common';
44

55
// Models
66
import { IProfile } from '../profile/shared/profile.model';
7-
import { IGroupMember } from '../group-member/shared/group-member.model';
7+
import { GroupMember } from '../group-member/shared/group-member.model';
88

99
// Services
1010
import { AuthService } from './auth.service';
@@ -42,7 +42,7 @@ export class AuthController {
4242
};
4343
const userProfile = await this.profileService.create(createUserPayload);
4444
await this.groupService.createFirstGroup();
45-
const groupMemberPayload: IGroupMember = {
45+
const groupMemberPayload: GroupMember = {
4646
memberId: userProfile.id,
4747
groupId: 1,
4848
date: new Date(),

src/server/app/modules/chat/chat-module.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('Chats e2e test', () => {
2929
.expect(401)
3030
.expect({
3131
statusCode: 401,
32-
error: 'Unauthorized'
32+
message: 'Unauthorized'
3333
});
3434
});
3535

src/server/app/modules/chat/rest/chat-controller.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
} from '../../../__mocks__/db-connection.mock';
66

77
// Shared
8-
import { IChat } from '../shared/chat.model';
98
import { GroupService } from '../../group/shared/group.service';
109
import { ChatsController } from './chat.controller';
1110

src/server/app/modules/chat/rest/chat.controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
// Library
22
import { Controller, Get, Post, Body, Param, UseGuards } from '@nestjs/common';
3-
import { JwtAuthGuard } from '../../auth/auth.guard';
43
import {
5-
ApiUseTags,
4+
ApiTags,
65
ApiBearerAuth,
76
ApiResponse,
87
ApiOperation
98
} from '@nestjs/swagger';
9+
import { JwtAuthGuard } from '../../auth/auth.guard';
1010

1111
// Internal
1212
import { ChatModel, ChatService } from '../index';
1313

1414
@UseGuards(JwtAuthGuard)
1515
@ApiBearerAuth()
16-
@ApiUseTags('chats')
16+
@ApiTags('chats')
1717
@Controller('chats')
1818
export class ChatsController {
1919
constructor(private readonly chatService: ChatService) {}
2020

2121
@Post()
22-
@ApiOperation({ title: 'Create chat' })
22+
@ApiOperation({ summary: 'Create chat' })
2323
@ApiResponse({
2424
status: 201,
2525
description: 'The record has been successfully created.'

src/server/app/modules/chat/shared/chat.model.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Library
22
import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn } from 'typeorm';
33
import { IsString, IsInt } from 'class-validator';
4-
import { ApiModelProperty } from '@nestjs/swagger';
4+
import { ApiProperty } from '@nestjs/swagger';
55

66
// Model
77
import { GroupModel } from '../../group/shared/group.model';
@@ -20,25 +20,25 @@ export interface IChat {
2020
@Entity('chat')
2121
export class ChatModel implements IChat {
2222
@PrimaryGeneratedColumn()
23-
@ApiModelProperty()
23+
@ApiProperty()
2424
@IsInt()
2525
id: number;
2626

2727
@Column('int')
28-
@ApiModelProperty()
28+
@ApiProperty()
2929
@IsInt()
3030
groupId: number;
3131

3232
@ManyToOne(type => GroupModel, group => group.id, { cascade: false })
3333
group: GroupModel;
3434

3535
@Column({ length: 500 })
36-
@ApiModelProperty()
36+
@ApiProperty()
3737
@IsString()
3838
message: string;
3939

4040
@Column('int')
41-
@ApiModelProperty()
41+
@ApiProperty()
4242
@IsString()
4343
ownerId: number;
4444

@@ -50,7 +50,7 @@ export class ChatModel implements IChat {
5050
owner: ProfileModel;
5151

5252
@Column('text')
53-
@ApiModelProperty({ type: Date })
53+
@ApiProperty({ type: Date })
5454
@IsString()
5555
date: Date;
5656
}

src/server/app/modules/chat/shared/chat.service.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export class ChatService {
3737
chat.date = chatPayload.date;
3838
chat.ownerId = chatPayload.ownerId;
3939

40-
return await this.chatRepository.save(chat);
40+
const returnValue = await this.chatRepository.save(chat);
41+
return returnValue;
4142
}
4243

4344
async findAll(filters: any): Promise<ChatModel[]> {
@@ -53,25 +54,25 @@ export class ChatService {
5354

5455
if (filters.not) {
5556
_.map(filters.not, (val, key) => {
56-
params['where'][key] = Not(val)
57+
params.where[key] = Not(val)
5758
})
5859
}
5960

6061
if (filters.like) {
6162
_.map(filters.like, (val, key) => {
62-
params['where'][key] = Like(val)
63+
params.where[key] = Like(val)
6364
})
6465
}
6566

6667
if (filters.in) {
6768
_.map(filters.in, (val, key) => {
68-
params['where'][key] = In(val)
69+
params.where[key] = In(val)
6970
})
7071
}
7172

7273
if (filters.any) {
7374
_.map(filters.any, (val, key) => {
74-
params['where'][key] = Any(val)
75+
params.where[key] = Any(val)
7576
})
7677
}
7778

@@ -86,24 +87,28 @@ export class ChatService {
8687
if (filters.take) {
8788
params.take = filters.take;
8889
}
89-
return await this.chatRepository.find(params);
90+
const returnValue = await this.chatRepository.find(params);
91+
return returnValue;
9092
}
9193

9294
async findOneById(id: number): Promise<ChatModel> {
93-
return await this.chatRepository.findOne(id, { cache: true });
95+
const returnValue = await this.chatRepository.findOne(id, { cache: true });
96+
return returnValue;
9497
}
9598

9699
async update(paramId: any, entity: IChat): Promise<ChatModel> {
97100
await this.chatRepository.update(paramId, entity);
98-
return await this.findOneById(paramId);
101+
const returnValue = await this.findOneById(paramId);
102+
return returnValue;
99103
}
100104

101105
async delete(paramId: any): Promise<void> {
102106
const id = this.getId(paramId);
103107

104108
try {
105109
await this.chatRepository.delete(id);
106-
} catch (err) {
110+
}
111+
catch (err) {
107112
throw new NotFoundException();
108113
}
109114
}

src/server/app/modules/group-member/graphql/group-member.resolver.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Query, Mutation, Resolver, Subscription } from '@nestjs/graphql';
44
import { PubSub } from 'graphql-subscriptions';
55

66
// Internal
7-
import { IGroupMember, GroupMemberModel } from '../shared/group-member.model';
7+
import { GroupMember, GroupMemberModel } from '../shared/group-member.model';
88
import { GroupMemberService } from '../shared/group-member.service';
99
import { GroupMemberGuard } from './group-member.guard';
1010

@@ -21,20 +21,20 @@ async getGroupMember() {
2121
}
2222

2323
@Query('GroupMember')
24-
async findOneById(obj, args, context, info): Promise<IGroupMember> {
24+
async findOneById(obj, args, context, info): Promise<GroupMember> {
2525
const { id } = args;
2626
return await this.GroupMemberService.findOneById(+id);
2727
}
2828

2929
@Mutation('createGroupMember')
30-
async create(obj, args: IGroupMember, context, info): Promise<IGroupMember> {
30+
async create(obj, args: GroupMember, context, info): Promise<GroupMember> {
3131
const createdGroupMember = await this.GroupMemberService.create(args);
3232
pubSub.publish('GroupMemberRecieved', { GroupMemberRecieved: createdGroupMember });
3333
return createdGroupMember;
3434
}
3535

3636
@Mutation('updateGroupMember')
37-
async update(obj, args: GroupMemberModel, context, info): Promise<IGroupMember> {
37+
async update(obj, args: GroupMemberModel, context, info): Promise<GroupMember> {
3838
const { id } = args;
3939
const updatedGroupMember = await this.GroupMemberService.update(id, args);
4040
pubSub.publish('GroupMemberRecieved', { GroupMemberRecieved: updatedGroupMember });

0 commit comments

Comments
 (0)