-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BC-7772 introduce ddd objects #5167
base: main
Are you sure you want to change the base?
Conversation
…l that is easy usable, but optional.
describe('When value object with modification is created.', () => { | ||
const setup = () => { | ||
class Name extends ValueObject<string> { | ||
protected modified(value: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing the boilerplate with array of functions that can be execute will improve the usability
modifications: [this.removeWithspacesAtBeginning, this.truncatedToLength4]
validations: [TypeGuard.isString, this.isValidLength]
In this case it is also easy to use same hooks for different value objects. But it is harder to implement with ts. We should look togehter into it.
}); | ||
}); | ||
|
||
describe('By usage of primitive array as value object', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"of array with primitive values"
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return value; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO:
} | ||
|
||
/** Use this method with override for add modifications, before execute the validation. */ | ||
protected modified(value: T): T { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO:
export abstract class ValueObject<T extends ValueObjectTyp> { | ||
public readonly value: T; | ||
|
||
constructor(value: T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO:
Quality Gate failedFailed conditions |
|
||
type ValueObjectTyp = PrimitiveType | PrimitiveTypeArray; | ||
|
||
export abstract class ValueObject<T extends ValueObjectTyp> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ergibt es überhaupt Sinn eine abstrakte Klasse für Value Objects einzuführen? Geht uns dadurch nicht ganz viel Fachlichkeit verloren, wenn zB der Wert immer Value heißt? Was an der abstrakten Klasse bietet wirklich einen Mehrwert beim entwickeln?
Description
Links to Tickets or other pull requests
Changes
Datasecurity
Deployment
New Repos, NPM pakages or vendor scripts
Approval for review
generate-client:server
was executed in vue frontend and changes were tested and put in a PR with the same branch name.