-
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
17 changed files
with
356 additions
and
36 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
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
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
39 changes: 39 additions & 0 deletions
39
modules/system/application/FunctionalRequirementInteractor.ts
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,39 @@ | ||
import type Repository from "~/application/Repository"; | ||
import FunctionalRequirement from "../domain/FunctionalRequirement"; | ||
import type { Uuid } from "~/domain/Uuid"; | ||
|
||
export default class FunctionalRequirementInteractor { | ||
constructor( | ||
readonly repository: Repository<FunctionalRequirement> | ||
) { } | ||
|
||
async create({ parentId, name, statement }: Pick<FunctionalRequirement, 'parentId' | 'name' | 'statement'>): Promise<Uuid> { | ||
return await this.repository.add(new FunctionalRequirement({ | ||
id: crypto.randomUUID(), | ||
property: '', | ||
parentId, | ||
name, | ||
statement | ||
})) | ||
} | ||
|
||
async delete(id: Uuid): Promise<void> { | ||
await this.repository.delete(id) | ||
} | ||
|
||
async getAll(parentId: Uuid): Promise<FunctionalRequirement[]> { | ||
return await this.repository.getAll( | ||
behavior => behavior.parentId === parentId | ||
) | ||
} | ||
|
||
async update({ id, parentId, name, statement }: Pick<FunctionalRequirement, 'id' | 'parentId' | 'name' | 'statement'>): Promise<void> { | ||
await this.repository.update(new FunctionalRequirement({ | ||
id, | ||
property: '', | ||
parentId, | ||
name, | ||
statement | ||
})) | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
modules/system/application/NonFunctionalRequirementInteractor.ts
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,39 @@ | ||
import type Repository from "~/application/Repository"; | ||
import NonFunctionalRequirement from "../domain/NonFunctionalRequirement"; | ||
import type { Uuid } from "~/domain/Uuid"; | ||
|
||
export default class NonFunctionalRequirementInteractor { | ||
constructor( | ||
readonly repository: Repository<NonFunctionalRequirement> | ||
) { } | ||
|
||
async create({ parentId, name, statement }: Pick<NonFunctionalRequirement, 'parentId' | 'name' | 'statement'>): Promise<Uuid> { | ||
return await this.repository.add(new NonFunctionalRequirement({ | ||
id: crypto.randomUUID(), | ||
property: '', | ||
parentId, | ||
name, | ||
statement | ||
})) | ||
} | ||
|
||
async delete(id: Uuid): Promise<void> { | ||
await this.repository.delete(id) | ||
} | ||
|
||
async getAll(parentId: Uuid): Promise<NonFunctionalRequirement[]> { | ||
return await this.repository.getAll( | ||
behavior => behavior.parentId === parentId | ||
) | ||
} | ||
|
||
async update({ id, parentId, name, statement }: Pick<NonFunctionalRequirement, 'id' | 'parentId' | 'name' | 'statement'>): Promise<void> { | ||
await this.repository.update(new NonFunctionalRequirement({ | ||
id, | ||
property: '', | ||
parentId, | ||
name, | ||
statement | ||
})) | ||
} | ||
} |
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,16 @@ | ||
import type { Properties } from "~/domain/Properties"; | ||
import StorageRepository from "~/data/StorageRepository"; | ||
import type FunctionalRequirement from "../domain/FunctionalRequirement"; | ||
import FunctionalRequirementToJsonMapper from "../mappers/FunctionalRequirementToJsonMapper"; | ||
|
||
const { serializationVersion } = useAppConfig() | ||
|
||
export default class FunctionalRequirementRepository extends StorageRepository<FunctionalRequirement> { | ||
constructor(properties: Properties<Omit<FunctionalRequirementRepository, 'storageKey' | 'mapper'>> = {}) { | ||
super({ | ||
...properties, | ||
storageKey: 'functionalRequirement', | ||
mapper: new FunctionalRequirementToJsonMapper(serializationVersion) | ||
}) | ||
} | ||
} |
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,16 @@ | ||
import type { Properties } from "~/domain/Properties"; | ||
import StorageRepository from "~/data/StorageRepository"; | ||
import FunctionalRequirementToJsonMapper from "../mappers/FunctionalRequirementToJsonMapper"; | ||
import type NonFunctionalRequirement from "../domain/NonFunctionalRequirement"; | ||
|
||
const { serializationVersion } = useAppConfig() | ||
|
||
export default class NonFunctionalRequirementRepository extends StorageRepository<NonFunctionalRequirement> { | ||
constructor(properties: Properties<Omit<NonFunctionalRequirementRepository, 'storageKey' | 'mapper'>> = {}) { | ||
super({ | ||
...properties, | ||
storageKey: 'nonFunctionalRequirement', | ||
mapper: new FunctionalRequirementToJsonMapper(serializationVersion) | ||
}) | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions
4
domain/NonFunctionalRequirement.ts → ...system/domain/NonFunctionalRequirement.ts
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,4 @@ | ||
import Behavior from "./Behavior"; | ||
|
||
/** | ||
* Property of how the system achieves an outcome | ||
*/ | ||
|
||
export default class NonFunctionalRequirement extends Behavior { } |
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
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
modules/system/mappers/FunctionalRequirementToJsonMapper.ts
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,19 @@ | ||
import type { RequirementJson } from "~/mappers/RequirementToJsonMapper"; | ||
import FunctionalRequirement from "../domain/FunctionalRequirement"; | ||
import RequirementToJsonMapper from "~/mappers/RequirementToJsonMapper"; | ||
|
||
export interface FunctionalRequirementJson extends RequirementJson { } | ||
|
||
export default class FunctionalRequirementToJsonMapper extends RequirementToJsonMapper { | ||
override mapTo(source: FunctionalRequirement): FunctionalRequirementJson { | ||
return { | ||
...super.mapTo(source) | ||
}; | ||
} | ||
|
||
override mapFrom(target: FunctionalRequirementJson): FunctionalRequirement { | ||
return new FunctionalRequirement({ | ||
...super.mapFrom(target) | ||
}); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
modules/system/mappers/NonFunctionalRequirementToJsonMapper.ts
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,19 @@ | ||
import type { RequirementJson } from "~/mappers/RequirementToJsonMapper"; | ||
import NonFunctionalRequirement from "../domain/NonFunctionalRequirement"; | ||
import RequirementToJsonMapper from "~/mappers/RequirementToJsonMapper"; | ||
|
||
export interface NonFunctionalRequirementJson extends RequirementJson { } | ||
|
||
export default class NonFunctionalRequirementToJsonMapper extends RequirementToJsonMapper { | ||
override mapTo(source: NonFunctionalRequirement): NonFunctionalRequirementJson { | ||
return { | ||
...super.mapTo(source) | ||
}; | ||
} | ||
|
||
override mapFrom(target: NonFunctionalRequirementJson): NonFunctionalRequirement { | ||
return new NonFunctionalRequirement({ | ||
...super.mapFrom(target) | ||
}); | ||
} | ||
} |
Oops, something went wrong.