Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linting applied #384

Merged
merged 2 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading