-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
723 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from './lib/entities'; | ||
export * from './lib/service'; | ||
export * from './lib/services'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import { entity, JSONEntity, JSONPartial, uuid, UUID } from '@deepkit/type'; | ||
|
||
import { Consumer } from '@ftgo/consumer-service-api'; | ||
import { entity, uuid, UUID } from '@deepkit/type'; | ||
|
||
@entity.name('account') | ||
export class Account { | ||
readonly id: UUID = uuid(); | ||
readonly consumerId: Consumer['id']; | ||
|
||
static create(data: JSONPartial<Account>): Account { | ||
return Object.assign(new Account(), data); | ||
} | ||
constructor(readonly consumerId: UUID) {} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { RestateService } from 'deepkit-restate'; | ||
import { UUID } from '@deepkit/type'; | ||
|
||
import { Consumer } from '@ftgo/consumer-service-api'; | ||
import { Money } from '@ftgo/common'; | ||
|
||
export interface AccountingServiceHandlers { | ||
// Only required for handlers that need to be invoked directly using a Restate client | ||
createAccount(consumer: Consumer): Promise<void>; | ||
authorize( | ||
consumerId: UUID, | ||
orderId: UUID, | ||
orderTotal: Money, | ||
): Promise<unknown>; | ||
reverseAuthorization( | ||
consumerId: UUID, | ||
orderId: UUID, | ||
orderTotal: Money, | ||
): Promise<unknown>; | ||
} | ||
|
||
export type AccountingServiceApi = RestateService< | ||
'Accounting', | ||
AccountingServiceHandlers | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# Framework | ||
SERVER_PORT=3000 | ||
SERVER_DEBUG=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { createModule } from '@deepkit/app'; | ||
import { provideRestateServiceProxy } from 'deepkit-restate'; | ||
|
||
import { provideAccountingServiceApi } from '@ftgo/accounting-service-api'; | ||
import { AccountingServiceApi } from '@ftgo/accounting-service-api'; | ||
|
||
import { AccountingController } from './accounting.controller'; | ||
|
||
export class AccountingModule extends createModule({ | ||
controllers: [AccountingController], | ||
providers: [provideAccountingServiceApi()], | ||
providers: [provideRestateServiceProxy<AccountingServiceApi>()], | ||
}) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { createModule } from '@deepkit/app'; | ||
import { provideRestateServiceProxy } from 'deepkit-restate'; | ||
|
||
import { provideConsumerServiceApi } from '@ftgo/consumer-service-api'; | ||
import { ConsumerServiceApi } from '@ftgo/consumer-service-api'; | ||
|
||
import { ConsumerController } from './consumer.controller'; | ||
|
||
export class ConsumerModule extends createModule({ | ||
controllers: [ConsumerController], | ||
providers: [provideConsumerServiceApi()], | ||
providers: [provideRestateServiceProxy<ConsumerServiceApi>()], | ||
}) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { createModule } from '@deepkit/app'; | ||
import { provideRestateServiceProxy } from 'deepkit-restate'; | ||
|
||
import { provideDeliveryServiceApi } from '@ftgo/delivery-service-api'; | ||
import { DeliveryServiceApi } from '@ftgo/delivery-service-api'; | ||
|
||
import { DeliveryController } from './delivery.controller'; | ||
|
||
export class DeliveryModule extends createModule({ | ||
controllers: [DeliveryController], | ||
providers: [provideDeliveryServiceApi()], | ||
providers: [provideRestateServiceProxy<DeliveryServiceApi>()], | ||
}) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { createModule } from '@deepkit/app'; | ||
import { provideRestateServiceProxy } from 'deepkit-restate'; | ||
|
||
import { provideKitchenServiceApi } from '@ftgo/kitchen-service-api'; | ||
import { KitchenServiceApi } from '@ftgo/kitchen-service-api'; | ||
|
||
import { KitchenController } from './kitchen.controller'; | ||
|
||
export class KitchenModule extends createModule({ | ||
controllers: [KitchenController], | ||
providers: [provideKitchenServiceApi()], | ||
providers: [provideRestateServiceProxy<KitchenServiceApi>()], | ||
}) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,33 @@ | ||
import { http } from '@deepkit/http'; | ||
import { http, HttpBody, HttpNotFoundError, HttpQuery } from '@deepkit/http'; | ||
import { RestateClient } from 'deepkit-restate'; | ||
import { UUID } from '@deepkit/type'; | ||
|
||
import { | ||
CreateOrderRequest, | ||
CreateOrderResponse, | ||
OrderServiceApi, | ||
} from '@ftgo/order-service-api'; | ||
|
||
@http.controller('order') | ||
export class OrderController {} | ||
export class OrderController { | ||
constructor( | ||
private readonly client: RestateClient, | ||
private readonly service: OrderServiceApi, | ||
) {} | ||
|
||
@http.POST('') | ||
async create( | ||
request: HttpBody<CreateOrderRequest>, | ||
): Promise<CreateOrderResponse> {} | ||
|
||
@http.GET(':id') | ||
async get(id: UUID) { | ||
try { | ||
} catch { | ||
throw new HttpNotFoundError(); | ||
} | ||
} | ||
|
||
@http.POST('cancel/:id') | ||
async cancel(id: UUID) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { createModule } from '@deepkit/app'; | ||
import { provideRestateServiceProxy } from 'deepkit-restate'; | ||
|
||
import { provideOrderServiceApi } from '@ftgo/order-service-api'; | ||
import { OrderServiceApi } from '@ftgo/order-service-api'; | ||
|
||
import { OrderController } from './order.controller'; | ||
|
||
export class OrderModule extends createModule({ | ||
controllers: [OrderController], | ||
providers: [provideOrderServiceApi()], | ||
providers: [provideRestateServiceProxy<OrderServiceApi>()], | ||
}) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { createModule } from '@deepkit/app'; | ||
import { provideRestateServiceProxy } from 'deepkit-restate'; | ||
|
||
import { provideRestaurantServiceApi } from '@ftgo/restaurant-service-api'; | ||
import { RestaurantServiceApi } from '@ftgo/restaurant-service-api'; | ||
|
||
import { RestaurantController } from './restaurant.controller'; | ||
|
||
export class RestaurantModule extends createModule({ | ||
controllers: [RestaurantController], | ||
providers: [provideRestaurantServiceApi()], | ||
providers: [provideRestateServiceProxy<RestaurantServiceApi>()], | ||
}) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from './lib/config'; | ||
export * from './lib/database'; | ||
export * from './lib/entities'; | ||
export * from './lib/errors'; | ||
export * from './lib/repository'; | ||
export * from './lib/types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export class UnsupportedStateTransitionException extends Error {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './lib/dtos'; | ||
export * from './lib/entities'; | ||
export * from './lib/service'; | ||
export * from './lib/services'; | ||
export * from './lib/topics'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { UUID } from '@deepkit/type'; | ||
|
||
import { Money } from '@ftgo/common'; | ||
|
||
export interface ValidateOrderRequest { | ||
readonly consumerId: UUID; | ||
readonly orderId: UUID; | ||
readonly orderTotal: Money; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,10 @@ | ||
import { | ||
entity, | ||
JSONEntity, | ||
JSONPartial, | ||
PrimaryKey, | ||
uuid, | ||
UUID, | ||
} from '@deepkit/type'; | ||
import { entity, PrimaryKey, uuid, UUID } from '@deepkit/type'; | ||
|
||
import { PersonName } from '@ftgo/common'; | ||
|
||
@entity.name('consumer') | ||
export class Consumer { | ||
readonly id: UUID & PrimaryKey = uuid(); | ||
readonly name: PersonName; | ||
|
||
static create(data: JSONPartial<Consumer>) { | ||
return Object.assign(new Consumer(), data); | ||
} | ||
constructor(readonly name: PersonName) {} | ||
} |
Oops, something went wrong.