typescript-express-starter 10.1.1 → 10.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/mikro-orm/src/routes/auth.route.ts +2 -2
- package/lib/mikro-orm/src/routes/users.route.ts +2 -2
- package/lib/mongoose/src/routes/auth.route.ts +2 -2
- package/lib/mongoose/src/routes/users.route.ts +2 -2
- package/lib/prisma/src/routes/auth.route.ts +2 -2
- package/lib/prisma/src/routes/users.route.ts +2 -2
- package/lib/routing-controllers/package.json +1 -1
- package/lib/routing-controllers/src/controllers/auth.controller.ts +2 -2
- package/lib/routing-controllers/src/controllers/users.controller.ts +2 -2
- package/lib/sequelize/src/routes/auth.route.ts +2 -2
- package/lib/sequelize/src/routes/users.route.ts +2 -2
- package/lib/typegoose/src/routes/auth.route.ts +2 -2
- package/lib/typegoose/src/routes/users.route.ts +2 -2
- package/lib/typeorm/src/routes/auth.route.ts +2 -2
- package/lib/typeorm/src/routes/users.route.ts +2 -2
- package/package.json +1 -1
|
@@ -15,8 +15,8 @@ export class AuthRoute implements Routes {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
private initializeRoutes() {
|
|
18
|
-
this.router.post(`${this.path}signup`, ValidationMiddleware(CreateUserDto
|
|
19
|
-
this.router.post(`${this.path}login`, ValidationMiddleware(CreateUserDto
|
|
18
|
+
this.router.post(`${this.path}signup`, ValidationMiddleware(CreateUserDto), this.auth.signUp);
|
|
19
|
+
this.router.post(`${this.path}login`, ValidationMiddleware(CreateUserDto), this.auth.logIn);
|
|
20
20
|
this.router.post(`${this.path}logout`, AuthMiddleware, this.auth.logOut);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -16,8 +16,8 @@ export class UserRoute implements Routes {
|
|
|
16
16
|
private initializeRoutes() {
|
|
17
17
|
this.router.get(`${this.path}`, this.user.getUsers);
|
|
18
18
|
this.router.get(`${this.path}/:id`, this.user.getUserById);
|
|
19
|
-
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto
|
|
20
|
-
this.router.put(`${this.path}/:id`, ValidationMiddleware(CreateUserDto,
|
|
19
|
+
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto), this.user.createUser);
|
|
20
|
+
this.router.put(`${this.path}/:id`, ValidationMiddleware(CreateUserDto, true), this.user.updateUser);
|
|
21
21
|
this.router.delete(`${this.path}/:id`, this.user.deleteUser);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -15,8 +15,8 @@ export class AuthRoute implements Routes {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
private initializeRoutes() {
|
|
18
|
-
this.router.post(`${this.path}signup`, ValidationMiddleware(CreateUserDto
|
|
19
|
-
this.router.post(`${this.path}login`, ValidationMiddleware(CreateUserDto
|
|
18
|
+
this.router.post(`${this.path}signup`, ValidationMiddleware(CreateUserDto), this.auth.signUp);
|
|
19
|
+
this.router.post(`${this.path}login`, ValidationMiddleware(CreateUserDto), this.auth.logIn);
|
|
20
20
|
this.router.post(`${this.path}logout`, AuthMiddleware, this.auth.logOut);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -16,8 +16,8 @@ export class UserRoute implements Routes {
|
|
|
16
16
|
private initializeRoutes() {
|
|
17
17
|
this.router.get(`${this.path}`, this.user.getUsers);
|
|
18
18
|
this.router.get(`${this.path}/:id`, this.user.getUserById);
|
|
19
|
-
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto
|
|
20
|
-
this.router.put(`${this.path}/:id`, ValidationMiddleware(CreateUserDto,
|
|
19
|
+
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto), this.user.createUser);
|
|
20
|
+
this.router.put(`${this.path}/:id`, ValidationMiddleware(CreateUserDto, true), this.user.updateUser);
|
|
21
21
|
this.router.delete(`${this.path}/:id`, this.user.deleteUser);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -15,8 +15,8 @@ export class AuthRoute implements Routes {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
private initializeRoutes() {
|
|
18
|
-
this.router.post(`${this.path}signup`, ValidationMiddleware(CreateUserDto
|
|
19
|
-
this.router.post(`${this.path}login`, ValidationMiddleware(CreateUserDto
|
|
18
|
+
this.router.post(`${this.path}signup`, ValidationMiddleware(CreateUserDto), this.auth.signUp);
|
|
19
|
+
this.router.post(`${this.path}login`, ValidationMiddleware(CreateUserDto), this.auth.logIn);
|
|
20
20
|
this.router.post(`${this.path}logout`, AuthMiddleware, this.auth.logOut);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -16,8 +16,8 @@ export class UserRoute implements Routes {
|
|
|
16
16
|
private initializeRoutes() {
|
|
17
17
|
this.router.get(`${this.path}`, this.user.getUsers);
|
|
18
18
|
this.router.get(`${this.path}/:id(\\d+)`, this.user.getUserById);
|
|
19
|
-
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto
|
|
20
|
-
this.router.put(`${this.path}/:id(\\d+)`, ValidationMiddleware(CreateUserDto,
|
|
19
|
+
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto), this.user.createUser);
|
|
20
|
+
this.router.put(`${this.path}/:id(\\d+)`, ValidationMiddleware(CreateUserDto, true), this.user.updateUser);
|
|
21
21
|
this.router.delete(`${this.path}/:id(\\d+)`, this.user.deleteUser);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build": "swc src -d dist --source-maps --copy-files",
|
|
11
11
|
"build:tsc": "tsc && tsc-alias",
|
|
12
12
|
"test": "jest --forceExit --detectOpenHandles",
|
|
13
|
-
"lint": "eslint --ignore-path .gitignore --ext .ts src
|
|
13
|
+
"lint": "eslint --ignore-path .gitignore --ext .ts src",
|
|
14
14
|
"lint:fix": "npm run lint -- --fix",
|
|
15
15
|
"deploy:prod": "npm run build && pm2 start ecosystem.config.js --only prod",
|
|
16
16
|
"deploy:dev": "pm2 start ecosystem.config.js --only dev"
|
|
@@ -13,7 +13,7 @@ export class AuthController {
|
|
|
13
13
|
public auth = Container.get(AuthService);
|
|
14
14
|
|
|
15
15
|
@Post('/signup')
|
|
16
|
-
@UseBefore(ValidationMiddleware(CreateUserDto
|
|
16
|
+
@UseBefore(ValidationMiddleware(CreateUserDto))
|
|
17
17
|
@HttpCode(201)
|
|
18
18
|
async signUp(@Body() userData: User) {
|
|
19
19
|
const signUpUserData: User = await this.auth.signup(userData);
|
|
@@ -21,7 +21,7 @@ export class AuthController {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@Post('/login')
|
|
24
|
-
@UseBefore(ValidationMiddleware(CreateUserDto
|
|
24
|
+
@UseBefore(ValidationMiddleware(CreateUserDto))
|
|
25
25
|
async logIn(@Res() res: Response, @Body() userData: User) {
|
|
26
26
|
const { cookie, findUser } = await this.auth.login(userData);
|
|
27
27
|
|
|
@@ -27,7 +27,7 @@ export class UserController {
|
|
|
27
27
|
|
|
28
28
|
@Post('/users')
|
|
29
29
|
@HttpCode(201)
|
|
30
|
-
@UseBefore(ValidationMiddleware(CreateUserDto
|
|
30
|
+
@UseBefore(ValidationMiddleware(CreateUserDto))
|
|
31
31
|
@OpenAPI({ summary: 'Create a new user' })
|
|
32
32
|
async createUser(@Body() userData: User) {
|
|
33
33
|
const createUserData: User = await this.user.createUser(userData);
|
|
@@ -35,7 +35,7 @@ export class UserController {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
@Put('/users/:id')
|
|
38
|
-
@UseBefore(ValidationMiddleware(CreateUserDto,
|
|
38
|
+
@UseBefore(ValidationMiddleware(CreateUserDto, true))
|
|
39
39
|
@OpenAPI({ summary: 'Update a user' })
|
|
40
40
|
async updateUser(@Param('id') userId: number, @Body() userData: User) {
|
|
41
41
|
const updateUserData: User[] = await this.user.updateUser(userId, userData);
|
|
@@ -14,8 +14,8 @@ export class AuthRoute implements Routes {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
private initializeRoutes() {
|
|
17
|
-
this.router.post('/signup', ValidationMiddleware(CreateUserDto
|
|
18
|
-
this.router.post('/login', ValidationMiddleware(CreateUserDto
|
|
17
|
+
this.router.post('/signup', ValidationMiddleware(CreateUserDto), this.auth.signUp);
|
|
18
|
+
this.router.post('/login', ValidationMiddleware(CreateUserDto), this.auth.logIn);
|
|
19
19
|
this.router.post('/logout', AuthMiddleware, this.auth.logOut);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -16,8 +16,8 @@ export class UserRoute implements Routes {
|
|
|
16
16
|
private initializeRoutes() {
|
|
17
17
|
this.router.get(`${this.path}`, this.user.getUsers);
|
|
18
18
|
this.router.get(`${this.path}/:id(\\d+)`, this.user.getUserById);
|
|
19
|
-
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto
|
|
20
|
-
this.router.put(`${this.path}/:id(\\d+)`, ValidationMiddleware(CreateUserDto,
|
|
19
|
+
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto), this.user.createUser);
|
|
20
|
+
this.router.put(`${this.path}/:id(\\d+)`, ValidationMiddleware(CreateUserDto, true), this.user.updateUser);
|
|
21
21
|
this.router.delete(`${this.path}/:id(\\d+)`, this.user.deleteUser);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -14,8 +14,8 @@ export class AuthRoute implements Routes {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
private initializeRoutes() {
|
|
17
|
-
this.router.post('/signup', ValidationMiddleware(CreateUserDto
|
|
18
|
-
this.router.post('/login', ValidationMiddleware(CreateUserDto
|
|
17
|
+
this.router.post('/signup', ValidationMiddleware(CreateUserDto), this.auth.signUp);
|
|
18
|
+
this.router.post('/login', ValidationMiddleware(CreateUserDto), this.auth.logIn);
|
|
19
19
|
this.router.post('/logout', AuthMiddleware, this.auth.logOut);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -16,8 +16,8 @@ export class UserRoute implements Routes {
|
|
|
16
16
|
private initializeRoutes() {
|
|
17
17
|
this.router.get(`${this.path}`, this.user.getUsers);
|
|
18
18
|
this.router.get(`${this.path}/:id`, this.user.getUserById);
|
|
19
|
-
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto
|
|
20
|
-
this.router.put(`${this.path}/:id`, ValidationMiddleware(CreateUserDto,
|
|
19
|
+
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto), this.user.createUser);
|
|
20
|
+
this.router.put(`${this.path}/:id`, ValidationMiddleware(CreateUserDto, true), this.user.updateUser);
|
|
21
21
|
this.router.delete(`${this.path}/:id`, this.user.deleteUser);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -14,8 +14,8 @@ export class AuthRoute implements Routes {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
private initializeRoutes() {
|
|
17
|
-
this.router.post('/signup', ValidationMiddleware(CreateUserDto
|
|
18
|
-
this.router.post('/login', ValidationMiddleware(CreateUserDto
|
|
17
|
+
this.router.post('/signup', ValidationMiddleware(CreateUserDto), this.auth.signUp);
|
|
18
|
+
this.router.post('/login', ValidationMiddleware(CreateUserDto), this.auth.logIn);
|
|
19
19
|
this.router.post('/logout', AuthMiddleware, this.auth.logOut);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -16,8 +16,8 @@ export class UserRoute implements Routes {
|
|
|
16
16
|
private initializeRoutes() {
|
|
17
17
|
this.router.get(`${this.path}`, this.user.getUsers);
|
|
18
18
|
this.router.get(`${this.path}/:id(\\d+)`, this.user.getUserById);
|
|
19
|
-
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto
|
|
20
|
-
this.router.put(`${this.path}/:id(\\d+)`, ValidationMiddleware(CreateUserDto,
|
|
19
|
+
this.router.post(`${this.path}`, ValidationMiddleware(CreateUserDto), this.user.createUser);
|
|
20
|
+
this.router.put(`${this.path}/:id(\\d+)`, ValidationMiddleware(CreateUserDto, true), this.user.updateUser);
|
|
21
21
|
this.router.delete(`${this.path}/:id(\\d+)`, this.user.deleteUser);
|
|
22
22
|
}
|
|
23
23
|
}
|