Trailblazer Coditsu Macros Engine
Set of macros for nicer composition of Trailblazer operations.
module Repositories class Destroy < ApplicationOperation step ::::(Repository, :find_by) step ::::() end end
Table of Contents
- Trailblazer Coditsu Macros Engine
There are several types of macros organized in namespaces that can be used to do various things with predefined steps.
Macros::Contract::Build- Step for setting contract class and building a new contract
Macros::Contract::Persist- Step for contract persistance
Macros::Contract::Validate- Step for contract validation
module Organizations class New < ApplicationOperation contract Contracts::Create step ::::(Organization) step ::::() step ::::(key: :organization) step ::::() end end
Macros::Ctx::Assign- Assigns a given class to a ctx key for further usage
class Sources < ApplicationOperation # Now under the 'model' within context you'll have the Source class step ::::(Source) step ::::(:eligible_for_gc) end
Macros::Error::Raise- If we switched to the left track it will raise with some details for debugging
class Vacuum < ApplicationOperation step :setup_tables_names step :delete_orphaned_offenses # Raise an error if anything goes wrong failure ::::(Errors::OperationFailure) end
Macros::Karafka::Broadcast- Broadcasts a given context field using a given responder
class Create < ApplicationOperation step :model_build step :model_persist step ::::(::Users::CreatedResponder) end
Macros::Model::Build- Build step for creating new objects from a class/scope
Macros::Model::Destroy- Destroy step for removing object assigned in
Macros::Model::Fetch- Extracts from a given object from a ctx hash a given attribute/method and assigns it under different key
Macros::Model::Find- Searches on a given scope and assigns result to a ctx hash
Macros::Model::Import- Import step for mass data import
Macros::Model::Paginate- Runs a pagination for a model and reassigns it under the same name
Macros::Model::Persist- Persist step for saving object assigned in
Macros::Model::Search- Searches based on current_search data and overwrites our model/resource
module Repositories class Destroy < ApplicationOperation step ::::(Repository) step ::::() end end
Macros::Params::Fetch- Fetches a given param key into the ctx hash for further usage
class ScheduleSync < ApplicationOperation step ::::(from: :build_token) step :find_most_recent_status_for_commit_build step :schedule_delayed_job end
Note on contributions
First, thank you for considering contributing to Coditsu ecosystem! It's people like you that make the open source community such a great community!
Each pull request must pass all the RSpec specs and meet our quality requirements.
To check if everything is as it should be, we use Coditsu that combines multiple linters and code analyzers for both code and documentation. Once you're done with your changes, submit a pull request.
Coditsu will automatically check your work against our quality standards. You can find your commit check results on the builds page of Coditsu organization.