Closed GarrisonBates closed 2 months ago
Right now, a method like this: @Transaction({ readOnly: true }) @GetApi("/get-properties") static async getProperties(ctx: TransactionContext<any> & HandlerContext, clubId: number) {
@Transaction({ readOnly: true }) @GetApi("/get-properties") static async getProperties(ctx: TransactionContext<any> & HandlerContext, clubId: number) {
Will throw type errors because @Transaction expects ctx to be TransactionContext. The way HandlerContext was written avoids this issue, so I changed @Transaction to be typed the same way as generateApiDec: https://github.com/dbos-inc/dbos-transact/blob/60bd51f77ccbd283a36868beb5002825f68fd27f/src/httpServer/handler.ts#L252
This would be a huge QOL upgrade, since it would save the trouble of creating separate @Transaction methods for API endpoints.
Right now, a method like this:
@Transaction({ readOnly: true }) @GetApi("/get-properties") static async getProperties(ctx: TransactionContext<any> & HandlerContext, clubId: number) {
Will throw type errors because @Transaction expects ctx to be TransactionContext. The way HandlerContext was written avoids this issue, so I changed @Transaction to be typed the same way as generateApiDec:
https://github.com/dbos-inc/dbos-transact/blob/60bd51f77ccbd283a36868beb5002825f68fd27f/src/httpServer/handler.ts#L252
This would be a huge QOL upgrade, since it would save the trouble of creating separate @Transaction methods for API endpoints.