wip
This commit is contained in:
3
packages/shared/domain/Entity.ts
Normal file
3
packages/shared/domain/Entity.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export interface IEntity<Id = string> {
|
||||
readonly id: Id;
|
||||
}
|
||||
24
packages/shared/domain/Service.ts
Normal file
24
packages/shared/domain/Service.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { Result } from '../result/Result';
|
||||
import type { IDomainError } from '../errors/DomainError';
|
||||
|
||||
export interface IDomainService {
|
||||
readonly serviceName?: string;
|
||||
}
|
||||
|
||||
export interface IDomainCalculationService<Input, Output> extends IDomainService {
|
||||
calculate(input: Input): Output;
|
||||
}
|
||||
|
||||
export interface IResultDomainCalculationService<Input, Output, Error = IDomainError>
|
||||
extends IDomainService {
|
||||
calculate(input: Input): Result<Output, Error>;
|
||||
}
|
||||
|
||||
export interface IDomainValidationService<Input, Output, Error = IDomainError>
|
||||
extends IDomainService {
|
||||
validate(input: Input): Result<Output, Error>;
|
||||
}
|
||||
|
||||
export interface IDomainFactoryService<Input, Output> extends IDomainService {
|
||||
create(input: Input): Output;
|
||||
}
|
||||
4
packages/shared/domain/ValueObject.ts
Normal file
4
packages/shared/domain/ValueObject.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export interface IValueObject<Props> {
|
||||
readonly props: Props;
|
||||
equals(other: IValueObject<Props>): boolean;
|
||||
}
|
||||
3
packages/shared/domain/index.ts
Normal file
3
packages/shared/domain/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './Entity';
|
||||
export * from './ValueObject';
|
||||
export * from './Service';
|
||||
Reference in New Issue
Block a user