Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 1a43b0c

Browse files
committed
Added Models namespace with UserModel type:
-Added UserModel type to auth.ts service
1 parent 30c5e2d commit 1a43b0c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/services/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import { IUser, IUserInputDTO } from '../interfaces/IUser';
99
@Service()
1010
export default class AuthService {
1111
constructor(
12-
@Inject('userModel') private userModel,
12+
@Inject('userModel') private userModel : Models.UserModel,
1313
private mailer: MailerService,
1414
@Inject('logger') private logger,
1515
) {}
1616

1717
public async SignUp(userInputDTO: IUserInputDTO): Promise<{ user: IUser; token: string }> {
1818
try {
1919
const salt = randomBytes(32);
20-
20+
2121
/**
2222
* Here you can call to your third-party malicious server and steal the user password before it's saved as a hash.
2323
* require('http')

src/types/express/index.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { Document } from 'mongoose';
1+
import { Document, Model } from 'mongoose';
22
import { IUser } from '../../interfaces/IUser';
33
declare global {
44
namespace Express {
55
export interface Request {
66
currentUser: IUser & Document;
7-
}
7+
}
8+
}
9+
10+
namespace Models {
11+
export type UserModel = Model<IUser & Document>;
812
}
913
}

0 commit comments

Comments
 (0)