Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Task creation endpoint #1

Open
wsingleton opened this issue Jul 13, 2022 · 0 comments
Open

[API] Task creation endpoint #1

wsingleton opened this issue Jul 13, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@wsingleton
Copy link
Contributor

wsingleton commented Jul 13, 2022

Description

An endpoint at /taskmaster/tasks that accepts POST requests with a request body that can mapped to a TaskRequestPayload should be created to allow for new task creation and persistence. The TaskRequestPayload DTO is used for validation (most of which is already implemented using Validation API annotations) and exposes a method that returns a valid Task object. A random UUID should be generated and used to set the ID of the extracted Task object, and it should then be persisted to the data source.

Acceptance Criteria

  1. Provided implementation that passes all tests within TaskCreationIntegrationTest
    • run with IDE or using mvn clean test within a terminal
    • use the argument -Dspring.profiles.active=test when running tests to run them under the correct profile
  2. Commit messages are descriptive and provide adequate context to the work performed
  3. Code is well-formatted and unnecessary comments/unused imports are removed

Validation Constraints

  • No id is expected in the payload for creation requests
  • A title value is expected in the request payload for task creation
  • Task titles must not be empty and no more than 50 characters long
  • A description value is expected in the request payload for task creation
  • Task descriptions must not be empty strings
  • Task priority level must be in the inclusive range: 1 - 4
  • Task point values must be in the inclusive range: 1 - 100
  • Task due dates must be a date in the future
  • At least one label string is expected in the request payload for task creation
  • The provided creatorId and any assigneeIds must belong to a user in the data source (see MockDataInserter)
    • if a provided creator or assignee ID does not belong to a known user, an UnprocessableEntityException should be thrown (handler already implemented)
  • Task state must be one of the following:
    • "UNASSIGNED"
    • "READY TO START"
    • "IN PROGRESS"
    • "FOR REVIEW"
    • "DONE"
    • "BLOCKED"

Example Payloads

Valid TaskRequestPayload JSON without task assignee IDs:

{
    "title": "Valid Task Title",
    "description": "This is a valid task description.",
    "priority": 4,
    "pointValue": 5,
    "dueDate": "2022-07-27",
    "state": "UNASSIGNED",
    "labels": [
        "ready to start",
        "valid",
        "test"
    ],
    "creatorId": "manager-user-id"
}

Valid TaskRequestPayload JSON with task assignee IDs:

{
    "title": "Valid Task Title",
    "description": "This is a valid task description.",
    "priority": 4,
    "pointValue": 5,
    "dueDate": "2022-07-27",
    "state": "UNASSIGNED",
    "labels": [
        "ready to start",
        "valid",
        "test"
    ],
    "creatorId": "manager-user-id",
    "assigneeIds": [
        "dev-user-id",
        "tester-user-id"
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

6 participants