diff --git a/src/app/checkout.ts b/src/app/checkout.ts index 9acfa84..1cda9d0 100644 --- a/src/app/checkout.ts +++ b/src/app/checkout.ts @@ -11,7 +11,7 @@ import * as restate from "@restatedev/restate-sdk"; -const doCheckout = async ( +const checkout = async ( ctx: restate.RpcContext, request: { userId: string; tickets: string[] }, ) => { @@ -19,7 +19,7 @@ const doCheckout = async ( }; export const checkoutRouter = restate.router({ - checkout: doCheckout, + checkout: checkout, }); export const checkoutApi: restate.ServiceApi = { diff --git a/src/app/ticket_service.ts b/src/app/ticket_service.ts index b0bfeae..eae7671 100644 --- a/src/app/ticket_service.ts +++ b/src/app/ticket_service.ts @@ -17,22 +17,22 @@ enum TicketStatus { Sold, } -const doReserveTicket = async (ctx: restate.RpcContext) => { +const reserve = async (ctx: restate.RpcContext) => { return true; }; -const doUnreserveTicket = async (ctx: restate.RpcContext) => { +const unreserve = async (ctx: restate.RpcContext) => { return true; }; -const doMarkAsSold = async (ctx: restate.RpcContext) => { +const markAsSold = async (ctx: restate.RpcContext) => { return true; }; export const ticketDbRouter = restate.keyedRouter({ - reserve: doReserveTicket, - unreserve: doUnreserveTicket, - markAsSold: doMarkAsSold, + reserve: reserve, + unreserve: unreserve, + markAsSold: markAsSold, }); export const ticketServiceApi: restate.ServiceApi = { diff --git a/src/app/user_session.ts b/src/app/user_session.ts index 0f96d3d..d3dfc1d 100644 --- a/src/app/user_session.ts +++ b/src/app/user_session.ts @@ -11,7 +11,7 @@ import * as restate from "@restatedev/restate-sdk"; -const doAddTicket = async ( +const addTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, @@ -19,20 +19,20 @@ const doAddTicket = async ( return true; }; -const doExpireTicket = async ( +const expireTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, -) => {}; +) => { }; -const doCheckout = async (ctx: restate.RpcContext, userId: string) => { +const checkout = async (ctx: restate.RpcContext, userId: string) => { return true; }; export const userSessionRouter = restate.keyedRouter({ - addTicket: doAddTicket, - expireTicket: doExpireTicket, - checkout: doCheckout, + addTicket: addTicket, + expireTicket: expireTicket, + checkout: checkout, }); export const userSessionApi: restate.ServiceApi = { diff --git a/src/part1/checkout.ts b/src/part1/checkout.ts index 9acfa84..1cda9d0 100644 --- a/src/part1/checkout.ts +++ b/src/part1/checkout.ts @@ -11,7 +11,7 @@ import * as restate from "@restatedev/restate-sdk"; -const doCheckout = async ( +const checkout = async ( ctx: restate.RpcContext, request: { userId: string; tickets: string[] }, ) => { @@ -19,7 +19,7 @@ const doCheckout = async ( }; export const checkoutRouter = restate.router({ - checkout: doCheckout, + checkout: checkout, }); export const checkoutApi: restate.ServiceApi = { diff --git a/src/part1/ticket_service.ts b/src/part1/ticket_service.ts index 7df912c..dd35b8d 100644 --- a/src/part1/ticket_service.ts +++ b/src/part1/ticket_service.ts @@ -18,23 +18,23 @@ enum TicketStatus { Sold, } -const doReserveTicket = async (ctx: restate.RpcContext) => { +const reserve = async (ctx: restate.RpcContext) => { await setTimeout(35000); return true; }; -const doUnreserveTicket = async (ctx: restate.RpcContext) => { +const unreserve = async (ctx: restate.RpcContext) => { return true; }; -const doMarkAsSold = async (ctx: restate.RpcContext) => { +const markAsSold = async (ctx: restate.RpcContext) => { return true; }; export const ticketDbRouter = restate.keyedRouter({ - reserve: doReserveTicket, - unreserve: doUnreserveTicket, - markAsSold: doMarkAsSold, + reserve: reserve, + unreserve: unreserve, + markAsSold: markAsSold, }); export const ticketServiceApi: restate.ServiceApi = { diff --git a/src/part1/user_session.ts b/src/part1/user_session.ts index 06a20d6..c7453eb 100644 --- a/src/part1/user_session.ts +++ b/src/part1/user_session.ts @@ -13,7 +13,7 @@ import * as restate from "@restatedev/restate-sdk"; import { ticketServiceApi } from "./ticket_service"; import { checkoutApi } from "./checkout"; -const doAddTicket = async ( +const addTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, @@ -22,7 +22,7 @@ const doAddTicket = async ( return true; }; -const doExpireTicket = async ( +const expireTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, @@ -30,7 +30,7 @@ const doExpireTicket = async ( ctx.send(ticketServiceApi).unreserve(ticketId); }; -const doCheckout = async (ctx: restate.RpcContext, userId: string) => { +const checkout = async (ctx: restate.RpcContext, userId: string) => { const checkoutRequest = { userId: userId, tickets: ["456"] }; const success = await ctx.rpc(checkoutApi).checkout(checkoutRequest); @@ -38,9 +38,9 @@ const doCheckout = async (ctx: restate.RpcContext, userId: string) => { }; export const userSessionRouter = restate.keyedRouter({ - addTicket: doAddTicket, - expireTicket: doExpireTicket, - checkout: doCheckout, + addTicket: addTicket, + expireTicket: expireTicket, + checkout: checkout, }); export const userSessionApi: restate.ServiceApi = { diff --git a/src/part2/checkout.ts b/src/part2/checkout.ts index 9acfa84..1cda9d0 100644 --- a/src/part2/checkout.ts +++ b/src/part2/checkout.ts @@ -11,7 +11,7 @@ import * as restate from "@restatedev/restate-sdk"; -const doCheckout = async ( +const checkout = async ( ctx: restate.RpcContext, request: { userId: string; tickets: string[] }, ) => { @@ -19,7 +19,7 @@ const doCheckout = async ( }; export const checkoutRouter = restate.router({ - checkout: doCheckout, + checkout: checkout, }); export const checkoutApi: restate.ServiceApi = { diff --git a/src/part2/ticket_service.ts b/src/part2/ticket_service.ts index 6c68386..37d0de3 100644 --- a/src/part2/ticket_service.ts +++ b/src/part2/ticket_service.ts @@ -17,7 +17,7 @@ enum TicketStatus { Sold, } -const doReserveTicket = async (ctx: restate.RpcContext) => { +const reserve = async (ctx: restate.RpcContext) => { const status = (await ctx.get("status")) || TicketStatus.Available; @@ -29,7 +29,7 @@ const doReserveTicket = async (ctx: restate.RpcContext) => { } }; -const doUnreserveTicket = async (ctx: restate.RpcContext) => { +const unreserve = async (ctx: restate.RpcContext) => { const status = (await ctx.get("status")) || TicketStatus.Available; @@ -41,7 +41,7 @@ const doUnreserveTicket = async (ctx: restate.RpcContext) => { } }; -const doMarkAsSold = async (ctx: restate.RpcContext) => { +const markAsSold = async (ctx: restate.RpcContext) => { const status = (await ctx.get("status")) || TicketStatus.Available; @@ -54,9 +54,9 @@ const doMarkAsSold = async (ctx: restate.RpcContext) => { }; export const ticketDbRouter = restate.keyedRouter({ - reserve: doReserveTicket, - unreserve: doUnreserveTicket, - markAsSold: doMarkAsSold, + reserve: reserve, + unreserve: unreserve, + markAsSold: markAsSold, }); export const ticketServiceApi: restate.ServiceApi = { diff --git a/src/part2/user_session.ts b/src/part2/user_session.ts index 07eb4ef..67e2316 100644 --- a/src/part2/user_session.ts +++ b/src/part2/user_session.ts @@ -13,7 +13,7 @@ import * as restate from "@restatedev/restate-sdk"; import { ticketServiceApi } from "./ticket_service"; import { checkoutApi } from "./checkout"; -const doAddTicket = async ( +const addTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, @@ -33,7 +33,7 @@ const doAddTicket = async ( return reservationSuccess; }; -const doExpireTicket = async ( +const expireTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, @@ -50,7 +50,7 @@ const doExpireTicket = async ( } }; -const doCheckout = async (ctx: restate.RpcContext, userId: string) => { +const checkout = async (ctx: restate.RpcContext, userId: string) => { const tickets = await ctx.get("tickets"); if (tickets === null || tickets.length === 0) { @@ -69,9 +69,9 @@ const doCheckout = async (ctx: restate.RpcContext, userId: string) => { }; export const userSessionRouter = restate.keyedRouter({ - addTicket: doAddTicket, - expireTicket: doExpireTicket, - checkout: doCheckout, + addTicket: addTicket, + expireTicket: expireTicket, + checkout: checkout, }); export const userSessionApi: restate.ServiceApi = { diff --git a/src/part3/checkout.ts b/src/part3/checkout.ts index 05ee19b..a788b05 100644 --- a/src/part3/checkout.ts +++ b/src/part3/checkout.ts @@ -14,7 +14,7 @@ import { v4 as uuid } from "uuid"; import { PaymentClient } from "../aux/payment_client"; import { EmailClient } from "../aux/email_client"; -const doCheckout = async ( +const checkout = async ( ctx: restate.RpcContext, request: { userId: string; tickets: string[] }, ) => { @@ -46,7 +46,7 @@ const doCheckout = async ( }; export const checkoutRouter = restate.router({ - checkout: doCheckout, + checkout: checkout, }); export const checkoutApi: restate.ServiceApi = { diff --git a/src/part3/ticket_service.ts b/src/part3/ticket_service.ts index 6c68386..37d0de3 100644 --- a/src/part3/ticket_service.ts +++ b/src/part3/ticket_service.ts @@ -17,7 +17,7 @@ enum TicketStatus { Sold, } -const doReserveTicket = async (ctx: restate.RpcContext) => { +const reserve = async (ctx: restate.RpcContext) => { const status = (await ctx.get("status")) || TicketStatus.Available; @@ -29,7 +29,7 @@ const doReserveTicket = async (ctx: restate.RpcContext) => { } }; -const doUnreserveTicket = async (ctx: restate.RpcContext) => { +const unreserve = async (ctx: restate.RpcContext) => { const status = (await ctx.get("status")) || TicketStatus.Available; @@ -41,7 +41,7 @@ const doUnreserveTicket = async (ctx: restate.RpcContext) => { } }; -const doMarkAsSold = async (ctx: restate.RpcContext) => { +const markAsSold = async (ctx: restate.RpcContext) => { const status = (await ctx.get("status")) || TicketStatus.Available; @@ -54,9 +54,9 @@ const doMarkAsSold = async (ctx: restate.RpcContext) => { }; export const ticketDbRouter = restate.keyedRouter({ - reserve: doReserveTicket, - unreserve: doUnreserveTicket, - markAsSold: doMarkAsSold, + reserve: reserve, + unreserve: unreserve, + markAsSold: markAsSold, }); export const ticketServiceApi: restate.ServiceApi = { diff --git a/src/part3/user_session.ts b/src/part3/user_session.ts index 479d2fd..0c430a8 100644 --- a/src/part3/user_session.ts +++ b/src/part3/user_session.ts @@ -13,7 +13,7 @@ import * as restate from "@restatedev/restate-sdk"; import { ticketServiceApi } from "./ticket_service"; import { checkoutApi } from "./checkout"; -const doAddTicket = async ( +const addTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, @@ -33,7 +33,7 @@ const doAddTicket = async ( return reservationSuccess; }; -const doExpireTicket = async ( +const expireTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, @@ -50,7 +50,7 @@ const doExpireTicket = async ( } }; -const doCheckout = async (ctx: restate.RpcContext, userId: string) => { +const checkout = async (ctx: restate.RpcContext, userId: string) => { const tickets = await ctx.get("tickets"); if (tickets && tickets.length > 0) { @@ -74,9 +74,9 @@ const doCheckout = async (ctx: restate.RpcContext, userId: string) => { }; export const userSessionRouter = restate.keyedRouter({ - addTicket: doAddTicket, - expireTicket: doExpireTicket, - checkout: doCheckout, + addTicket: addTicket, + expireTicket: expireTicket, + checkout: checkout, }); export const userSessionApi: restate.ServiceApi = { diff --git a/src/part4/checkout.ts b/src/part4/checkout.ts index f8a3ed7..568874e 100644 --- a/src/part4/checkout.ts +++ b/src/part4/checkout.ts @@ -14,7 +14,7 @@ import { v4 as uuid } from "uuid"; import { EmailClient } from "../aux/email_client"; import { PaymentClient } from "../aux/payment_client"; -const doCheckout = async ( +const checkout = async ( ctx: restate.RpcContext, request: { userId: string; tickets: string[] }, ) => { @@ -48,7 +48,7 @@ const doCheckout = async ( }; export const checkoutRouter = restate.router({ - checkout: doCheckout, + checkout: checkout, }); export const checkoutApi: restate.ServiceApi = { diff --git a/src/part4/ticket_service.ts b/src/part4/ticket_service.ts index 6c68386..37d0de3 100644 --- a/src/part4/ticket_service.ts +++ b/src/part4/ticket_service.ts @@ -17,7 +17,7 @@ enum TicketStatus { Sold, } -const doReserveTicket = async (ctx: restate.RpcContext) => { +const reserve = async (ctx: restate.RpcContext) => { const status = (await ctx.get("status")) || TicketStatus.Available; @@ -29,7 +29,7 @@ const doReserveTicket = async (ctx: restate.RpcContext) => { } }; -const doUnreserveTicket = async (ctx: restate.RpcContext) => { +const unreserve = async (ctx: restate.RpcContext) => { const status = (await ctx.get("status")) || TicketStatus.Available; @@ -41,7 +41,7 @@ const doUnreserveTicket = async (ctx: restate.RpcContext) => { } }; -const doMarkAsSold = async (ctx: restate.RpcContext) => { +const markAsSold = async (ctx: restate.RpcContext) => { const status = (await ctx.get("status")) || TicketStatus.Available; @@ -54,9 +54,9 @@ const doMarkAsSold = async (ctx: restate.RpcContext) => { }; export const ticketDbRouter = restate.keyedRouter({ - reserve: doReserveTicket, - unreserve: doUnreserveTicket, - markAsSold: doMarkAsSold, + reserve: reserve, + unreserve: unreserve, + markAsSold: markAsSold, }); export const ticketServiceApi: restate.ServiceApi = { diff --git a/src/part4/user_session.ts b/src/part4/user_session.ts index e4cff53..84dba0c 100644 --- a/src/part4/user_session.ts +++ b/src/part4/user_session.ts @@ -13,7 +13,7 @@ import * as restate from "@restatedev/restate-sdk"; import { ticketServiceApi } from "./ticket_service"; import { checkoutApi } from "./checkout"; -const doAddTicket = async ( +const addTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, @@ -36,7 +36,7 @@ const doAddTicket = async ( return reservation_success; }; -const doExpireTicket = async ( +const expireTicket = async ( ctx: restate.RpcContext, userId: string, ticketId: string, @@ -54,7 +54,7 @@ const doExpireTicket = async ( } }; -const doCheckout = async (ctx: restate.RpcContext, userId: string) => { +const checkout = async (ctx: restate.RpcContext, userId: string) => { const tickets = await ctx.get("tickets"); if (tickets && tickets.length > 0) { @@ -78,9 +78,9 @@ const doCheckout = async (ctx: restate.RpcContext, userId: string) => { }; export const userSessionRouter = restate.keyedRouter({ - addTicket: doAddTicket, - expireTicket: doExpireTicket, - checkout: doCheckout, + addTicket: addTicket, + expireTicket: expireTicket, + checkout: checkout, }); export const userSessionApi: restate.ServiceApi = {