Complex Custom Actions
How do you usually model complex operations over a model?
I have a model that needs to do some processing over their inputs, it handles everything related to subtitles, and after creation it goes over several stages of analysis of the context and such and I'm struggling to fit it inside of the Ash framework.
I was thinking to model it in two ways:
* Have an Oban job that contains that logic and operates over a
* The problem in this case is that I cannot use AshOban to handle the scheduling, I'd need to do it manually
* Implement a manual action using
* In that case do I need to deal with ecto directly? Or should I use other more generic actions as part of the manual action? Do you have an example of a ManualUpdate I could take a look at?
I have a model that needs to do some processing over their inputs, it handles everything related to subtitles, and after creation it goes over several stages of analysis of the context and such and I'm struggling to fit it inside of the Ash framework.
I was thinking to model it in two ways:
* Have an Oban job that contains that logic and operates over a
:update or :analyzed action.* The problem in this case is that I cannot use AshOban to handle the scheduling, I'd need to do it manually
* Implement a manual action using
Ash.Resource.ManualUpdate, but in that case I'm a bit unsure how to handle everything, what are the best practices around ManualUpdate and what am I giving up in exchange. I still have a bit of trouble reasoning about that.* In that case do I need to deal with ecto directly? Or should I use other more generic actions as part of the manual action? Do you have an example of a ManualUpdate I could take a look at?
Solution
before_action hook or before_transaction hook depending on how costly the analyze_content() function is
