Skip to content

Commit 79af6d0

Browse files
Swagger modularization done. Set Nodemon and Prettier watching the changes of yaml files.
1 parent fc6977b commit 79af6d0

File tree

9 files changed

+723
-720
lines changed

9 files changed

+723
-720
lines changed

.prettierignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Ignore all yaml files:
2-
*.yaml
1+
# Ignore all yaml files (Disabled):
2+
# *.yaml

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Capstone-C1SE04-TI
3+
Copyright (c) 2023 Capstone-C1SE04-TI
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### Capstone Project - Source Backend (NodeJS - MongoDB)
44

5-
### How to run this project?
5+
### Installation Guide
66

77
#### 1. Clone project
88

nodemon.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ext": ".js, .json, .yaml"
3+
}

src/swagger/admin.yaml

+89-87
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,100 @@
1+
# Online Swagger yaml file formatter: https://editor.swagger.io/
2+
13
/admin/signin:
2-
post:
3-
summary: Sign in
4-
tags:
5-
- Admin
6-
requestBody:
7-
content:
8-
application/json:
9-
schema:
10-
type: object
11-
required:
12-
- username
13-
- password
14-
properties:
15-
username:
16-
type: string
17-
password:
18-
type: string
19-
example:
20-
username: "hieuhn"
21-
password: "12345678"
22-
responses:
23-
200:
24-
description: Sign in successfully
25-
400:
26-
description: Sign in failed
4+
post:
5+
summary: Sign in
6+
tags:
7+
- Admin
8+
requestBody:
9+
content:
10+
application/json:
11+
schema:
12+
type: object
13+
required:
14+
- username
15+
- password
16+
properties:
17+
username:
18+
type: string
19+
password:
20+
type: string
21+
example:
22+
username: "hieuhn"
23+
password: "12345678"
24+
responses:
25+
200:
26+
description: Sign in successfully
27+
400:
28+
description: Sign in failed
2729

2830
/admin/signout:
29-
post:
30-
summary: Sign out
31-
tags:
32-
- Admin
33-
responses:
34-
200:
35-
description: Sign out successfully
36-
400:
37-
description: Sign out failed
31+
post:
32+
summary: Sign out
33+
tags:
34+
- Admin
35+
responses:
36+
200:
37+
description: Sign out successfully
38+
400:
39+
description: Sign out failed
3840

3941
/admin/list:
40-
get:
41-
summary: Get list of admins
42-
tags:
43-
- Admin
44-
responses:
45-
200:
46-
description: Get list of admins successfully
47-
400:
48-
description: Get list of admins failed
42+
get:
43+
summary: Get list of admins
44+
tags:
45+
- Admin
46+
responses:
47+
200:
48+
description: Get list of admins successfully
49+
400:
50+
description: Get list of admins failed
4951

5052
/admin/delete-users:
51-
post:
52-
summary: Delete users
53-
tags:
54-
- Admin
55-
requestBody:
56-
content:
57-
application/json:
58-
schema:
59-
type: object
60-
required:
61-
- ids
62-
properties:
63-
ids:
64-
type: array
65-
example:
66-
ids: [1,2,3]
67-
responses:
68-
200:
69-
description: Delete users successfully
70-
400:
71-
description: Delete users failed
53+
post:
54+
summary: Delete users
55+
tags:
56+
- Admin
57+
requestBody:
58+
content:
59+
application/json:
60+
schema:
61+
type: object
62+
required:
63+
- ids
64+
properties:
65+
ids:
66+
type: array
67+
example:
68+
ids: [1, 2, 3]
69+
responses:
70+
200:
71+
description: Delete users successfully
72+
400:
73+
description: Delete users failed
7274

7375
/admin/user/list:
74-
get:
75-
summary: Get list of users
76-
tags:
77-
- Admin
78-
responses:
79-
200:
80-
description: Get list of users successfully
81-
400:
82-
description: Get list of users failed
76+
get:
77+
summary: Get list of users
78+
tags:
79+
- Admin
80+
responses:
81+
200:
82+
description: Get list of users successfully
83+
400:
84+
description: Get list of users failed
8385

