Task App - Add Task

Bounded Context

Log in to the Codebricks Platform. Follow the instructions to create a Business Domain and a Bounded Context.

Open the Bounded Context and start planning the Task App.

Task Aggregate

1
Open the Aggregate menu
  • Click the Aggregate menu button on the left side of the screen.
2
Open the add Aggregate sub menu
  • Click the add button to open the sub menu.
3
Create a new Aggregate
  • Type in 'task'.
  • Click 'save' to create the new Aggregate.

The new task Aggregate

Add Task

1
Select the Use Case type Command API (CA)
  • After selecting an aggregate, click the Use Case Command API (CA).
  • Your cursor turns into the CA icon.
2
Place the Command API
  • Click on the Plan to place the Command API.
  • The Command API Use Case will then appear on the Plan.

Command API Use Case placed on the Plan

Use Case Sub Menu

1
Select the added Command API (CA) Use Case
  • Click the added Command API (CA) Use Case.

Command API with open sub elements view

API Request

1
Change the API Request name
  • Click the name input of the API Request.
  • Type in 'add task'.
  • Confirm the new name by clicking on 'save'.
2
Add title property
  • Click the plus icon on the right.
  • Type 'title' in the name input.
  • Select 'string' in the type dropdown.
  • Click the ✓ to save the property.
3
Add description property
  • Click the plus icon on the right.
  • Type 'description' in the name input.
  • Select 'string' in the type dropdown.
  • Click the ✓ to save the property.
4
Add assignee id property
  • Click the plus icon on the right.
  • Type 'assignee id' in the name input.
  • Select 'uuid' in the type dropdown.
  • Click the ✓ to save the property.

API Request with changed name and new properties

Command

1
Copy properties to Command
  • Click the 'copy to command' button on the API Request.
  • The 3 properties appear in the Command.
2
Change the Command name
  • Click the name input of the Command.
  • Type 'add task'.
  • Confirm the new name by clicking on 'save'.
3
Add Value Object to the 'title' property
  • Click the edit icon on the right of the 'title' attribute.
4
Create a new Value Object
  • Click the plus button next to the dropdown 'value object'.
5
Create the 'title' Value Object
  • Type the Value Object name, 'title', in the name input of the sub menu.
  • Press the ✓ icon of the add value object sub menu to create the Value Object.
  • Make sure the new created Value Object is selected.
  • Press the ✓ icon to save the change to the title property.
  • Repeat Steps 3, 4 and 5 for the 'description' and 'assignee id' properties.

Command with changed name, new properties and value objects

Aggregate Method

1
Copy properties to Aggregate Method
  • Click the 'copy to method' button on the Command.
  • The 3 properties appear in the Aggregate Method.
2
Keep the Aggregate Load Type
  • The execution of the 'add task' Command creates a new 'task' Aggregate.
  • Keep the selection 'create' for the Aggregate Load Type.

Aggregate Method with copied properties and Aggregate Load Type 'create'

Event

1
Copy properties to Event
  • Click the 'copy to event' button on the Aggregate Method.
  • The 3 properties appear in the Event.
2
Change the Event name
  • Click the name input of the Event.
  • Type in 'task added'.
  • Confirm the new name by clicking on 'save'.

Event with copied properties and new name

Aggregate State

1
Add task status to the Aggregate State
  • Click the plus icon on the right.
  • Type 'task' in the name input.
  • Select 'enum' in the type dropdown.
2
Create the 'task status' Enum
  • Click the plus next to the 'enum' dropdown.
  • Type 'task status' in the name input of the Enum sub menu.
3
Create the 'task status' Enum
  • Type 'open' value input and click the plus right next to the input.
  • Type 'completed' value input and click the plus right next to the input.
  • Type 'closed' value input and click the plus right next to the input.
  • Click the ✓ button on the right to create the enum.
4
Save the 'task status' property
  • Ensure the new created 'task status' enum is selected as enum for the 'task status' property.
  • Click the ✓ button on the right to create the property.
5
Set the Value Source for the 'task status' Aggregate State property
  • Click the plus button on the right of the 'task status' property.
6
Set the Value Source for the 'task status' Aggregate State property
  • Select the Value Source type 'Static'.
7
Set 'open' as Static Value Source for the 'task status' Aggregate State property
  • Select the Value Source value 'open'.
  • Click the ✓ button on the right.

Aggregate State with task status property and static Value Source

API Response

1
Add task id to the API Response
  • Click the plus icon on the right.
  • Type 'task id' in the name input.
  • Select 'uuid' in the type dropdown.
  • Click the ✓ button on the right.
2
Set the Value Source for the 'task id' API Response property
  • Click the plus button on the right of the 'task id' property.
3
Set the Value Source for the 'task id' API Response property
  • Select the Value Source type 'Metadata'.
4
Set 'task.aggregate id: uuid' as Metadata Value Source for the 'task id' property
  • Select the Value Source value 'open'.
  • Click the ✓ button on the right.

API Response with task id property and metadata Value Source

Set Add Task Ready

1
Select 'add task' Use Case
  • Click the 'add task' Use Case.
2
Open the Use Case menu
  • Click the Use Case menu icon on the left side.
3
Set generation status to ready
  • Set the generation status from 'planned' to 'ready'.
Planned Use Cases have a blue border, the Code Generator wont generate its code.
Ready Use Cases have a gray border, the Code Generator generates its code.

Use case is ready for Code Generation

Setup Code Generation

1
Open the Code Generator menu
  • Click on the 'Code' button on the top right corner to open the Code Generator menu.
2
Download the Code Client
  • Click the 'Download' Button for Mac or Linux or Windows.

Code Client MacOS

1
Install Code Client on Mac
  • Drag and drop the Codebricks Code Client into Applications.
2
Start the Code Client
  • Open the Applications folder.
  • Open the Codebricks Code Client.

Code Client Linux

1
Install Code Client on Linux
  • Run `sudo apt-get install ./codebricks-codeclient.deb`
2
Start the Code Client
  • Open the Applications.
  • Open the Codebricks Code Client.
  • Or run `./codebricks-codeclient`

Code Client Windows

1
Install Code Client on Windows
  • Open the `codebricks-codeclient.exe`.
2
Start the Code Client
  • Open the Applications folder.
  • Or go to your Desktop.
  • Open the Codebricks Code Client.

Configure Code Client

1
Open the Code Generator menu
  • Click on the 'Code' button to open the Code Generator menu.
2
Login to Code Client
  • Click the 'Login' button.
  • The browser may ask for confirmation to open the Code Client.
  • The Code Client will show 'Login was successful'.

The Code Client is connected

Select Aggregates and Path

1
Continue
  • Open the browser again and select the 'task' Aggregate.
2
Configure Code Path
  • Click the 'Configure Code Path' button.
  • The browser may ask for confirmation to open the Code Client.
3
Set the Code Path in the Client
  • Click the 'Set Path' button.
  • Select a directory for the Code project.
  • Click the 'Done' button.

Code generation is configured

Generate the Code

1
Open the Code Generator menu
  • Click on the 'Code' button to open the Code Generator menu.
2
Start Code Generation
  • Click the 'Generate Code' button.
3
Generating code
  • Wait until the activity indicator disappears and 'Code Generation done' is displayed under the button.
  • Open the selected Path with an IDE or Text Editor.

The generated code

Next
Complete Task

© 2024 Codebricks | All rights reserved.