Need help with my Ash project structure

I have a project with multiple resources, each containing resource-specific helper functions. I’m using the Spark formatter to maintain a consistent order for resource sections, but it does not include the helper functions.

In an Ash project, where should these resource-specific helper functions be placed? Should they live in the Domain module, acting like context functions, or would it be better to create separate resource_helper modules? Alternatively, is there a way to configure Spark to place non-standard sections, like helper functions, at the bottom of the resource?

2 Likes

I would differentiate between functions only used internally in the domain and functions that are supposed to be callable from outside the domain.

I would only put functions that are supposed to be called from outside into the domain, so other modules outside this domain only need to use that one module to call functions. If they don’t fit in the normal create/read/update/destroy categories, I would primarily create generic actions on resources and use code_interfaces to create functions for them on the domain.

For functions, I needed in multiple changes/preparations, and so on, I created separate helper modules besides the resources to put them in.

I don’t think the formatted has options for non dsl things at the moment.

3 Likes

Aha! Thank you.