8486
/admin/user/details:
85-
get:
86-
summary: Get detail user
87-
tags:
88-
- Admin
89-
parameters:
90-
- in: query
91-
name: userId
92-
schema:
93-
type: string
94-
responses:
95-
200:
96-
description: Get detail user successfully
97-
400:
98-
description: Get detail user failed
87+
get:
88+
summary: Get detail user
89+
tags:
90+
- Admin
91+
parameters:
92+
- in: query
93+
name: userId
94+
schema:
95+
type: string
96+
responses:
97+
200:
98+
description: Get detail user successfully
99+
400:
100+
description: Get detail user failed

src/swagger/auth.yaml

+75-73
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,80 @@
1+
# Online Swagger yaml file formatter: https://editor.swagger.io/
2+
13
/auth/signup:
2-
post:
3-
summary: Sign up
4-
tags:
5-
- Authentication
6-
requestBody:
7-
content:
8-
application/json:
9-
schema:
10-
type: object
11-
required:
12-
- username
13-
- email
14-
- phoneNumber
15-
- password
16-
- confirmPassword
17-
properties:
18-
username:
19-
type: string
20-
email:
21-
type: string
22-
phoneNumber:
23-
type: string
24-
password:
25-
type: string
26-
confirmPassword:
27-
type: string
28-
example:
29-
username: "hieuhn"
30-
31-
phoneNumber: "0366871673"
32-
password: "12345678"
33-
confirmPassword: "12345678"
34-
responses:
35-
200:
36-
description: Sign up successfully
37-
400:
38-
description: Sign up failed
4+
post:
5+
summary: Sign up
6+
tags:
7+
- Authentication
8+
requestBody:
9+
content:
10+
application/json:
11+
schema:
12+
type: object
13+
required:
14+
- username
15+
- email
16+
- phoneNumber
17+
- password
18+
- confirmPassword
19+
properties:
20+
username:
21+
type: string
22+
email:
23+
type: string
24+
phoneNumber:
25+
type: string
26+
password:
27+
type: string
28+
confirmPassword:
29+
type: string
30+
example:
31+
username: "hieuhn"
32+
33+
phoneNumber: "0366871673"
34+
password: "12345678"
35+
confirmPassword: "12345678"
36+
responses:
37+
200:
38+
description: Sign up successfully
39+
400:
40+
description: Sign up failed
3941

4042
/auth/signin:
41-
post:
42-
summary: Sign in
43-
tags:
44-
- Authentication
45-
requestBody:
46-
content:
47-
application/json:
48-
schema:
49-
type: object
50-
required:
51-
- username
52-
- password
53-
properties:
54-
username:
55-
type: string
56-
password:
57-
type: string
58-
example:
59-
username: "hieuhn"
60-
password: "12345678"
61-
responses:
62-
200:
63-
description: Sign in successfully
64-
400:
65-
description: Sign in failed
66-
404:
67-
description: Not found
43+
post:
44+
summary: Sign in
45+
tags:
46+
- Authentication
47+
requestBody:
48+
content:
49+
application/json:
50+
schema:
51+
type: object
52+
required:
53+
- username
54+
- password
55+
properties:
56+
username:
57+
type: string
58+
password:
59+
type: string
60+
example:
61+
username: "hieuhn"
62+
password: "12345678"
63+
responses:
64+
200:
65+
description: Sign in successfully
66+
400:
67+
description: Sign in failed
68+
404:
69+
description: Not found
6870

6971
/auth/signout:
70-
post:
71-
summary: Sign out
72-
tags:
73-
- Authentication
74-
responses:
75-
200:
76-
description: Sign out successfully
77-
400:
78-
description: Sign out failed
72+
post:
73+
summary: Sign out
74+
tags:
75+
- Authentication
76+
responses:
77+
200:
78+
description: Sign out successfully
79+
400:
80+
description: Sign out failed

0 commit comments

Comments
 (0)