1- import  *  as  express  from  ' express' ; 
1+ import  *  as  express  from  " express" ; 
22
3- import  {  signRequestForUpload  }  from  ' ../aws-s3' ; 
3+ import  {  signRequestForUpload  }  from  " ../aws-s3" ; 
44
5- import  User  from  ' ../models/User' ; 
6- import  Team  from  ' ../models/Team' ; 
7- import  Invitation  from  ' ../models/Invitation' ; 
8- import  Discussion  from  ' ../models/Discussion' ; 
9- import  Post  from  ' ../models/Post' ; 
5+ import  User  from  " ../models/User" ; 
6+ import  Team  from  " ../models/Team" ; 
7+ import  Invitation  from  " ../models/Invitation" ; 
8+ import  Discussion  from  " ../models/Discussion" ; 
9+ import  Post  from  " ../models/Post" ; 
1010
11- import  { 
12-  discussionAdded , 
13-  discussionDeleted , 
14-  discussionEdited , 
15-  postAdded , 
16-  postDeleted , 
17-  postEdited , 
18- }  from  '../sockets' ; 
11+ import  {  discussionAdded ,  discussionDeleted ,  discussionEdited ,  postAdded ,  postDeleted ,  postEdited  }  from  "../sockets" ; 
1912
2013const  router  =  express . Router ( ) ; 
2114
2215router . use ( ( req ,  res ,  next )  =>  { 
23-  console . log ( ' team member API' ,  req . path ) ; 
16+  console . log ( " team member API" ,  req . path ) ; 
2417 if  ( ! req . user )  { 
25-  res . status ( 401 ) . json ( {  error : ' Unauthorized' } ) ; 
18+  res . status ( 401 ) . json ( {  error : " Unauthorized" } ) ; 
2619 return ; 
2720 } 
2821
2922 next ( ) ; 
3023} ) ; 
3124
3225// Get signed request from AWS S3 server 
33- router . post ( ' /aws/get-signed-request-for-upload-to-s3' ,  async  ( req ,  res ,  next )  =>  { 
26+ router . post ( " /aws/get-signed-request-for-upload-to-s3" ,  async  ( req ,  res ,  next )  =>  { 
3427 try  { 
3528 const  {  fileName,  fileType,  prefix,  bucket }  =  req . body ; 
3629
@@ -49,7 +42,7 @@ router.post('/aws/get-signed-request-for-upload-to-s3', async (req, res, next) =
4942 } 
5043} ) ; 
5144
52- router . post ( ' /user/update-profile' ,  async  ( req : any ,  res ,  next )  =>  { 
45+ router . post ( " /user/update-profile" ,  async  ( req : any ,  res ,  next )  =>  { 
5346 try  { 
5447 const  {  name,  avatarUrl }  =  req . body ; 
5548
@@ -65,7 +58,7 @@ router.post('/user/update-profile', async (req: any, res, next) => {
6558 } 
6659} ) ; 
6760
68- router . post ( ' /user/toggle-theme' ,  async  ( req : any ,  res ,  next )  =>  { 
61+ router . post ( " /user/toggle-theme" ,  async  ( req : any ,  res ,  next )  =>  { 
6962 try  { 
7063 const  {  darkTheme }  =  req . body ; 
7164
@@ -94,7 +87,7 @@ async function loadDiscussionsData(team, userId, body) {
9487 Object . assign ( discussion ,  { 
9588 initialPosts : await  Post . getList ( { 
9689 userId, 
97-  discussionId : discussion . _id , 
90+  discussionId : discussion . _id . toString ( ) , 
9891 } ) , 
9992 } ) ; 
10093
@@ -130,7 +123,7 @@ async function loadTeamData(team, userId, body) {
130123 return  data ; 
131124} 
132125
133- router . post ( ' /get-initial-data' ,  async  ( req : any ,  res ,  next )  =>  { 
126+ router . post ( " /get-initial-data" ,  async  ( req : any ,  res ,  next )  =>  { 
134127 try  { 
135128 const  teams  =  await  Team . getAllTeamsForUser ( req . user . id ) ; 
136129
@@ -164,7 +157,7 @@ router.post('/get-initial-data', async (req: any, res, next) => {
164157// } 
165158// }); 
166159
167- router . get ( ' /teams/get-members' ,  async  ( req : any ,  res ,  next )  =>  { 
160+ router . get ( " /teams/get-members" ,  async  ( req : any ,  res ,  next )  =>  { 
168161 try  { 
169162 const  users  =  await  User . getMembersForTeam ( { 
170163 userId : req . user . id , 
@@ -177,7 +170,7 @@ router.get('/teams/get-members', async (req: any, res, next) => {
177170 } 
178171} ) ; 
179172
180- router . post ( ' /discussions/add' ,  async  ( req : any ,  res ,  next )  =>  { 
173+ router . post ( " /discussions/add" ,  async  ( req : any ,  res ,  next )  =>  { 
181174 try  { 
182175 const  {  name,  teamId,  memberIds =  [ ] ,  socketId,  notificationType }  =  req . body ; 
183176
@@ -197,7 +190,7 @@ router.post('/discussions/add', async (req: any, res, next) => {
197190 } 
198191} ) ; 
199192
200- router . post ( ' /discussions/edit' ,  async  ( req : any ,  res ,  next )  =>  { 
193+ router . post ( " /discussions/edit" ,  async  ( req : any ,  res ,  next )  =>  { 
201194 try  { 
202195 const  {  name,  id,  memberIds =  [ ] ,  socketId,  notificationType }  =  req . body ; 
203196
@@ -217,7 +210,7 @@ router.post('/discussions/edit', async (req: any, res, next) => {
217210 } 
218211} ) ; 
219212
220- router . post ( ' /discussions/delete' ,  async  ( req : any ,  res ,  next )  =>  { 
213+ router . post ( " /discussions/delete" ,  async  ( req : any ,  res ,  next )  =>  { 
221214 try  { 
222215 const  {  id,  socketId }  =  req . body ; 
223216
@@ -231,7 +224,7 @@ router.post('/discussions/delete', async (req: any, res, next) => {
231224 } 
232225} ) ; 
233226
234- router . get ( ' /discussions/list' ,  async  ( req : any ,  res ,  next )  =>  { 
227+ router . get ( " /discussions/list" ,  async  ( req : any ,  res ,  next )  =>  { 
235228 try  { 
236229 const  {  discussions }  =  await  Discussion . getList ( { 
237230 userId : req . user . id , 
@@ -244,7 +237,7 @@ router.get('/discussions/list', async (req: any, res, next) => {
244237 } 
245238} ) ; 
246239
247- router . get ( ' /posts/list' ,  async  ( req : any ,  res ,  next )  =>  { 
240+ router . get ( " /posts/list" ,  async  ( req : any ,  res ,  next )  =>  { 
248241 try  { 
249242 const  posts  =  await  Post . getList ( { 
250243 userId : req . user . id , 
@@ -257,7 +250,7 @@ router.get('/posts/list', async (req: any, res, next) => {
257250 } 
258251} ) ; 
259252
260- router . post ( ' /posts/add' ,  async  ( req : any ,  res ,  next )  =>  { 
253+ router . post ( " /posts/add" ,  async  ( req : any ,  res ,  next )  =>  { 
261254 try  { 
262255 const  {  content,  discussionId,  socketId }  =  req . body ; 
263256
@@ -271,7 +264,7 @@ router.post('/posts/add', async (req: any, res, next) => {
271264 } 
272265} ) ; 
273266
274- router . post ( ' /posts/edit' ,  async  ( req : any ,  res ,  next )  =>  { 
267+ router . post ( " /posts/edit" ,  async  ( req : any ,  res ,  next )  =>  { 
275268 try  { 
276269 const  {  content,  id,  socketId }  =  req . body ; 
277270
@@ -285,7 +278,7 @@ router.post('/posts/edit', async (req: any, res, next) => {
285278 } 
286279} ) ; 
287280
288- router . post ( ' /posts/delete' ,  async  ( req : any ,  res ,  next )  =>  { 
281+ router . post ( " /posts/delete" ,  async  ( req : any ,  res ,  next )  =>  { 
289282 try  { 
290283 const  {  id,  discussionId,  socketId }  =  req . body ; 
291284
0 commit comments