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

[Server] Upgrade remaining dependencies #2165

Merged
12 changes: 6 additions & 6 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@
"ts-node": "^10.9.2",
"tsoa": "^6.3.1",
"twilio": "^5.2.0",
"typescript": "^4.9.5",
"uniqid": "^5.0.3",
"uuid": "^9.0.0",
"uuid": "^10.0.0",
"winston": "^3.2.1"
},
"devDependencies": {
Expand All @@ -63,16 +62,17 @@
"@types/node": "^20.14.9",
"@types/password-hash": "^1.2.20",
"@types/uniqid": "^5.3.0",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"concurrently": "^7.6.0",
"eslint": "^7.1.0",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"mockdate": "^3.0.5",
"mongodb": "^6.5.0",
"nodemon": "^3.1.0",
"ts-jest": "^29.1.1",
"tsconfig-paths": "^4.2.0"
"tsconfig-paths": "^4.2.0",
"typescript": "^5.5.3"
},
"engines": {
"node": "20.13.1",
Expand Down
4 changes: 2 additions & 2 deletions server/src/modules/langues/langues.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const updateLanguagesAvancement = async () => {
const nbActivesContents = activesContents.length;

try {
await activeLanguages.map(async (langue: Langue) => {
await Promise.all(activeLanguages.map(async (langue: Langue) => {
const nbPublishedTrad = await getCountDispositifs({
status: DispositifStatus.ACTIVE,
[`translations.${langue.i18nCode}`]: { $exists: true },
Expand All @@ -27,7 +27,7 @@ export const updateLanguagesAvancement = async () => {
const tradRatio = nbPublishedTrad / nbActivesContents;

await updateLanguageAvancementInDB(langue._id, tradRatio);
});
}));
logger.info("[updateLanguagesAvancement] successfully updated avancement");
} catch (e) {
logger.error("[updateLanguagesAvancement] error", e);
Expand Down
1 change: 0 additions & 1 deletion server/src/modules/mail/mail.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ export const sendPublishedFicheMailToStructureMembersService = async (
userId: data.userId,
dispositifId: data.dispositifId
});
return;
} catch (error) {
logger.error("[sendPublishedFicheMail] error", {
error: error.message
Expand Down
6 changes: 3 additions & 3 deletions server/src/modules/mail/mailFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export const sendPublishedMailToStructureMembers = async (
lien: string,
dispositifId: Dispositif["_id"],
) =>
membres.map((membre) => {
Promise.all(membres.map((membre) => {
logger.info("[sendPublishedMailToStructureMembers] send mail to membre", {
membreId: membre._id,
});
return sendPublishedFicheMailToStructureMembersService({
void sendPublishedFicheMailToStructureMembersService({
pseudo: membre.username,
titreInformatif: titreInformatif,
titreMarque: titreMarque,
Expand All @@ -58,4 +58,4 @@ export const sendPublishedMailToStructureMembers = async (
dispositifId,
userId: membre._id,
});
});
}));
2 changes: 1 addition & 1 deletion server/src/modules/mail/sendMailWhenDispositifPublished.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const sendMailWhenDispositifPublished = async (dispo: Dispositif) => {
const titreMarque = dispo.translations.fr.content.titreMarque;
const lien = "https://refugies.info/" + dispo.typeContenu + "/" + dispo._id;

await sendPublishedMailToStructureMembers(membresToSendMail, titreInformatif, titreMarque, lien, dispo._id);
void sendPublishedMailToStructureMembers(membresToSendMail, titreInformatif, titreMarque, lien, dispo._id);
const isCreatorInStructure =
structureMembres.filter((membre) => membre.userId.toString() === dispo.creatorId.toString()).length > 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const sendReminderEmails = async (recipient: FormattedDispositif, reminder: "fir

await sendMultipleDraftsReminderMailService(recipient.email, recipient.username, recipient.creatorId, reminder);

recipient.dispositifs.map(async (dispositif) => {
await Promise.all(recipient.dispositifs.map(async (dispositif) => {
const updatedDispositif =
reminder === "first"
? {
Expand All @@ -53,8 +53,7 @@ const sendReminderEmails = async (recipient: FormattedDispositif, reminder: "fir
};
await updateDispositifInDB(dispositif._id, updatedDispositif);
await log(dispositif._id, reminder);
});
return;
}));
} catch (error) {
logger.error("[sendDraftReminderMail] error with the recipient", {
creatorId: recipient.creatorId
Expand Down
8 changes: 5 additions & 3 deletions server/src/workflows/themes/postThemes/postThemes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ResponseWithData } from "../../../types/interface";
import { createTheme } from "../../../modules/themes/themes.repository";
import { getActiveLanguagesFromDB } from "../../../modules/langues/langues.repository";
import { getAllAppUsers, updateNotificationsSettings } from "../../../modules/appusers/appusers.repository";
import map from "lodash/fp/map";
import { AppUser, Theme } from "../../../typegoose";
import { PostThemeResponse, ThemeRequest } from "@refugies-info/api-types";

Expand All @@ -19,8 +18,11 @@ export const addThemeInNotificationSettingsForUser = (theme: Theme) => (user: Ap
themes: { ...user.notificationsSettings.themes, [`${theme._id}`]: hasOneNotificationEnabled(user) },
});

const updateUsersNotificationsSettings = async (theme: Theme) =>
getAllAppUsers().then(map(addThemeInNotificationSettingsForUser(theme)));
const updateUsersNotificationsSettings = async (theme: Theme) => {
const appUsers = await getAllAppUsers()
// TODO: use a batch update (see https://github.com/refugies-info/karfur/issues/2166)
return Promise.all(appUsers.map(addThemeInNotificationSettingsForUser(theme)));
revolunet marked this conversation as resolved.
Show resolved Hide resolved
}

export const postThemes = async (theme: ThemeRequest): ResponseWithData<PostThemeResponse> => {
logger.info("[postThemes] received", theme);
Expand Down
Loading