mentorship-backend icon indicating copy to clipboard operation
mentorship-backend copied to clipboard

feat: user comment should provide also user display name and profile picture

Open annabauza opened this issue 5 years ago • 15 comments

Is your feature request related to a problem? Please describe. When we display comments we want to see who made the comment and see profile picture.

Describe the solution you'd like Add used node to comment which contains user display name and profile picture

Describe alternatives you've considered not nesting those values under user but it is less elegant or attaching all user information which is overwhelming

Additional context current json response looks as follows:

[
  {
    "id": 1,
    "user_id": 2,
    "task_id": 1,
    "relation_id": 1,
    "creation_date": 1581885745.451706,
    "modification_date": null,
    "comment": "test comment"
  }
]

annabauza avatar Feb 16 '20 20:02 annabauza

@isabelcosta can I work on this issue?

SanujBansal avatar Feb 27 '20 06:02 SanujBansal

Sure @SanujBansal :)

isabelcosta avatar Feb 27 '20 22:02 isabelcosta

@isabelcosta Is the issue available? I want to work on this

satya7289 avatar Mar 03 '20 17:03 satya7289

@isabelcosta can I work on this?

jotharman avatar Apr 03 '20 20:04 jotharman

@jotharman lets me just know if anyone else that requested to work on this is working on it. @SanujBansal are you interested in working on this? If not please let us know so we can assign this to another contributor. cc @satya7289

isabelcosta avatar Apr 05 '20 19:04 isabelcosta

Sure @isabelcosta

jotharman avatar Apr 06 '20 09:04 jotharman

I can assign this to you @jotharman :) if you are not working on any other issue currently. Can you please confirm?

isabelcosta avatar Apr 09 '20 16:04 isabelcosta

I am not working on any other issue presently :)

jotharman avatar Apr 09 '20 16:04 jotharman

you are assigned ;) feel free to send a PR on it

isabelcosta avatar Apr 09 '20 16:04 isabelcosta

Yeah Thank you @isabelcosta :))

jotharman avatar Apr 09 '20 17:04 jotharman

@isabelcosta If we add additional fields of "name" and "photo_url" in the tasks_comments table, we would be violating the DRY principles. We have the user_id in the data which I think we can use for directly accessing these variables from the users' table in the frontend. Please correct me if I am wrong :)

jotharman avatar Apr 14 '20 08:04 jotharman

@jotharman interesting point 🤓 Although, in the frontend, we don't have the user data like that. We don't have user data stored there. Here's something to have in consideration, comments within a task can be from at least 2 members (so not only the logged-in user, which we could have the details). If we want to show the user display name and picture in the frontend, we have to send that in the response from the backend. I don't see this as DRY problem in the code, but as adapting the REST API to accommodate needs on a specific UI.

Let me know what you think @jotharman 🤔 this is a good discussion to have :) I would even invite @annabauza to give input on this

isabelcosta avatar Apr 14 '20 12:04 isabelcosta

@isabelcosta Can we access the data from 'users' table (in frontend)using the id of the user which we already have in the tasks_comments table? The way we are accessing the comment and user_id of the user stored in the tasks_comments table, we can get the name and photo_url of the same user using the user_id. I hope it make sense :)

jotharman avatar Apr 14 '20 14:04 jotharman

@isabelcosta then should I go ahead with creating new fields(two columns "name" and "photo_url") in the table "tasks_comments" for accessing them directly?

jotharman avatar Apr 18 '20 08:04 jotharman

@isabelcosta I have created the pull request for this issue. Can you please review the same?

jotharman avatar Apr 23 '20 11:04 jotharman