From f849e9c8ec084c4d2b15003aba57446a56836ae1 Mon Sep 17 00:00:00 2001 From: Miuroro Date: Wed, 11 Mar 2026 18:20:38 +0100 Subject: [PATCH 1/2] constructed the full URL and conditions in services.js function --- task-1/server/users.json | 22 ++++++++++++++++++++++ task-2/services.js | 8 +++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/task-1/server/users.json b/task-1/server/users.json index fc8d197..2e311b6 100644 --- a/task-1/server/users.json +++ b/task-1/server/users.json @@ -109,6 +109,28 @@ "createdAt": "2024-09-14T12:30:00Z", "lastLogin": "2026-02-03T13:00:00Z", "department": "Engineering" + }, + { + "id": 12, + "name": "moon alsqyan", + "email": "example@example.com", + "password": "$2b$10$8QO7/kr6VpXNvIeyBv7ZkezYjCZw.PBXW8NHJKi/wq5jArd/ngHpO", + "role": "user", + "active": true, + "createdAt": "2026-03-11T15:43:05.750Z", + "lastLogin": null, + "department": "backend div" + }, + { + "id": 13, + "name": "monerh alsqyan", + "email": "test@example.com", + "password": "$2b$10$NbnuWQTVmYwUl7EbJHQig.ZTIsqt.n..jWJ8dAMu5YkuGC350Zkfi", + "role": "user", + "active": true, + "createdAt": "2026-03-11T15:49:50.356Z", + "lastLogin": null, + "department": "backend" } ] } \ 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); } From 00aceeda26e6797e6f1293cc8911c102ac278981 Mon Sep 17 00:00:00 2001 From: Miuroro Date: Wed, 11 Mar 2026 19:54:01 +0100 Subject: [PATCH 2/2] added curl commands in task-1 --- task-1/delete.sh | 2 ++ task-1/get.sh | 2 ++ task-1/patch.sh | 4 ++++ task-1/post.sh | 4 ++++ task-1/server/users.json | 22 ---------------------- 5 files changed, 12 insertions(+), 22 deletions(-) create mode 100644 task-1/delete.sh create mode 100644 task-1/get.sh create mode 100644 task-1/patch.sh create mode 100644 task-1/post.sh 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-1/server/users.json b/task-1/server/users.json index 2e311b6..fc8d197 100644 --- a/task-1/server/users.json +++ b/task-1/server/users.json @@ -109,28 +109,6 @@ "createdAt": "2024-09-14T12:30:00Z", "lastLogin": "2026-02-03T13:00:00Z", "department": "Engineering" - }, - { - "id": 12, - "name": "moon alsqyan", - "email": "example@example.com", - "password": "$2b$10$8QO7/kr6VpXNvIeyBv7ZkezYjCZw.PBXW8NHJKi/wq5jArd/ngHpO", - "role": "user", - "active": true, - "createdAt": "2026-03-11T15:43:05.750Z", - "lastLogin": null, - "department": "backend div" - }, - { - "id": 13, - "name": "monerh alsqyan", - "email": "test@example.com", - "password": "$2b$10$NbnuWQTVmYwUl7EbJHQig.ZTIsqt.n..jWJ8dAMu5YkuGC350Zkfi", - "role": "user", - "active": true, - "createdAt": "2026-03-11T15:49:50.356Z", - "lastLogin": null, - "department": "backend" } ] } \ No newline at end of file