@@ -36,6 +36,7 @@ import {
3636 getDefaultFilteringQuerystring ,
3737 nonEmptyCommaSeparatedStringSchema ,
3838} from "common/utils.js" ;
39+ import { ROOM_RESERVATION_RETENTION_DAYS } from "common/constants.js" ;
3940
4041const roomRequestRoutes : FastifyPluginAsync = async ( fastify , _options ) => {
4142 await fastify . register ( rateLimiter , {
@@ -104,6 +105,9 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
104105 semesterId,
105106 "createdAt#status" : `${ createdAt } #${ request . body . status } ` ,
106107 createdBy : request . username ,
108+ expiresAt :
109+ Math . floor ( Date . now ( ) / 1000 ) +
110+ 86400 * ROOM_RESERVATION_RETENTION_DAYS ,
107111 ...request . body ,
108112 } ,
109113 { removeUndefinedValues : true } ,
@@ -315,6 +319,9 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
315319 userId : request . username ,
316320 "userId#requestId" : `${ request . username } #${ requestId } ` ,
317321 semesterId : request . body . semester ,
322+ expiresAt :
323+ Math . floor ( Date . now ( ) / 1000 ) +
324+ 86400 * ROOM_RESERVATION_RETENTION_DAYS ,
318325 } ;
319326 const logStatement = buildAuditLogTransactPut ( {
320327 entry : {
@@ -344,6 +351,9 @@ const roomRequestRoutes: FastifyPluginAsync = async (fastify, _options) => {
344351 "createdAt#status" : `${ createdAt } #${ RoomRequestStatus . CREATED } ` ,
345352 createdBy : request . username ,
346353 status : RoomRequestStatus . CREATED ,
354+ expiresAt :
355+ Math . floor ( Date . now ( ) / 1000 ) +
356+ 86400 * ROOM_RESERVATION_RETENTION_DAYS ,
347357 notes : "This request was created by the user." ,
348358 } ) ,
349359 } ,
0 commit comments