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

interlink comment with user #59

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

Feruz2
Copy link

@Feruz2 Feruz2 commented Aug 3, 2022

No description provided.

@Feruz2 Feruz2 requested a review from RiyadHassen August 3, 2022 18:49
@@ -38,6 +47,12 @@ export async function addComment(req: Request,res:Response){
}

export async function deleteCommentById(req:Request,res:Response){

const user = await userModel.findById(req.params.userId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to check if the actual user who created the comment should delete the comment,
check user._id equlaity

@@ -47,11 +62,15 @@ export async function deleteCommentById(req:Request,res:Response){
}

export async function updateCommentById(req:Request,res:Response){
const user = await userModel.findById(req.params.userId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same goes here, one should update their comments.

res.status(200).json(comment);

// console.log(comment)
Copy link
Collaborator

@RiyadHassen RiyadHassen Aug 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove debugging statements, plus pull the master branch to resolve conflicts.

Comment on lines 37 to 38
// console.log(comment)
// const ans = await comment.populate('author');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove debugging statments

.populate([
{
path: 'author ',
select: 'name -_id'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to populate picture of a user also

@@ -2,16 +2,22 @@ import mongoose from 'mongoose';
import {userModel} from './user-model';
import {Article} from './article';

export interface comment_interface extends Document{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to rename interfaces with IComment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants