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

Add name of the user who has submitted feedback with comment and rating #6472

Closed
ranjsa opened this issue Sep 29, 2019 · 10 comments
Closed

Add name of the user who has submitted feedback with comment and rating #6472

ranjsa opened this issue Sep 29, 2019 · 10 comments
Labels

Comments

@ranjsa
Copy link
Member

ranjsa commented Sep 29, 2019

Is your feature request related to a problem? Please describe.

Right now we are only getting comment and rating in the feedback submitted by a user , So we cant see who has actually posted the feedback .
WhatsApp Image 2019-09-29 at 8 21 48 AM

Describe the solution you'd like

Add name of the user with rating and comment . in the feedback response .

{
  "meta": {
    "count": 1
  },
  "data": [
    {
      "relationships": {
        "event": {
          "links": {
            "self": "/v1/feedbacks/1/relationships/event",
            "related": "/v1/feedbacks/1/event"
          }
        },
        "user": {
          "links": {
            "self": "/v1/feedbacks/1/relationships/user",
            "related": "/v1/feedbacks/1/user"
          }
        }
      },
      "attributes": {
        "rating": "4",
        "deleted-at": null,
        "comment": "Awesome event"
      },
      "type": "feedback",
      "id": 1,
      "links": {
        "self": "/v1/feedbacks/1"
      }
    }
  ],
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "/v1/events/1/feedbacks"
  }
}

Additional context
fossasia/open-event-attendee-android#2366
I am working on it .

@akshat0047
Copy link
Member

I would like to work on this issue @prateekj117 @iamareebjamal

@iamareebjamal
Copy link
Member

Go ahead

@akshat0047
Copy link
Member

akshat0047 commented Oct 20, 2019

Referring to #6538 according to which user name is not to be implemented as an attribute, I went through the complete flask rest JSON API docs, we have to get the name using user relationship. But how can I proceed, I explored resource linkage, include=model. Do I need to query in resource manager? @iamareebjamal @prateekj117

@iamareebjamal
Copy link
Member

You need to just link the user as a relationship. See any schema like event or speaker

@akshat0047
Copy link
Member

akshat0047 commented Oct 21, 2019

You need to just link the user as a relationship. See any schema like event or speaker

Code
I see it already linked in the file, the only change that can be made is to change the schema to UserSchemaPublic

@iamareebjamal
Copy link
Member

You need to dynamically update the schema depending on the kind of user requesting the resource - admin or normal

@akshat0047
Copy link
Member

ok

@akshat0047
Copy link
Member

Actually, I can fix it with a lambda function like this but I see a check already defined in User Resource Manager for a detail view this. On testing API by clicking on the related link under relationships even if I hardcode it UserSchemaPublic, the before get validators again change it to UserSchema according to the check defined in the User. Also, the user name is served in both the schema, I think its already solved or should I implement this double-check lambda function

@akshat0047
Copy link
Member

Please let me know if what I figured out is correct and this issue is invalid, else I will research more towards solution @iamareebjamal

@iamareebjamal
Copy link
Member

Yes, the issue is invalid

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

No branches or pull requests

3 participants