@@ -103,7 +103,7 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
103103 ...request . body ,
104104 } ) ,
105105 } ;
106- const logPut = buildAuditLogTransactPut ( {
106+ const logStatement = buildAuditLogTransactPut ( {
107107 entry : {
108108 module : Modules . ROOM_RESERVATIONS ,
109109 actor : request . username ! ,
@@ -115,7 +115,10 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
115115 try {
116116 await fastify . dynamoClient . send (
117117 new TransactWriteItemsCommand ( {
118- TransactItems : [ { Put : itemPut } , logPut ] ,
118+ TransactItems : [
119+ { Put : itemPut } ,
120+ ...( logStatement ? [ logStatement ] : [ ] ) ,
121+ ] ,
119122 } ) ,
120123 ) ;
121124 } catch ( e ) {
@@ -292,7 +295,7 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
292295 "userId#requestId" : `${ request . username } #${ requestId } ` ,
293296 semesterId : request . body . semester ,
294297 } ;
295- const logPut = buildAuditLogTransactPut ( {
298+ const logStatement = buildAuditLogTransactPut ( {
296299 entry : {
297300 module : Modules . ROOM_RESERVATIONS ,
298301 actor : request . username ! ,
@@ -324,7 +327,7 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
324327 } ) ,
325328 } ,
326329 } ,
327- logPut ,
330+ ... ( logStatement ? [ logStatement ] : [ ] ) ,
328331 ] ,
329332 } ) ;
330333 await fastify . dynamoClient . send ( transactionCommand ) ;
0 commit comments