Skip to content

Instantly share code, notes, and snippets.

@lukashavrlant
Created September 6, 2017 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukashavrlant/4563cfaf81c305b570217816835a10d8 to your computer and use it in GitHub Desktop.
Save lukashavrlant/4563cfaf81c305b570217816835a10d8 to your computer and use it in GitHub Desktop.
export class CreatePortfolioActionAdapter implements HttpActionBuilder<PortfolioManagementCommand> {
public constructor(
private entityRepository: EntityRepository<Entity>,
private responseBuilder: HttpResponseDataBuilder
) {
}
public build(request: HttpRequest, security: SecurityDescriptor): Promise<PortfolioManagementCommand> {
const portfolioId = new Uuidv4(request.getBodyData('portfolioId'));
const createPortfolioCommand = new CreatePortfolio(this.entityRepository, portfolioId);
return Promise.resolve(createPortfolioCommand);
}
public getResponseData(actionResult: ActionResult): HttpResponseData {
return this.responseBuilder.createResponseData(actionResult);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment