diff --git a/task-1/delete.sh b/task-1/delete.sh new file mode 100644 index 0000000..05ce47d --- /dev/null +++ b/task-1/delete.sh @@ -0,0 +1,2 @@ +#!/bin/bash +curl -X DELETE http://localhost:3000/users/11 \ No newline at end of file diff --git a/task-1/get.sh b/task-1/get.sh new file mode 100644 index 0000000..5f7767c --- /dev/null +++ b/task-1/get.sh @@ -0,0 +1,2 @@ +#!/bin/bash +curl -X GET http://localhost:3000/users/11 diff --git a/task-1/patch.sh b/task-1/patch.sh new file mode 100644 index 0000000..cb256cf --- /dev/null +++ b/task-1/patch.sh @@ -0,0 +1,4 @@ +#!/bin/bash +curl -X PATCH http://localhost:3000/users/11 \ +-H "Content-Type: application/json" \ +-d '{"email":"johndoe@example.com"}' \ No newline at end of file diff --git a/task-1/post.sh b/task-1/post.sh new file mode 100644 index 0000000..95662a1 --- /dev/null +++ b/task-1/post.sh @@ -0,0 +1,4 @@ +#!/bin/bash +curl -X POST http://localhost:3000/users \ +-H "Content-Type: application/json" \ +-d '{"name":"John Doe","email":"john.doe@example.com","password":"secret123","role":"user","active":true,"department":"Engineering"}' \ No newline at end of file diff --git a/task-2/services.js b/task-2/services.js index 2126969..f92f183 100644 --- a/task-2/services.js +++ b/task-2/services.js @@ -15,7 +15,13 @@ const API_BASE_URL = 'https://api.nobelprize.org/2.1'; * @param {Function} onError - Callback for fetch errors */ export function fetchNobelPrizes(filters = {}, onSuccess, onError) { - let url = ''; // TODO Construct the full URL with query parameters; + let url = 'https://api.nobelprize.org/2.1/nobelPrizes?offset=10&limit=20&sort=desc'; // TODO Construct the full URL with query parameters; + if (filters.year && filters.year !== 'all') { + url += `&nobelPrizeYear=${filters.year}`; + } + if (filters.category && filters.category !== 'all'){ + url += `&nobelPrizeCategory=${filters.category}`; + } fetchData(url, onSuccess, onError); }