/Trello-lite

zuddl assignment

Primary LanguageJavaScript

Screen shots image image

Q. If a user can create and edit stages for a particular board. For example instead of Open > In Progress > Done if they want the stages of their task board to be Read > Working > Reviewing > Completed

Database Changes:

Task Stages Table: introduce a new table to store the possible stages that users can choose from for their task boards. This table could include fields like StageID, BoardID, Name, and Order to represent the stage name and its position in the sequence.

image

image

API Changes:

  1. Create/Edit Board Stages Endpoint:
    Endpoint: POST /api/boards/{board_id}/stages
    Description: Allows users to create or edit the stages for a specific board.

  2. Get Available Stages Endpoint:
    Endpoint: GET /api/stages
    Description: Retrieves the available stages that users can choose from when creating or editing a board.

Q. If users can comment on tasks

Database Changes:

Task Comments Table: Introduce a new table to store comments on tasks. This table should include fields like CommentID, TaskID, UserID, CommentText, Timestamp, etc., to store the comment details.

User Table: Stores user information, and comments made by users.

Task Table: Add a field CommendID to existing task table to associate tasks with comments. image

API Changes:

Add Comments to Task Endpoint:

Endpoint: POST /api/tasks/{task_id}/comments Description: Allows users to add comments to a specific task. Request Body (JSON):

    {
       "user_id": "user123",
        "comment_text": "This task is progressing well."
    }

Response (Success - 201 Created):

{
  "commentID": 5, // ID of the newly created comment
  "taskID": 201, // ID of the task to which the comment was added
  "userID": 301, // ID of the user who created the comment
  "commentText": "This task is looking great!",
  "timestamp": "2023-09-22T14:30:00Z" // Timestamp of the comment
}

Retrieve Comments for Task Endpoint:

Endpoint: GET /api/tasks/{task_id}/comments Description: Retrieves the comments associated with a specific task. Response (Success - 200 OK):

[
  {
    "commentID": 1,
    "taskID": 201,
    "userID": 301,
    "commentText": "This task looks interesting!",
    "timestamp": "2023-09-22T10:00:00Z"
  },
  {
    "commentID": 2,
    "taskID": 201,
    "userID": 302,
    "commentText": "I agree, let's get started!",
    "timestamp": "2023-09-22T10:15:00Z"
  }
]

Q. How will you do error handling?

  1. Validation: Validate user inputs to ensure they meet the required format and constraints (e.g., valid board names, valid task IDs, non-empty comments).

  2. Try-Catch Blocks for API Requests: Wrap API requests in try-catch blocks to catch any network or request-related errors. Display a user-friendly error message to inform the user if the API request fails.