@@ -48,6 +48,8 @@ import {
4848  getAllLinks , 
4949}  from  "api/functions/linkry.js" ; 
5050import  {  intersection  }  from  "api/plugins/auth.js" ; 
51+ import  {  createAuditLogEntry  }  from  "api/functions/auditLog.js" ; 
52+ import  {  Modules  }  from  "common/modules.js" ; 
5153
5254type  OwnerRecord  =  { 
5355  slug : string ; 
@@ -453,6 +455,15 @@ const linkryRoutes: FastifyPluginAsync = async (fastify, _options) => {
453455            message : "Failed to save redirect to Cloudfront KV store." , 
454456          } ) ; 
455457        } 
458+         await  createAuditLogEntry ( { 
459+           dynamoClient : fastify . dynamoClient , 
460+           entry : { 
461+             module : Modules . LINKRY , 
462+             actor : request . username ! , 
463+             target : request . body . slug , 
464+             message : `Created redirect to "${ request . body . redirect }  "` , 
465+           } , 
466+         } ) ; 
456467        return  reply . status ( 201 ) . send ( ) ; 
457468      } , 
458469    ) ; 
@@ -575,7 +586,6 @@ const linkryRoutes: FastifyPluginAsync = async (fastify, _options) => {
575586            } , 
576587          } , 
577588        ] ; 
578-         console . log ( JSON . stringify ( TransactItems ) ) ; 
579589        try  { 
580590          await  fastify . dynamoClient . send ( 
581591            new  TransactWriteItemsCommand ( {  TransactItems } ) , 
@@ -623,6 +633,15 @@ const linkryRoutes: FastifyPluginAsync = async (fastify, _options) => {
623633            message : "Failed to delete redirect at Cloudfront KV store." , 
624634          } ) ; 
625635        } 
636+         await  createAuditLogEntry ( { 
637+           dynamoClient : fastify . dynamoClient , 
638+           entry : { 
639+             module : Modules . LINKRY , 
640+             actor : request . username ! , 
641+             target : slug , 
642+             message : `Deleted short link redirect."` , 
643+           } , 
644+         } ) ; 
626645        reply . code ( 200 ) . send ( ) ; 
627646      } , 
628647    ) ; 
0 commit comments