|
@@ -1,3 +1,5 @@
|
|
1
|
+
|
|
2
|
+
|
1
|
3
|
# Part 1 - Domain Implementation<br>
|
2
|
4
|
* _Domain objects_ are the backbone for an application and contain the [business logic](https://en.wikipedia.org/wiki/Business_logic).
|
3
|
5
|
* Create a sub package of `java` named `domain`.
|
|
@@ -232,7 +234,20 @@ public ResponseEntity<?> deletePoll(@PathVariable Long pollId) {
|
232
|
234
|
# Part 3.1.8 - Test
|
233
|
235
|
* Restart the QuickPoll application.
|
234
|
236
|
* Ensure a JSON file with a `status` of `200` is returned by executing a `PUT` request of `http://localhost:8080/polls/1` via Postman
|
235
|
|
-
|
|
237
|
+execute a `PUT` request of
|
|
238
|
+
|
|
239
|
+```JSON
|
|
240
|
+{
|
|
241
|
+ "id": 1,
|
|
242
|
+ "question": "What's the best netflix original?",
|
|
243
|
+ "options": [
|
|
244
|
+ { "id": 1, "value": "Black Mirror" },
|
|
245
|
+ { "id": 2, "value": "Stranger Things" },
|
|
246
|
+ { "id": 3, "value": "Orange is the New Black"},
|
|
247
|
+ { "id": 4, "value": "The Get Down" }
|
|
248
|
+ ]
|
|
249
|
+}
|
|
250
|
+```
|
236
|
251
|
|
237
|
252
|
|
238
|
253
|
-
|
|
@@ -260,11 +275,14 @@ public class VoteController {
|
260
|
275
|
}
|
261
|
276
|
```
|
262
|
277
|
|
|
278
|
+# Part 3.2.1 - Testing `VoteController`
|
|
279
|
+* To test the voting capabilities, `POST` a new Vote to the `/polls/1/votes` endpoint with the option object expressed in `JSON` below.
|
|
280
|
+* On successful request execution, you will see a Location response header with value http://localhost:8080/polls/1/votes/1.
|
263
|
281
|
|
264
|
282
|
|
265
|
283
|
|
266
|
284
|
-
|
267
|
|
-# Part 3.2.1 - Modify `VoteRepository`
|
|
285
|
+# Part 3.2.2 - Modify `VoteRepository`
|
268
|
286
|
* The method `findAll` in the `VoteRepository` retrieves all votes in a Database rather than a given poll.
|
269
|
287
|
* To ensure we can get votes for a given poll, we must add the code below to our `VoteRepository`.
|
270
|
288
|
|
|
@@ -288,7 +306,7 @@ public interface VoteRepository extends CrudRepository<Vote, Long> {
|
288
|
306
|
|
289
|
307
|
|
290
|
308
|
-
|
291
|
|
-# Part 3.2.2 - Modify `VoteController`
|
|
309
|
+# Part 3.2.3 - Modify `VoteController`
|
292
|
310
|
* Create a `getAllVotes` method in the `VoteController`
|
293
|
311
|
|
294
|
312
|
|