Skip to content

Create item #3

@mwarman

Description

@mwarman

Describe the story

Add a create task API endpoint which will use Lambda to save a new task item into the DynamoDB table.

Requirements

  • Should use a DTO to model the create task request body.
  • Create task DTO has the following attributes:
    • title - required. max length 100
    • detail - optional. max length 1000
    • dueAt - optional. ISO8601 timestamp
    • isComplete - optional. boolean. default is false
  • Should validate the DTO and return status 400 if invalid.
  • Should set createdAt when item is saved.
  • Should set the pk value when item is saved.
  • Should return the full saved Task with status 201 when successful.

Additional requirements

  • Create or update unit tests
  • Review and update project documentation if needed for new configuration or infrastructure

Acceptance criteria

GIVEN a client sends a request to POST /tasks
WHEN the API Gateway receives this request
THEN the API Gateway sends the request to the create task Lambda function

GIVEN the create task Lambda function receives a request
WHEN the request validation fails
THEN the function returns status 400 with an error message describing the problem

WHEN the request validation succeeds
THEN the function saves the task in the DynamoDB table
AND returns status 201 with the created Task in the response body

WHEN the request fails for any other reason
THEN the function returns status 500 with an error message describing the problem

Additional context

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions