Skip to content

Commit 2064247

Browse files
committed
README
1 parent 4d141dd commit 2064247

File tree

2 files changed

+270
-3
lines changed

2 files changed

+270
-3
lines changed

README.md

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,271 @@ https://mastercheft2-a8afeadpdvbxbshj.canadacentral-01.azurewebsites.net/swagger
3535

3636
![Evidencia azure](/docs/azure.png)
3737

38+
---
39+
40+
# Ejemplos de request y response por endpoint
41+
42+
## Crear una receta:
43+
44+
Request:
45+
46+
```bash
47+
48+
"id": "RE001",
49+
"title": "Filet Mignon",
50+
"ingridients": [
51+
"Beef",
52+
"Butter",
53+
"Salt",
54+
"Pepper"
55+
],
56+
"steps": [
57+
"Season the meat with salt and pepper.",
58+
"Heat butter in a pan.",
59+
"Cook the meat for 3 minutes per side.",
60+
],
61+
"season": 1,
62+
"authorChef": {
63+
"id": "CH001",
64+
"name": "Juan Perez",
65+
"role": "CONTESTANT"
66+
}
67+
}
68+
69+
```
70+
71+
72+
Response:
73+
74+
```bash
75+
{
76+
"id": "RE001",
77+
"title": "Filet Mignon",
78+
"ingridients": [
79+
"400g of beef tenderloin",
80+
"15g of butter",
81+
"Salt",
82+
"Pepper"
83+
],
84+
"steps": [
85+
"Season the meat with salt and pepper.",
86+
"Heat butter in a pan.",
87+
"Cook the meat for 3 minutes per side.",
88+
],
89+
"season": 1,
90+
"authorChef": {
91+
"id": "CH001",
92+
"name": "Juan Perez",
93+
"role": "CONTESTANT"
94+
}
95+
}
96+
```
97+
98+
## Actualizar una receta:
99+
100+
Request:
101+
102+
```bash
103+
{
104+
"id": "RE001",
105+
"title": "Filet Mignon Deluxe",
106+
"ingridients": [
107+
"Beef chata",
108+
"Butter",
109+
"Salt",
110+
"Pepper"
111+
],
112+
"steps": [
113+
"Marinate the meat and put salt, and pepper.",
114+
"Cook in butter for 400 minutes per side.",
115+
"Serve with a sauce of your choice."
116+
],
117+
"season": 2,
118+
"authorChef": {
119+
"id": "CH001",
120+
"name": "Juan Perez",
121+
"role": "CONTESTANT"
122+
}
123+
}
124+
125+
```
126+
127+
128+
Response:
129+
130+
```bash
131+
{
132+
"id": "RE001",
133+
"title": "Filet Mignon Deluxe",
134+
"ingridients": [
135+
"400g of beef chata",
136+
"20g of butter",
137+
"Salt",
138+
"Pepper"
139+
],
140+
"steps": [
141+
"Marinate the meat and put salt, and pepper.",
142+
"Cook in butter for 400 minutes per side.",
143+
"Serve with a sauce of your choice."
144+
],
145+
"season": 2,
146+
"authorChef": {
147+
"id": "CH001",
148+
"name": "Juan Perez",
149+
"role": "CONTESTANT"
150+
}
151+
}
152+
```
153+
154+
155+
## Eliminar receta
156+
157+
Request:
158+
159+
```bash
160+
DELETE /recipes/RE001
161+
```
162+
163+
Response:
164+
165+
```bash
166+
204 No Content
167+
```
168+
169+
## Obtener todas las recetas
170+
171+
Request:
172+
173+
```bash
174+
GET /recipes
175+
176+
```
177+
178+
179+
Response:
180+
181+
```bash
182+
[
183+
{
184+
"id": "RE001",
185+
"title": "Filet Mignon",
186+
"ingridients": ["Beef", "Butter", "Salt"],
187+
"steps": ["Season", "Cook", "Serve"],
188+
"season": 1,
189+
"authorChef": {
190+
"id": "CH001",
191+
"name": "Juan Perez",
192+
"role": "CONTESTANT"
193+
}
194+
}
195+
]
196+
```
197+
198+
## Obtener todas las por id
199+
200+
Request:
201+
202+
```bash
203+
GET /recipes/RE001
204+
205+
```
206+
207+
208+
Response:
209+
210+
```bash
211+
[
212+
{
213+
"id": "RE001",
214+
"title": "Filet Mignon",
215+
"ingridients": ["Beef", "Butter", "Salt"],
216+
"steps": ["Season", "Cook", "Serve"],
217+
"season": 1,
218+
"authorChef": {
219+
"id": "CH001",
220+
"name": "Juan Perez",
221+
"role": "CONTESTANT"
222+
}
223+
}
224+
]
225+
```
226+
227+
## Obtener todas las recetas por participante
228+
229+
Request:
230+
231+
```bash
232+
GET /recipes/contestants
233+
234+
```
235+
236+
237+
Response:
238+
239+
```bash
240+
[
241+
{
242+
"id": "RE001",
243+
"title": "Filet Mignon",
244+
"ingridients": ["Beef", "Butter", "Salt"],
245+
"steps": ["Season", "Cook", "Serve"],
246+
"season": 1,
247+
"authorChef": {
248+
"id": "CH001",
249+
"name": "Juan Perez",
250+
"role": "CONTESTANT"
251+
}
252+
}
253+
]
254+
```
255+
256+
## Obtener todas las recetas por temporada
257+
258+
Request:
259+
260+
```bash
261+
GET /recipes/season/1
262+
263+
```
264+
265+
266+
Response:
267+
268+
```bash
269+
[
270+
{
271+
"id": "RE001",
272+
"title": "Filet Mignon",
273+
"season": 1,
274+
}
275+
}
276+
]
277+
```
278+
279+
## Obtener recetas por ingrediente
280+
281+
Request:
282+
283+
```bash
284+
GET /recipes/ingridient/Butter
285+
286+
```
287+
288+
289+
Response:
290+
291+
```bash
292+
[
293+
{
294+
"id": "RE001",
295+
"title": "Filet Mignon",
296+
"ingridients": ["Beef", "Butter", "Salt"],
297+
"steps": ["Season", "Cook", "Serve"],
298+
"authorChef": {
299+
"id": "CH001",
300+
"name": "Juan Perez",
301+
"role": "CONTESTANT"
302+
}
303+
}
304+
]
38305

src/main/java/com/dosw/MasterChefAPI/controller/ChefController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ public class ChefController {
2727

2828

2929
@PostMapping("")
30-
public ResponseEntity<ChefResponseDTO> createRecipe(
30+
public ResponseEntity<ChefResponseDTO> createChef(
3131
@Valid @RequestBody ChefRequestDTO dto) {
3232
ChefResponseDTO created = chefService.createChef(dto);
3333

3434
return ResponseEntity.status(HttpStatus.CREATED).body(created);
3535
}
3636

3737
@PutMapping("/{id}")
38-
public ResponseEntity<ChefResponseDTO> updatedRecipe(
38+
public ResponseEntity<ChefResponseDTO> updateChef(
3939
@Parameter(description = "Chef to be updated", required = true) @PathVariable String id,
4040
@Valid @RequestBody ChefRequestDTO dto) {
4141
ChefResponseDTO studentUpdated = chefService.updateChef(id, dto);
@@ -44,7 +44,7 @@ public ResponseEntity<ChefResponseDTO> updatedRecipe(
4444
}
4545

4646
@DeleteMapping("/{id}")
47-
public ResponseEntity<Void> deleteRecipe(
47+
public ResponseEntity<Void> deleteChef(
4848
@Parameter(description = "Chef to be deleted", required = true) @PathVariable String id) {
4949
chefService.deleteChef(id);
5050

0 commit comments

Comments
 (0)