Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 108 additions & 108 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions task-1/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
curl -X DELETE http://localhost:3000/users/11 \
3 changes: 3 additions & 0 deletions task-1/get.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my main comment for the trail “"

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
curl -X GET http://localhost:3000/users/11 \

4 changes: 4 additions & 0 deletions task-1/patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
curl -X PATCH http://localhost:3000/users/11 \
-H "Content-Type: application/json; charset=UTF-8" \
-d '{ "email": "[email protected]"}'
11 changes: 11 additions & 0 deletions task-1/post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
curl -X POST http://localhost:3000/users \
-H "Content-Type: application/json; charset=UTF-8" \
-d '{
"name": "John Doe",
"email": "[email protected]",
"password": "secret123",
"role": "user",
"active": true,
"department": "Engineering"
}'
114 changes: 114 additions & 0 deletions task-1/users.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"users": [
{
"id": 1,
"name": "Alice Johnson",
"email": "[email protected]",
"password": "$2b$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "admin",
"active": true,
"createdAt": "2024-01-15T08:30:00Z",
"lastLogin": "2026-02-03T10:45:00Z",
"department": "Engineering"
},
{
"id": 2,
"name": "Bob Smith",
"email": "[email protected]",
"password": "$2b$10$V8qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "user",
"active": true,
"createdAt": "2024-02-20T09:15:00Z",
"lastLogin": "2026-02-02T14:22:00Z",
"department": "Marketing"
},
{
"id": 3,
"name": "Carol Williams",
"email": "[email protected]",
"password": "$2b$10$X7qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "moderator",
"active": true,
"createdAt": "2024-03-10T11:00:00Z",
"lastLogin": "2026-02-01T09:30:00Z",
"department": "Content"
},
{
"id": 4,
"name": "David Brown",
"email": "[email protected]",
"password": "$2b$10$Y6qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "user",
"active": false,
"createdAt": "2024-04-05T13:45:00Z",
"lastLogin": "2025-11-28T16:20:00Z",
"department": "Sales"
},
{
"id": 5,
"name": "Emma Davis",
"email": "[email protected]",
"password": "$2b$10$Z5qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "admin",
"active": true,
"createdAt": "2024-01-08T07:20:00Z",
"lastLogin": "2026-02-03T08:15:00Z",
"department": "Engineering"
},
{
"id": 6,
"name": "Frank Miller",
"email": "[email protected]",
"password": "$2b$10$A4qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "user",
"active": true,
"createdAt": "2024-05-12T10:30:00Z",
"lastLogin": "2026-01-31T12:00:00Z",
"department": "HR"
},
{
"id": 7,
"name": "Grace Lee",
"email": "[email protected]",
"password": "$2b$10$B3qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "moderator",
"active": true,
"createdAt": "2024-06-18T14:15:00Z",
"lastLogin": "2026-02-02T15:45:00Z",
"department": "Content"
},
{
"id": 8,
"name": "Henry Taylor",
"email": "[email protected]",
"password": "$2b$10$C2qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "user",
"active": false,
"createdAt": "2024-07-22T16:00:00Z",
"lastLogin": "2025-12-15T11:30:00Z",
"department": "Finance"
},
{
"id": 9,
"name": "Iris Anderson",
"email": "[email protected]",
"password": "$2b$10$D1qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "user",
"active": true,
"createdAt": "2024-08-05T09:45:00Z",
"lastLogin": "2026-02-03T11:20:00Z",
"department": "Marketing"
},
{
"id": 10,
"name": "Jack Wilson",
"email": "[email protected]",
"password": "$2b$10$E0qo8uLOickgx2ZMRZoMyeIjZAgcg7b3XeKeUxWdeS86E36P4/TVG2",
"role": "moderator",
"active": true,
"createdAt": "2024-09-14T12:30:00Z",
"lastLogin": "2026-02-03T13:00:00Z",
"department": "Engineering"
}
]
}
13 changes: 10 additions & 3 deletions task-2/services.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Nobel Prize API Documentation: https://www.nobelprize.org/about/developer-zone-2/

import { fetchData } from './fetcher.js';
import { fetchData } from "./fetcher.js";

const API_BASE_URL = 'https://api.nobelprize.org/2.1';
const API_BASE_URL = "https://api.nobelprize.org/2.1";

/**
* Fetch Nobel Prizes with optional filters
Expand All @@ -15,7 +15,14 @@ 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;
const { year, category, offset = 0, limit = 10 } = filters;

const params = new URLSearchParams({ offset, limit, sort: "desc" });

if (year !== "all") params.append("nobelPrizeYear", year);
if (category !== "all") params.append("nobelPrizeCategory", category);

const url = `${API_BASE_URL}/nobelPrizes?${params}`;

fetchData(url, onSuccess, onError);
}