-
Notifications
You must be signed in to change notification settings - Fork 175
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
upsertWithWhere Verb ( POST or PUT ) #324
Comments
Hi @jonathan-casarrubias thanks for fix.. but upserWithWhere method dont works fine too when i use swagger exproler this is te CURL chain generated to apply at upserWithWhere
hoewever when i use SDK to call the CURL chain generated is different.
i call the SDK in Angular2 Component with this code this.priceApi.upsertWithWhere(
{
serviceId:this.service.id,
kmRangeId:this.kmRange.id,
rateId: this.rate.id
},
{
price:this.price.price,
serviceId:this.service.id,
kmRangeId:this.kmRange.id,
rateId: this.rate.id
}
).subscribe(result => console.log(result)); and Loopback returns a server side error...
maybe i must be a call with another method? thanks for all |
i solved the last issue fixing base.service.ts at line 91 // Separate where object from url params and add to search query
if (urlParams.where) {
headers.append('where', JSON.stringify(urlParams.where));
// delete urlParams.where;
} |
What type of issue are you creating?
What version of this module are you using?
Write other if any:
Please add a description for your issue:
i am using now upsertWithWhere and this method was a fail because dont are using the post verb... are using the put verb and dont works fine, maybe will be a bug?
fixing SDK generated with replacing PUT for POST ... works fine
Thanks!!
/**
*/
public upsertWithWhere(where: any = {}, data: any = {}): Observable {
let _urlParams: any = {};
if (where) _urlParams.where = where;
return this.request('PUT', [
LoopBackConfig.getPath(),
LoopBackConfig.getApiVersion(),
this.model.getModelDefinition().plural,
'upsertWithWhere'
].join('/'), undefined, _urlParams, { data }).map((data: T) => this.model.factory(data));
}
The text was updated successfully, but these errors were encountered: