Skip to content

Commit

Permalink
Use /users instead of /users/search
Browse files Browse the repository at this point in the history
  • Loading branch information
jasozh committed Jun 2, 2024
1 parent 3e19f20 commit 27fbcbd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions backend/src/events/controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ const addAttendee = async (eventID: string, userID: string) => {
textBody
);
const userPreferences = await userController.getUserPreferences(userID);
if (userPreferences?.preferences?.sendEmailNotification == true) {
if (userPreferences?.preferences?.sendEmailNotification === true) {
await sendEmail(
userEmail,
"Your registration was successful.",
Expand Down Expand Up @@ -421,7 +421,7 @@ const deleteAttendee = async (
textBody
);
const userPreferences = await userController.getUserPreferences(userID);
if (userPreferences?.preferences?.sendEmailNotification == true) {
if (userPreferences?.preferences?.sendEmailNotification === true) {
await sendEmail(
userEmail,
"Your event cancellation was successful.",
Expand Down Expand Up @@ -510,11 +510,11 @@ const confirmUser = async (eventID: string, userID: string) => {
textBody
);
const userPreferences = await userController.getUserPreferences(userID);
if (userPreferences?.preferences?.sendEmailNotification == true) {
if (userPreferences?.preferences?.sendEmailNotification === true) {
await sendEmail(
userEmail,
"Your attendance has been confirmed",
updatedHtml
userEmail,
"Your attendance has been confirmed",
updatedHtml
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions backend/src/users/controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ const getUsers = async (
},
include: {
profile: true,
preferences: true,
events: eventId
? {
where: {
Expand Down Expand Up @@ -351,7 +352,6 @@ const getSearchedUser = async (
},
include: {
profile: true,
preferences: true,
},
});
};
Expand Down Expand Up @@ -607,7 +607,7 @@ const editRole = async (userId: string, role: string) => {

if (process.env.NODE_ENV != "test") {
const userPreferences = await userController.getUserPreferences(userId);
if (userPreferences?.preferences?.sendEmailNotification == true) {
if (userPreferences?.preferences?.sendEmailNotification === true) {
if (prevUserRole === "SUPERVISOR" && role === "ADMIN") {
const updatedHtml = replaceUserInputs(
stringUserUpdate,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const Profile = () => {
const { data, isLoading, isError } = useQuery({
queryKey: ["profile", user?.email],
queryFn: async () => {
const { data } = await api.get(`/users/search/?email=${user?.email}`);
return data["data"][0];
const { data } = await api.get(`/users?email=${user?.email}`);
return data["data"]["result"][0];
},
});

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
* @returns the userid
*/
export const fetchUserIdFromDatabase = async (email: string) => {
const { data } = await api.get(`/users/search/?email=${email}`);
return data["data"][0]["id"];
const { data } = await api.get(`/users?email=${email}`);
return data["data"]["result"][0]["id"];
};

/**
Expand Down

0 comments on commit 27fbcbd

Please sign in to comment.