11import type { FastifyReply , FastifyRequest } from "fastify"
22import { Character , Image , User } from "../../../models"
3- import { Comment , Comment as Comments } from "../../../models/Comments "
3+ import { Comment } from "../../../models"
44import { uploadToS3 } from "../../../utils"
55import { DataSource , ILike , IsNull } from "typeorm"
6- import { sendMassNotification } from "../../../utils/notification"
6+ import { sendMassNotification , sendNotification } from "../../../utils/notification"
77import { CommissionStatus , Role } from "../../../models/Users"
88
99export const me = async ( request : FastifyRequest , reply : FastifyReply ) => {
@@ -88,6 +88,7 @@ export const getProfile = async (request: FastifyRequest, reply: FastifyReply) =
8888 handle : handle
8989 } ,
9090 relations : {
91+ notifications : true ,
9192 folders : {
9293 characters : true ,
9394 artworks : true ,
@@ -165,7 +166,7 @@ export const commentProfile = async (request: FastifyRequest, reply: FastifyRepl
165166 }
166167 }
167168
168- const comment = await request . server . db . getRepository ( Comments ) . save ( {
169+ const comment = await request . server . db . getRepository ( Comment ) . save ( {
169170 content : content ,
170171 author : author ,
171172 user : profile ,
@@ -176,6 +177,8 @@ export const commentProfile = async (request: FastifyRequest, reply: FastifyRepl
176177 return reply . code ( 500 ) . send ( { error : "Error commenting" } )
177178 }
178179
180+ await sendNotification ( request . server . db , profile , "New comment on your profile" , author , undefined , comment )
181+
179182 return reply . code ( 200 ) . send ( { message : "Commented" } )
180183}
181184
@@ -401,7 +404,7 @@ export const getArtistsWithOpenCommissions = async (request: FastifyRequest, rep
401404}
402405
403406const recursivelyGetReplies = async ( commentId : string , db : DataSource ) => {
404- const replies = await db . getRepository ( Comments ) . find ( {
407+ const replies = await db . getRepository ( Comment ) . find ( {
405408 where : { parentComment : { id : commentId } } ,
406409 relations : {
407410 author : true ,
0 commit comments