-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Liked And Disliked Status Added for Question , Exeprience, Comment, R…
…eply
- Loading branch information
1 parent
9fb256c
commit c98e3d2
Showing
16 changed files
with
200 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { GraphQLError } from "graphql" | ||
import { addLikeStatus } from "../../utils/addLikeStatus.js" | ||
import { addUserName } from "./Comment/addUserName.js" | ||
import { addNameExp } from "./addnameExp.js" | ||
|
||
export const formatExp = async (experience, context) => { | ||
try { | ||
|
||
experience = await addLikeStatus(experience, context.userId, 'EXPERIENCE') | ||
experience = await addNameExp(experience) | ||
console.log('The length of exp.comments : ', experience) | ||
for (let i = 0; i < experience.comments?.length; i++) { | ||
experience.comments[i] = await addLikeStatus( | ||
experience.comments[i], | ||
context.userId, | ||
'EXP_COMMENT' | ||
) | ||
experience.comments[i] = await addUserName(experience.comments[i]) | ||
for (let j = 0; j < experience.comments[i]?.reply?.length; j++) { | ||
experience.comments[i].reply[j] = await addLikeStatus( | ||
experience.comments[i].reply[j], | ||
context.userId, | ||
'EXP_REPLY' | ||
) | ||
experience.comments[i].reply[j] = await addUserName( | ||
experience.comments[i].reply[j] | ||
) | ||
} | ||
} | ||
return experience | ||
} catch (error) { | ||
console.log('ERROR WHILE FORMATTING EXP : ', error) | ||
throw new GraphQLError('Something went wrong') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.