-
Notifications
You must be signed in to change notification settings - Fork 31
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
New endpoints partner access endpoints #306
Conversation
6ee76ee
to
92f6ad8
Compare
]) | ||
.where('partnerAccess.featureTherapy=true') //only get access codes with feature therapy turned on | ||
.groupBy('partnerAccess.userId') //group by user as we can have users with multiple access codes | ||
.getRawMany(); //use instead of getMany as the columns are derived |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the response would be serialised into camel case. We send our JSON data with camel cases.
description: 'Updates number of therapy sessions available to an access code', | ||
}) | ||
@Put('users') | ||
@UseGuards(SuperAdminAuthGuard) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a look at @APIBody() from nestjs. It automatically sends a Bad request if the JSON data isn't sent in the right format. A DTO should also be created to cover this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of this request - sorry again for being picky. I think this just needs to be PATCH as its a partial update and it doesn't need the /users. I would probably expect the endpoint to be PATCH /partner-access/:id with a JSON body like so:
{
therapySessionsRemaining: new value
}
I think there might be a slight issue with this implementation as you are sending an aggregate to the frontend and then sending the updated aggregate to the backend to update the access code. If a user had 2 access codes, they could get extra therapy sessions
1. Pull users with access codes that have therapy enabled 2. Update number of therapy sessions for access codes
Service tests are in-progress. They are currently not working and incomplete.