Skip to content

Commit

Permalink
Merge pull request #12 from 51ngul4r1ty/issue/000223/add-backlogitem-…
Browse files Browse the repository at this point in the history
…notes

Add backlog item notes field
  • Loading branch information
51ngul4r1ty authored Jan 25, 2024
2 parents c2f3f04 + 0f05741 commit edebd9d
Show file tree
Hide file tree
Showing 27 changed files with 65 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/dataModel/DATA_CATALOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Fields for `backlogitem`
* `acceptanceCriteria` - Markdown data that contains the acceptance criteria for
a story or the repo steps of an issue. This is an optional field that will be
populated with `null` if not provided.
* `notes` - Markdown data that contains the notes for a story or the repo steps
of an issue. This is an optional field that will be populated with `null` if
not provided.
* `rolePhrase` - For example, `As a devops engineer` or
`As a developer using VS Code`.
* `storyPhrase` - For example, `I can deploy to Heroku` or `I can login`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const InternalBacklogItemPlanningItem: React.FC<BacklogItemPlanningItemProps> =
<BacklogItemDetailForm
key={`unsaved-form-${props.instanceId}`}
acceptanceCriteria={props.acceptanceCriteria}
notes={props.notes}
acceptedAt={props.acceptedAt}
className={classNameToUse}
editing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type BacklogItemDetailFormStateProps = BacklogItemInstanceEditableFields
storyPhrase: string;
reasonPhrase: string | null;
acceptanceCriteria: string;
notes: string;
acceptedAt: Date | null;
estimate: number | null;
allowEstimateEdit?: boolean;
Expand Down Expand Up @@ -112,6 +113,7 @@ export class BacklogItemDetailForm extends Component<BacklogItemDetailFormProps>
reasonPhrase: this.props.reasonPhrase,
type: this.props.type,
acceptanceCriteria: this.props.acceptanceCriteria,
notes: this.props.notes,
startedAt: this.props.startedAt,
finishedAt: this.props.finishedAt,
acceptedAt: this.props.acceptedAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const BacklogItemFullDetailForm: React.FC<BacklogItemFullDetailFormProps>
const placeholderText = props.type === "issue" ? issuePlaceholder : storyPlaceholder;
const prevData: BacklogItemEditableFields = {
acceptanceCriteria: props.acceptanceCriteria,
notes: props.notes,
estimate: props.estimate,
externalId: props.externalId,
friendlyId: props.friendlyId,
Expand Down Expand Up @@ -184,6 +185,19 @@ export const BacklogItemFullDetailForm: React.FC<BacklogItemFullDetailFormProps>
}}
/>
);
const notesInput = (
<StandardTextArea
inputId="notesId"
labelText="Notes"
readOnly={isReadOnly}
renderMarkdown={isReadOnly}
inputValue={props.notes}
rows={3}
onChange={(value) => {
handleDataUpdate({ ...prevData, notes: value });
}}
/>
);
const dateStartedInput = (
<DateTimeInput
inputId="startedAtId"
Expand Down Expand Up @@ -273,6 +287,7 @@ export const BacklogItemFullDetailForm: React.FC<BacklogItemFullDetailFormProps>
{dateReleasedInput}
</div>
<div className={css.formRow}>{acceptanceCriteriaInput}</div>
<div className={css.formRow}>{notesInput}</div>
{actionButtonPanelElts}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface BacklogItemEditableFields extends StoryPhrases {

/* new in this interface */
acceptanceCriteria: string;
notes: string;
acceptedAt: Date | null;
estimate: number | null;
externalId: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const buildCommonItem = (
saved: boolean = true
): BacklogItemWithSource => ({
acceptanceCriteria: "",
notes: "",
createdAt: timeNow(),
estimate,
externalId: buildExternalId(source, itemNumber),
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/mappers/backlogItemMappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { mapApiStatusToBacklogItem, mapBacklogItemStatusToApi } from "./statusMa

export const mapApiItemToBacklogItem = (apiItem: ApiBacklogItem): BacklogItem => ({
acceptanceCriteria: apiItem.acceptanceCriteria,
notes: apiItem.notes,
acceptedAt: isoDateStringToDate(apiItem.acceptedAt),
createdAt: isoDateStringToDate(apiItem.createdAt),
estimate: apiItem.estimate,
Expand Down Expand Up @@ -56,6 +57,7 @@ export const mapApiItemToBacklogItemInSprint = (apiItem: ApiBacklogItemInSprint)

export const mapBacklogItemToApiItem = (item: BacklogItem): ApiBacklogItem => ({
acceptanceCriteria: item.acceptanceCriteria,
notes: item.notes,
createdAt: dateToIsoDateString(item.createdAt),
acceptedAt: dateToIsoDateString(item.acceptedAt),
estimate: item.estimate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe("Backlog Items Reducer", () => {
it("should update correctly", () => {
const addedItem: SaveableBacklogItem = {
acceptanceCriteria: undefined,
notes: undefined,
createdAt: undefined,
estimate: undefined,
externalId: undefined,
Expand Down Expand Up @@ -54,6 +55,7 @@ describe("Backlog Items Reducer", () => {
};
const item: BacklogItemWithSource = {
acceptanceCriteria: "",
notes: "",
createdAt: new Date("2020-05-16T17:49:30.265Z"),
estimate: null,
externalId: "t-1",
Expand Down Expand Up @@ -82,6 +84,7 @@ describe("Backlog Items Reducer", () => {
const pushedItem1: WebsocketPushNotificationData<PushBacklogItemModel> = {
item: {
acceptanceCriteria: "",
notes: "",
createdAt: new Date("2020-06-02T01:15:54.715Z"),
estimate: null,
externalId: "t-2",
Expand Down Expand Up @@ -111,6 +114,7 @@ describe("Backlog Items Reducer", () => {
};
const pushedItem1InAllItems: BacklogItemWithSource = {
acceptanceCriteria: "",
notes: "",
createdAt: new Date("2020-06-02T01:15:54.715Z"),
estimate: null,
externalId: "t-2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ describe("Sprint Backlog Reducer", () => {
const backlogItem: BacklogItemInSprint = {
id: backlogItemId,
acceptanceCriteria: null,
notes: null,
acceptedAt: null,
createdAt: new Date(2020, 0, 1),
estimate: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ export const backlogItemsReducer = (
}));
draft.currentItem = {
acceptanceCriteria: backlogItem.acceptanceCriteria,
notes: backlogItem.notes,
createdAt: isoDateStringToDate(backlogItem.createdAt),
editing: false,
estimate: backlogItem.estimate,
Expand Down Expand Up @@ -547,6 +548,7 @@ export const backlogItemsReducer = (
draft.currentItem = resetItem;
const item: BacklogItemInstanceEditableFields = {
acceptanceCriteria: resetItem.acceptanceCriteria,
notes: resetItem.notes,
estimate: resetItem.estimate,
externalId: resetItem.externalId,
friendlyId: resetItem.friendlyId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const addSourceToPushedItem = (item: Partial<PushBacklogItemModel>, sourc

export const mapPushedToBacklogItem = (pushedItem: Partial<PushBacklogItemModel>): BacklogItemWithSource => ({
acceptanceCriteria: pushedItem.acceptanceCriteria,
notes: pushedItem.notes,
acceptedAt: pushedItem.acceptedAt,
createdAt: pushedItem.createdAt,
estimate: pushedItem.estimate,
Expand Down Expand Up @@ -161,6 +162,7 @@ export const updateItemFieldsInAllItems = (draft: Draft<BacklogItemsState>, back

export const updateBacklogItemFields = (backlogItem: BacklogItem, payload: BacklogItemEditableFields) => {
backlogItem.acceptanceCriteria = payload.acceptanceCriteria;
backlogItem.notes = payload.notes;
backlogItem.estimate = payload.estimate;
backlogItem.externalId = payload.externalId;
backlogItem.friendlyId = payload.friendlyId;
Expand Down
5 changes: 5 additions & 0 deletions packages/shared/src/selectors/backlogItemSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ export const getCurrentBacklogItemAcceptanceCriteria = createSelector(
(backlogItems: BacklogItemsState): string => backlogItems.currentItem?.acceptanceCriteria
);

export const getCurrentBacklogItemNotes = createSelector(
[backlogItems],
(backlogItems: BacklogItemsState): string => backlogItems.currentItem?.notes
);

export const getCurrentBacklogItemStartedAt = createSelector(
[backlogItems],
(backlogItems: BacklogItemsState): Date | null => backlogItems.currentItem?.startedAt
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/types/apiModelTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export type ApiBacklogItem = StandardItem &

/* new fields */
acceptanceCriteria: string | null;
notes: string | null;
estimate: number | null;
storyEstimate: number | null;
externalId: string | null;
Expand Down Expand Up @@ -115,6 +116,7 @@ export type ApiBacklogItemWithParts = ApiBacklogItem & {

/* from ApiBacklogItem */
acceptanceCriteria: string | null;
notes: string | null;
estimate: number | null;
externalId: string | null;
friendlyId: string | null;
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/types/backlogItemTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type BacklogItemType = "story" | "issue";

export interface BacklogItemModel extends BaseModelItem {
acceptanceCriteria: string | null;
notes: string | null;
acceptedAt: Date | null;
createdAt: Date;
estimate: number | null;
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/utils/apiPayloadHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { SprintModel } from "../types/sprintTypes";

export const convertToBacklogItemModel = (backlogItem: BacklogItem): BacklogItemModel => ({
acceptanceCriteria: backlogItem.acceptanceCriteria,
notes: backlogItem.notes,
acceptedAt: backlogItem.acceptedAt,
createdAt: backlogItem.createdAt,
estimate: backlogItem.estimate,
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/utils/businessItemCloners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ApiBacklogItem, ApiBacklogItemPart } from "../types/apiModelTypes";

export const cloneApiBacklogItem = (apiItem: ApiBacklogItem): ApiBacklogItem => ({
acceptanceCriteria: apiItem.acceptanceCriteria,
notes: apiItem.notes,
acceptedAt: apiItem.acceptedAt,
createdAt: apiItem.createdAt,
estimate: apiItem.estimate,
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/views/BacklogItemView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {

export interface BacklogItemViewStateProps {
acceptanceCriteria: string;
notes: string;
acceptedAt: Date | null;
backlogItemDisplayId: string;
editMode: EditMode;
Expand Down Expand Up @@ -84,6 +85,7 @@ export const BacklogItemView: React.FC<BacklogItemViewProps> = (props) => {
storyPhrase={props.storyPhrase}
reasonPhrase={props.reasonPhrase}
acceptanceCriteria={props.acceptanceCriteria}
notes={props.notes}
startedAt={props.startedAt}
finishedAt={props.finishedAt}
acceptedAt={props.acceptedAt}
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/views/BacklogItemViewContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface BacklogItemViewContainerOwnProps {
const mapStateToProps = (state: StateTree, ownProps: BacklogItemViewContainerOwnProps): BacklogItemViewStateProps => {
const result: BacklogItemViewStateProps = {
acceptanceCriteria: backlogItemSelectors.getCurrentBacklogItemAcceptanceCriteria(state),
notes: backlogItemSelectors.getCurrentBacklogItemNotes(state),
acceptedAt: backlogItemSelectors.getCurrentBacklogItemAcceptedAt(state),
backlogItemDisplayId: ownProps.match.params.backlogItemDisplayId,
editMode: appSelectors.getAppEditMode(state),
Expand Down
1 change: 1 addition & 0 deletions packages/shared/stories/organisms/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ storiesOf("Organisms/Panels/SprintPlanningPanel", module).add("SprintPlanningPan
externalId: "gh-123",
finishedAt: null,
friendlyId: "",
notes: "",
partIndex: number("partIndex", 1),
partPercentage: 0.5,
projectId: "",
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atoll/web-app",
"version": "0.64.1",
"version": "0.65.0",
"description": "Atoll web app",
"scripts": {
"build": "npm run build-only && npm run build-deploy",
Expand Down
1 change: 1 addition & 0 deletions packages/web-app/src/database/erd/dbdiagram-io.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Table backlogitem as BI {
"projectId" varchar(32)
status char(1)
"acceptanceCriteria" text
"notes" text
"startedAt" timestamp
"finishedAt" timestamp
"acceptedAt" timestamp
Expand Down
3 changes: 3 additions & 0 deletions packages/web-app/src/database/model/upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,6 @@ rename constraint "backlogitemrank_nextbacklogitemId_fkey" TO "productbacklogite

alter table productbacklogitem
rename constraint "backlogitemrank_pkey" TO "productbacklogitem_pkey";

-- v0.65.0
alter table backlogitem add column "notes" text;
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const buildApiBacklogItem = (): ApiBacklogItem => {
storyPhrase: "I can chill on the couch",
reasonPhrase: "because automation does my job for me",
acceptanceCriteria: "* Not real acceptance criteria",
notes: "* Not real notes",
acceptedAt: null, // "2020-12-27T19:00:00Z"
estimate: 5,
externalId: "ext-123",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe("API To Data Object Mappers", () => {
type: "story",
status: "R",
acceptanceCriteria: "* successfully test this mapping function",
notes: "* successfully test notes mapping",
startedAt: "2022-04-04T14:15:39.446Z",
finishedAt: "2022-04-06T12:39:23.223Z",
acceptedAt: "2022-04-06T14:45:15.767Z",
Expand All @@ -48,6 +49,7 @@ describe("API To Data Object Mappers", () => {
// assert
const shellDbItem = {
acceptanceCriteria: "* successfully test this mapping function",
notes: "* successfully test notes db mapping",
acceptedAt: new Date("2022-04-06T14:45:15.767Z"),
createdAt: new Date("2022-04-02T09:59:01.000Z"),
estimate: 13,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe("Data Object To API Mappers", () => {
type: "story",
status: "R",
acceptanceCriteria: "* successfully test this mapping function",
notes: "* successfully test notes mapping again",
startedAt: new Date("2022-04-04T14:15:39.446Z"),
finishedAt: new Date("2022-04-06T12:39:23.223Z"),
acceptedAt: new Date("2022-04-06T14:45:15.767Z"),
Expand Down Expand Up @@ -89,6 +90,7 @@ describe("Data Object To API Mappers", () => {
type: "story",
status: "R",
acceptanceCriteria: "* successfully test this mapping function",
notes: "* successfully test notes mapping again and again",
startedAt: "2022-04-04T14:15:39.446Z",
finishedAt: "2022-04-06T12:39:23.223Z",
acceptedAt: "2022-04-06T14:45:15.767Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export const mapDbSprintBacklogWithNestedToApiBacklogItemInSprint = (dbItem: any
const backlogitem = backlogitempart?.backlogitem?.dataValues;
const result: ApiBacklogItemInSprint = {
acceptanceCriteria: backlogitem.acceptanceCriteria,
notes: backlogitem.notes,
acceptedAt: backlogitem.acceptedAt,
createdAt: backlogitem.createdAt,
displayindex: sprintBacklogWithItems.displayindex,
Expand Down Expand Up @@ -163,6 +164,7 @@ export const mapDbBacklogPartsWithSprintItemsToApiBacklogItemInSprint = (dbItem:
const sprintbacklogitem = partsWithSprintItems?.sprintbacklogitems?.[0]?.dataValues;
const result: ApiBacklogItemInSprint = {
acceptanceCriteria: backlogitem.acceptanceCriteria,
notes: backlogitem.notes,
acceptedAt: backlogitem.acceptedAt,
createdAt: backlogitem.createdAt,
displayindex: sprintbacklogitem.displayindex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class BacklogItemDataModel extends Model {
public type!: string;
public status!: string | null;
public acceptanceCriteria!: string | null;
public notes!: string | null;
public startedAt!: Date | null;
public finishedAt!: Date | null;
public acceptedAt!: Date | null;
Expand Down Expand Up @@ -82,6 +83,10 @@ BacklogItemDataModel.init(
type: DataTypes.TEXT,
allowNull: true
},
notes: {
type: DataTypes.TEXT,
allowNull: true
},
totalParts: {
type: DataTypes.INTEGER,
allowNull: true
Expand Down

0 comments on commit edebd9d

Please sign in to comment.