Shopware 6 webhook for mail_template update - shopware6

in shopware 6 is there a app webhook for every entity update (like MailTemplate )?
or only for the ones from here https://developer.shopware.com/docs/resources/references/app-reference/webhook-events-reference ?

As of today these are the only write operation based events you can hook on to. The documentation will be kept up to date but you can also use the constant HookableEventCollector::HOOKABLE_ENTITIES to check which entity events you can hook.

Related

Update an other field when a count is on a certain value

Hi i'm actually working on a report system for my social network, i want to achieve something like : if a user is reported 5 times it will update a field on the user table to deactivate the user.
So if 5 row of reports is created i want to update the "activated" field
The thing is i'm working with GraphQL and Vue for the first time, my backend is in Symfony with ApiPlatform.
Should i try to query all the reports with the userId who is reported to count if there is 5 row when a user is reported and then mutate the user object to deactivate it or can i achieve this more easily on the backend side ?
So anything of importance should be done on the backend. The frontend is easily hacked and while it's good to stop normal (good) users from seeing something they're not supposed to, it's not a blocker to anyone who has even rudimentary web coding ability.
Seeing as you're talking about someone being reported, I'd recommend doing it on the backend and then make sure the frontend reflects that gracefully.
Hum it seems that the answer is that i need a reportListener and i need to listen the postPersist event, then inside this function i can check how many report there is for a user using the ReportRepository->findBy function, then i can count the row of the array return by the function and if the count is > 5 then i edit my user, persist and flush.

How we can update shopware 6 order using API.?

I would like to update the order in shopware 6 using API, As I have checked we can fetch order using the below URL
https://www.test.shop/api/order/54d47cc4d612345678901f7608fbebe2
But, I would like to update the order using API.
As I have checked it was in shopware 5 with the below link
https://developers.shopware.com/developers-guide/rest-api/examples/order/#example-3-update-an-order
What the details should be pass and how we can use put method on this.
Thank you.
It works similar with Shopware 6. If you have a test system (not production) you can see the API overview at /api/_info/swagger.html.
You should have a look at /api/_info/swagger.html#/Order/updateOrder.
PATCH /order/{id}
There are also API endpoints for order address, customer, delivery, line item and transaction.
You might also checkout this: https://shopware.stoplight.io/docs/store-api/storeapi.json/paths/~1order~1payment/post

How to call attributes of a database record in a Shopware 5 form

I'm not familiar with Symfony or VueJS. I have an id of a table in a Shopware 5 form, how can I access the attributes of that record?
Do you use Shopware5 or Shopware6?
Shopware 5 uses Smarty in the storefront and ExtJS in Admin.
Shopware 6 is build with Twig and VueJs.
If you want to access data from the database I'd recommend doing this in PHP and use the Repository of the Entity.
If you need the data in a specific view you could use a subscriber (explained here).

How Should I handle the data on local and cloud in an react native app (Redux)

I have an app and its going to have these features in it :
SCREENS :
Home { Show recent posts from all categories (API provides 30 posts per page)}
Categories {Show all Categories List }
By-Category {Show recent posts by category (API provides 30 posts per page)}
Post {Show Post Details with Comments }
User-Profile {Show User Profile with their recent posts (API provides 30 posts per page)}
Profile-Setting {Show updatable Fields and Update Button}
Now, Where i am confused :
Should I fill the whole store with API in the starting or should I
make API calls for each screen when they are opened ?
And for updating, like If user likes post then should I show a
spinner or something till API completes OR should I update the local
store value instantly and then call the API ?
There could be many approaches to solve this. mine is:
1) I would create a model/manager to handle the API requests that also have access to the same store. so for example when the screen did mount use Home.Manager.getNextPage(); and it will know already to handle the api request and also know how to handle the paging.
So all the calcs will be in the manager. and when it get the data it will update the store with it.
2) When I built an app that contained likes I have used local data as well. My approach was to set time out of 10 seconds from last like so in case the user liked more than one post I could send a bulk. so the server won't need to handle multiple tcp connection but one with multiple likes data.
The point was first store it locally(for incase the user kill the app before we update the server) and then wait for 10 s' if got new like add it to the data array and wait for another 10 s' if not just send the data to the server. do not clean this local data until server return that it saved on your db
This way you can display animation first without letting the user to wait for a feedback from the server..
The best practice is to make small API calls for each component.
You should load each screen with a loading, then call the API in
componentDidMount after receiving the response shows the data.
enter code here
For this kind of action, first, make the API call, make the like button disable, update the store after successful API call.
Disable the button because of some user double-tap. This kink of APIs is usually fast, so loading does not have a good UX. The loading will be removed before full animation. Always update store data on the response, not the request because you need to revert the store changes if the API calls failed.

Podio Webhook - What should the hook syntax be if I want to it to tigger if a specific field in a specific app contains a specific value

I am trying to detect when a user changes the status of an item in a Podio app. For example: I have an expenses app in Podio. I would like to be notified when the status of an item is changed. The field is a "Category" field type and Let's say the category options are "Pending", "Paid", and "Canceled" I want to be notified only when the "Paid" category value is active
I can see documentation on Podio's API documentation site for how to create a hook if the value of an item is changed "item.update" but how do you go a bit further to specify that a field is updated to a specific value or condition?
The Podio API hook options referenced above can be found here: https://developers.podio.com/doc/hooks
Podio webhooks doesn't support that granular conditions. You can create webhook for item.update which will be fired each time item is modified, you also can create webhook for specific field and it will be fired on any update for that field (so if other fields in item are modified then this webhook won't trigger).
Additionally, the three hooks item.create, item.update and item.delete
can also work on a field level. If you use "app_field" as the ref_type
and an app field_id as the ref_id your hook will only be triggered if
the changes happen to that particular field.
Also, there is different way of achieving similar result. Have a look on Podio workflows: https://help.podio.com/hc/en-us/articles/204366037-Advanced-workflows . Workflow can be configured to be triggered when specific field is set to specific value which is what you were looking for.