Skip to content

Commit 60697e2

Browse files
fix: Users cannot join expired beacons. (#74)
* fix: Users cant join expired beacons. * Update graphql/resolvers.js Formated code. Co-authored-by: Aadi Bajpai <[email protected]> * This works! (tested locally) Co-authored-by: Aadi Bajpai <[email protected]>
1 parent 77d2772 commit 60697e2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

graphql/resolvers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ const resolvers = {
117117
const beacon = await Beacon.findOne({ shortcode });
118118

119119
if (!beacon) return new UserInputError("No beacon exists with that shortcode.");
120+
if (beacon.expiresAt < Date.now()) return new Error("Beacon has expired");
120121
if (beacon.followers.includes(user)) return new Error("Already following the beacon");
121122

122123
beacon.followers.push(user);

0 commit comments

Comments
 (0)