wip
This commit is contained in:
18
packages/shared/application/Service.ts
Normal file
18
packages/shared/application/Service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { Result } from '../result/Result';
|
||||
import type { IApplicationError } from '../errors/ApplicationError';
|
||||
|
||||
export interface IApplicationService {
|
||||
readonly serviceName?: string;
|
||||
}
|
||||
|
||||
export interface IAsyncApplicationService<Input, Output> extends IApplicationService {
|
||||
execute(input: Input): Promise<Output>;
|
||||
}
|
||||
|
||||
export interface IAsyncResultApplicationService<
|
||||
Input,
|
||||
Output,
|
||||
Error = IApplicationError
|
||||
> extends IApplicationService {
|
||||
execute(input: Input): Promise<Result<Output, Error>>;
|
||||
}
|
||||
17
packages/shared/application/UseCase.ts
Normal file
17
packages/shared/application/UseCase.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Result } from '../result/Result';
|
||||
|
||||
export interface IUseCase<Input, Output> {
|
||||
execute(input: Input): Output;
|
||||
}
|
||||
|
||||
export interface AsyncUseCase<Input, Output> {
|
||||
execute(input: Input): Promise<Output>;
|
||||
}
|
||||
|
||||
export interface ResultUseCase<Input, Output, Error = unknown> {
|
||||
execute(input: Input): Result<Output, Error>;
|
||||
}
|
||||
|
||||
export interface AsyncResultUseCase<Input, Output, Error = unknown> {
|
||||
execute(input: Input): Promise<Result<Output, Error>>;
|
||||
}
|
||||
2
packages/shared/application/index.ts
Normal file
2
packages/shared/application/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './UseCase';
|
||||
export * from './Service';
|
||||
Reference in New Issue
Block a user