(userId)
| 386 | logger.error(`Error while updating the status for ${userId} - ${error.message}`); |
| 387 | throw error; |
| 388 | } |
| 389 | }; |
| 390 | |
| 391 | /** |
| 392 | * Updates the user status based on a task update. |
| 393 | * @param {string} userName - The username associated with the user. |
| 394 | * @returns {Promise<{ |
| 395 | * status: number, |
| 396 | * message: string, |
| 397 | * error: string, |
| 398 | * } | { |
| 399 | * status: string, |
| 400 | * message: string, |
| 401 | * data: object |
| 402 | * }>} - The response object indicating the status of the user status update or an error. |
| 403 | */ |
| 404 | |
| 405 | const updateUserStatusOnTaskUpdate = async (userName) => { |
| 406 | try { |
| 407 | const userId = await getUserIdFromUserName(userName, usersCollection); |
| 408 | const userStatusUpdate = await updateUserStatusOnNewTaskAssignment(userId); |
| 409 | return userStatusUpdate; |
| 410 | } catch (error) { |
| 411 | if (error instanceof NotFound) { |
| 412 | return { |
| 413 | status: 404, |
| 414 | error: "Not Found", |
| 415 | message: error.message, |
| 416 | }; |
| 417 | } |
| 418 | return { |
| 419 | status: 500, |
| 420 | error: "Internal Server Error", |
| 421 | message: error.message, |
| 422 | }; |
| 423 | } |
| 424 | }; |
no test coverage detected