Skip to content

Commit d9ec121

Browse files
committed
feat: add role json swagger
1 parent e09d667 commit d9ec121

4 files changed

Lines changed: 217 additions & 26 deletions

File tree

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
NODE_ENV=development
22

3-
APP_NAME=Morphy
3+
APP_NAME=Backend
44
APP_PORT=8000
55
APP_URL=http://localhost:8000
66
APP_DEFAULT_PASS=yourpassword

public/swagger/routes/default.json

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,34 @@
11
{
22
"/": {
33
"get": {
4-
"tags": [
5-
"Default"
6-
],
4+
"tags": ["Default"],
75
"summary": "Default Route",
86
"security": [
97
{
108
"auth_token": []
119
}
1210
],
1311
"responses": {
14-
"200": {
15-
"description": "Find all records"
16-
},
17-
"400": {
18-
"description": "Something went wrong"
19-
},
20-
"500": {
21-
"description": "Internal Server Error"
22-
}
12+
"200": { "description": "Find all records" },
13+
"400": { "description": "Something went wrong" },
14+
"500": { "description": "Internal Server Error" }
2315
}
2416
}
2517
},
2618
"/health": {
2719
"get": {
28-
"tags": [
29-
"Default"
30-
],
20+
"tags": ["Default"],
3121
"summary": "Default Route",
3222
"security": [
3323
{
3424
"auth_token": []
3525
}
3626
],
3727
"responses": {
38-
"200": {
39-
"description": "Find all records"
40-
},
41-
"400": {
42-
"description": "Something went wrong"
43-
},
44-
"500": {
45-
"description": "Internal Server Error"
46-
}
28+
"200": { "description": "Find all records" },
29+
"400": { "description": "Something went wrong" },
30+
"500": { "description": "Internal Server Error" }
4731
}
4832
}
4933
}
50-
}
34+
}

public/swagger/routes/role.json

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
{
2+
"/v1/role": {
3+
"get": {
4+
"tags": ["Role"],
5+
"summary": "Get All Role",
6+
"security": [{ "auth_token": [] }],
7+
"parameters": [
8+
{ "$ref": "#/components/parameters/page" },
9+
{ "$ref": "#/components/parameters/pageSize" },
10+
{ "$ref": "#/components/parameters/filtered" },
11+
{ "$ref": "#/components/parameters/sorted" }
12+
],
13+
"responses": {
14+
"200": { "description": "Find all records" },
15+
"400": { "description": "Something went wrong" },
16+
"500": { "description": "Internal Server Error" }
17+
}
18+
},
19+
"post": {
20+
"tags": ["Role"],
21+
"summary": "Create New Role",
22+
"security": [{ "auth_token": [] }],
23+
"requestBody": {
24+
"required": true,
25+
"content": {
26+
"application/x-www-form-urlencoded": {
27+
"schema": {
28+
"type": "object",
29+
"properties": {
30+
"name": {
31+
"type": "string"
32+
}
33+
},
34+
"required": ["name"]
35+
}
36+
}
37+
}
38+
},
39+
"responses": {
40+
"201": { "description": "Create new records" },
41+
"400": { "description": "Something went wrong" },
42+
"422": { "description": "Unprocessable Entity" },
43+
"500": { "description": "Internal Server Error" }
44+
}
45+
}
46+
},
47+
"/v1/role/{id}": {
48+
"get": {
49+
"tags": ["Role"],
50+
"summary": "Get Role By Id",
51+
"security": [{ "auth_token": [] }],
52+
"parameters": [
53+
{
54+
"in": "path",
55+
"name": "id",
56+
"required": true,
57+
"schema": {
58+
"type": "string"
59+
},
60+
"description": "Role Id"
61+
}
62+
],
63+
"responses": {
64+
"200": { "description": "Get record by id" },
65+
"400": { "description": "Something went wrong" },
66+
"404": { "description": "Record not found" },
67+
"500": { "description": "Internal Server Error" }
68+
}
69+
},
70+
"put": {
71+
"tags": ["Role"],
72+
"summary": "Update Data Role",
73+
"security": [{ "auth_token": [] }],
74+
"parameters": [
75+
{
76+
"in": "path",
77+
"name": "id",
78+
"required": true,
79+
"schema": {
80+
"type": "string"
81+
},
82+
"description": "Role Id"
83+
}
84+
],
85+
"requestBody": {
86+
"required": true,
87+
"content": {
88+
"application/x-www-form-urlencoded": {
89+
"schema": {
90+
"type": "object",
91+
"properties": {
92+
"name": {
93+
"type": "string"
94+
}
95+
},
96+
"required": ["name"]
97+
}
98+
}
99+
}
100+
},
101+
"responses": {
102+
"200": { "description": "Update record by id" },
103+
"400": { "description": "Something went wrong" },
104+
"404": { "description": "Record not found" },
105+
"422": { "description": "Unprocessable Entity" },
106+
"500": { "description": "Internal Server Error" }
107+
}
108+
}
109+
},
110+
"/v1/role/restore/{id}": {
111+
"put": {
112+
"tags": ["Role"],
113+
"summary": "Restore Role By Id",
114+
"security": [{ "auth_token": [] }],
115+
"parameters": [
116+
{
117+
"in": "path",
118+
"name": "id",
119+
"required": true,
120+
"schema": {
121+
"type": "string"
122+
},
123+
"description": "Role Id"
124+
}
125+
],
126+
"responses": {
127+
"200": { "description": "Restore record by id" },
128+
"400": { "description": "Something went wrong" },
129+
"404": { "description": "Record not found" },
130+
"500": { "description": "Internal Server Error" }
131+
}
132+
}
133+
},
134+
"/v1/role/soft-delete/{id}": {
135+
"delete": {
136+
"tags": ["Role"],
137+
"summary": "Soft Delete Role By Id",
138+
"security": [{ "auth_token": [] }],
139+
"parameters": [
140+
{
141+
"in": "path",
142+
"name": "id",
143+
"required": true,
144+
"schema": {
145+
"type": "string"
146+
},
147+
"description": "Role Id"
148+
}
149+
],
150+
"responses": {
151+
"200": { "description": "Soft Delete record by id" },
152+
"400": { "description": "Something went wrong" },
153+
"404": { "description": "Record not found" },
154+
"500": { "description": "Internal Server Error" }
155+
}
156+
}
157+
},
158+
"/v1/role/force-delete/{id}": {
159+
"delete": {
160+
"tags": ["Role"],
161+
"summary": "Force Delete Role By Id ( Forever )",
162+
"security": [{ "auth_token": [] }],
163+
"parameters": [
164+
{
165+
"in": "path",
166+
"name": "id",
167+
"required": true,
168+
"schema": {
169+
"type": "string"
170+
},
171+
"description": "Role Id"
172+
}
173+
],
174+
"responses": {
175+
"200": { "description": "Force Delete record by id ( Forever )" },
176+
"400": { "description": "Something went wrong" },
177+
"404": { "description": "Record not found" },
178+
"500": { "description": "Internal Server Error" }
179+
}
180+
}
181+
}
182+
}

public/swagger/schema/role.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"Role": {
3+
"type": "object",
4+
"properties": {
5+
"id": {
6+
"type": "string"
7+
},
8+
"name": {
9+
"type": "string"
10+
},
11+
"created_at": {
12+
"type": "string",
13+
"format": "date"
14+
},
15+
"updated_at": {
16+
"type": "string",
17+
"format": "date"
18+
},
19+
"deleted_at": {
20+
"type": "string",
21+
"format": "date"
22+
}
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)