Skip to content

Commit

Permalink
Merge pull request #384 from RunTerror/master
Browse files Browse the repository at this point in the history
linting applied
  • Loading branch information
Akshatji800 authored Sep 28, 2024
2 parents 6cbbad5 + d706f60 commit 3f896ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
20 changes: 5 additions & 15 deletions graphql/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const Landmark = require("../models/landmark.js");
const { User } = require("../models/user.js");
const { MongoServerError } = require("mongodb");
const { parseBeaconObject, parseUserObject, parseLandmarkObject } = require("../parsing.js");
const landmark = require("../models/landmark.js");
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// even if we generate 10 IDs per hour,
// ~10 days needed, in order to have a 1% probability of at least one collision.
Expand Down Expand Up @@ -248,7 +247,7 @@ const resolvers = {
);
},

sendVerificationCode: async (_, {}, { user }) => {
sendVerificationCode: async (_, { user }) => {
const min = 1000;
const max = 9999;

Expand All @@ -273,14 +272,14 @@ const resolvers = {

return verificationCode;
},
completeVerification: async (_, {}, { user }) => {
completeVerification: async (_, { user }) => {
let currentUser = await User.findById(user.id);
currentUser.isVerified = true;
await currentUser.save();
return currentUser;
},

removeMember: async (_, { groupId, memberId }, { user, pubsub }) => {
removeMember: async (_, { groupId, memberId }, { user }) => {
const group = await Group.findById(groupId);
if (!group) return new UserInputError("No group exists with this code!");

Expand Down Expand Up @@ -349,12 +348,7 @@ const resolvers = {
await user.save();
return newGroup;
} catch (e) {
//try again only if shortcode collides.
if (e instanceof MongoServerError && e.keyValue["shortcode"]) {
} else {
//else return the error;
return new Error(e);
}
return new Error(e);
}
}
//if shortcode collides two times then return an error saying please try again.
Expand Down Expand Up @@ -640,10 +634,6 @@ const resolvers = {

return user;
},

changeLeader: async (_, { beaconID, newLeaderID }, { user }) => {
const beacon = await Beacon.findById(beaconID);
},
},
...(process.env._HANDLER == null && {
Subscription: {
Expand Down Expand Up @@ -713,7 +703,7 @@ const resolvers = {
(payload, variables, { user }) => {
const { groupID, groupMembers, groupLeader, groupUpdate } = payload;

let { newBeacon, groupId, deletedBeacon, updatedBeacon, newUser } = groupUpdate;
let { newBeacon, groupId, deletedBeacon, updatedBeacon } = groupUpdate;
if (newBeacon != null) {
if (newBeacon.leader._id == user.id) {
// stopping to listen to the creator of beacon
Expand Down
4 changes: 3 additions & 1 deletion parsing.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ function parseUserObject(userObject) {
updatedAt: convertToDate(userObject.updatedAt),
__v: userObject.__v,
};
} catch (error) {}
} catch (error) {
console.log(error);
}

return model;
}
Expand Down

0 comments on commit 3f896ce

Please sign in to comment.