Closed Transmitt0r closed 6 years ago
Hey, I made a new test-case as you requested, but on my machine I get a weird graphql 400 error when trying to delete, while running exactly the same mutation with the same credentials directly in https://market.big-iot.org/graphql works as expected. Do you have an idea what's going on?
I had to make a small tweak to the offering removal query, and now it can make the offering disappear from the marketplace.
index f545f48..0e884b0 100644
--- a/lib/provider.js
+++ b/lib/provider.js
@@ -24,15 +24,7 @@ const addOfferingMutation = gql`
const deleteOfferingMutation = gql`
mutation deleteOffering($Offering:DeleteOffering!){
deleteOffering(input: $Offering){
- id name
- provider { id name organization { id name } }
- activation { status expirationTime }
- rdfAnnotation { uri label proposed }
- inputs { name rdfAnnotation { uri label proposed } }
- outputs { name rdfAnnotation { uri label proposed } }
- spatialExtent { city boundary { l1 { lat lng } l2 { lat lng } } }
- license
- price { pricingModel money { amount currency } }
+ id
}
}
`;
@@ -82,7 +74,9 @@ class BigIotProvider extends Client {
return this.client.mutate({
mutation: deleteOfferingMutation,
variables: {
- Offering: offeringData,
+ Offering: {
+ id: offeringData.id,
+ },
},
}).then(result => result.data.deleteOffering);
}
However, seems something is messed up in the marketplace, since then I get failure with
Error: GraphQL error: NotAuthorized: DeleteSubscription(SubscriptionId(VMZBerlin-vmzConsumer==Flying_Pig_UG-bigiot_js-test_offering),VMZBerlin-vmzConsumer,Flying_Pig_UG-bigiot_js-test_offering,Meta(b53ccccb)) by Client_Flying_Pig_UG-bigiot_js, Some(Flying_Pig_UG).
Which would suggest I'm not allowed to remove the subscriptions attached to an offering I made.
Mailed the marketplace maintainers. So, seems the PR itself would be fine with minor modifications, but can't be merged due to an upstream bug.
Verified to be an upstream bug: https://gitlab.com/BIG-IoT/exchange/issues/201
Will have to wait for that to be fixed
@Transmitt0r in the meanwhile, could you apply the above change to your PR? Then I think we can merge (and skip the tests for now)
@bergie think I got everything
The bug is fixed upstream (https://gitlab.com/BIG-IoT/exchange/issues/201) and on https://market.big-iot.org
Also I added a single test to delete a previously registered offering, but I'm not sure on how to best test if the user is authenticated / the offering is registered.
Also: Is it enough to check if the offering has an Id to see if the offering is registered, since the id-property is added in the registration-step?