From f569e9163d7240c23b0c72995d3ab847d6152e4a Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 28 Mar 2020 14:04:27 +0100 Subject: [PATCH] Send a notification when a post is created --- src/controllers/PostsController.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/PostsController.ts b/src/controllers/PostsController.ts index 48acae9..d522389 100644 --- a/src/controllers/PostsController.ts +++ b/src/controllers/PostsController.ts @@ -19,6 +19,8 @@ import { statSync } from "fs"; import { lookup } from "mime-types"; import { NewSurvey } from "../entities/NewSurvey"; import { FriendsHelper } from "../helpers/FriendsHelper"; +import { NotificationsUtils } from "../utils/NotificationsUtils"; +import { NotifEventType } from "../entities/Notification"; /** * Posts controller @@ -291,7 +293,9 @@ export class PostsController { } - // TODO : create a notification + // Create a notification + await NotificationsUtils.CreatePostNotification( + h.getUserId(), postID, NotifEventType.ELEM_CREATED); h.send({ success: "The post has been created!",