-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
362 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import Requirement from "~/domain/Requirement"; | ||
|
||
/** | ||
* Environment property that must be maintained | ||
* Environment property that must be maintained. | ||
* It exists as both an assumption and an effect. | ||
* (precondition and postcondition) | ||
*/ | ||
export default class Invariant extends Requirement { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import Interactor from "~/application/Interactor" | ||
import UseCase from "../domain/UseCase" | ||
import type { Uuid } from "~/domain/Uuid" | ||
|
||
type In = Pick<UseCase, 'id' | 'name' | 'primaryActorId' | 'parentId' | 'extensions' | 'goalInContext' | 'level' | 'mainSuccessScenario' | 'preCondition' | 'scope' | 'stakeHoldersAndInterests' | 'successGuarantee' | 'trigger' | 'solutionId'> | ||
|
||
export default class UseCaseInteractor extends Interactor<UseCase> { | ||
async create( | ||
props: Omit<In, 'id'> | ||
): Promise<Uuid> { | ||
return await this.repository.add(new UseCase({ | ||
id: crypto.randomUUID(), | ||
extensions: props.extensions, | ||
goalInContext: props.goalInContext, | ||
level: props.level, | ||
mainSuccessScenario: props.mainSuccessScenario, | ||
name: props.name, | ||
parentId: props.parentId, | ||
preCondition: props.preCondition, | ||
primaryActorId: props.primaryActorId, | ||
property: '', | ||
scope: props.scope, | ||
solutionId: props.solutionId, | ||
stakeHoldersAndInterests: props.stakeHoldersAndInterests, | ||
successGuarantee: props.successGuarantee, | ||
statement: '', | ||
trigger: props.trigger | ||
})) | ||
} | ||
|
||
async delete(id: Uuid): Promise<void> { | ||
await this.repository.delete(id) | ||
} | ||
|
||
async getAll(solutionId: Uuid): Promise<UseCase[]> { | ||
return await this.repository.getAll( | ||
useCase => useCase.solutionId === solutionId | ||
) | ||
} | ||
|
||
async update(props: In): Promise<void> { | ||
await this.repository.update(new UseCase({ | ||
id: props.id, | ||
extensions: props.extensions, | ||
goalInContext: props.goalInContext, | ||
level: props.level, | ||
mainSuccessScenario: props.mainSuccessScenario, | ||
name: props.name, | ||
parentId: props.parentId, | ||
preCondition: props.preCondition, | ||
primaryActorId: props.primaryActorId, | ||
property: '', | ||
scope: props.scope, | ||
solutionId: props.solutionId, | ||
stakeHoldersAndInterests: props.stakeHoldersAndInterests, | ||
successGuarantee: props.successGuarantee, | ||
statement: '', | ||
trigger: props.trigger | ||
})) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import Example from "./Example"; | ||
|
||
/** | ||
* A TestCase is a specification of the inputs, execution conditions, | ||
* testing procedure, and expected results that define a single test to | ||
* be executed to achieve a particular goal., | ||
*/ | ||
export default class TestCase extends Example { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,73 @@ | ||
import Scenario from "./Scenario"; | ||
import type { Uuid } from "~/domain/Uuid"; | ||
import type { Properties } from "~/domain/Properties"; | ||
|
||
/** | ||
* A Use Case specifies the scenario of a complete | ||
* interaction of a user through a system. | ||
*/ | ||
export default class UseCase extends Scenario { } | ||
export default class UseCase extends Scenario { | ||
/** | ||
* TODO: <https://github.com/final-hill/cathedral/issues/154> | ||
*/ | ||
scope: string | ||
|
||
/** | ||
* TODO: <https://github.com/final-hill/cathedral/issues/154> | ||
*/ | ||
level: string | ||
|
||
/** | ||
* TODO: is this just the Goal.description? | ||
*/ | ||
goalInContext: string | ||
|
||
/** | ||
* The preCondition is an Assumption that must be true before the use case can start. | ||
*/ | ||
preCondition: Uuid | ||
|
||
// the action upon the system that starts the use case | ||
// A Responsibility? Functional Requirement? | ||
trigger: Uuid | ||
|
||
/** | ||
* The main success scenario is the most common path through the system. | ||
* It takes the form of a sequence of steps that describe the interaction: | ||
* 1. The use case starts when <Actor> <does something>. | ||
* 2. The system <does something in response>. | ||
* 3. The <Actor name> does something else. | ||
* ... | ||
*/ | ||
//mainSuccessScenario: [FunctionalRequirement | Constraint | Role | Responsibility][] | ||
mainSuccessScenario: string | ||
|
||
/** | ||
* An Effect that is guaranteed to be true after the use case is completed. | ||
*/ | ||
successGuarantee: Uuid | ||
|
||
/** | ||
* | ||
*/ | ||
// extensions: [FunctionalRequirement | Constraint | Role | Responsibility][] | ||
extensions: string | ||
|
||
/** | ||
* | ||
*/ | ||
stakeHoldersAndInterests: Uuid[] // Actor[] | ||
|
||
constructor(props: Properties<UseCase>) { | ||
super(props) | ||
this.scope = props.scope | ||
this.level = props.level | ||
this.goalInContext = props.goalInContext | ||
this.preCondition = props.preCondition | ||
this.trigger = props.trigger | ||
this.mainSuccessScenario = props.mainSuccessScenario | ||
this.successGuarantee = props.successGuarantee | ||
this.extensions = props.extensions | ||
this.stakeHoldersAndInterests = props.stakeHoldersAndInterests | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.