Skip to content

Commit

Permalink
Fixed application setup
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Jun 12, 2024
1 parent 61da458 commit dac6e2c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ import { getEventStoreDBEventStore } from '@event-driven-io/emmett-esdb';
import { getApplication, startAPI } from '@event-driven-io/emmett-expressjs';
import { EventStoreDBClient } from '@eventstore/db-client';
import type { Application } from 'express';
import { shoppingCartApi } from './shoppingCarts/api';
import { guestStayAccountsApi } from './guestStayAccounts/api';

const eventStoreDBClient = EventStoreDBClient.connectionString(
process.env.ESDB_CONNECTION_STRING ?? `esdb://localhost:2113?tls=false`,
);
const eventStore = getEventStoreDBEventStore(eventStoreDBClient);

const getUnitPrice = (_productId: string) => {
return Promise.resolve(100);
};
const doesGuestStayExist = (_guestId: string, _roomId: string, _day: Date) =>
Promise.resolve(true);

const shoppingCarts = shoppingCartApi(
const shoppingCarts = guestStayAccountsApi(
eventStore,
getUnitPrice,
doesGuestStayExist,
() => new Date(),
);

Expand Down

0 comments on commit dac6e2c

Please sign in to comment.