-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/sparcs-kaist/taxi-back into #…
…273-안-읽은-메세지-확인
- Loading branch information
Showing
32 changed files
with
708 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const { eventConfig } = require("../../../loadenv"); | ||
const eventPeriod = eventConfig && { | ||
startAt: new Date(eventConfig.startAt), | ||
endAt: new Date(eventConfig.endAt), | ||
}; | ||
|
||
const timestampValidator = (req, res, next) => { | ||
if ( | ||
!eventPeriod || | ||
req.timestamp >= eventPeriod.endAt || | ||
req.timestamp < eventPeriod.startAt | ||
) { | ||
return res.status(400).json({ error: "out of date" }); | ||
} else { | ||
next(); | ||
} | ||
}; | ||
|
||
module.exports = timestampValidator; |
Oops, something went wrong.