I'm not too confident with Design Patterns but trying a lot harder these days to make conscious use of them.
I have an api that will perform a series to steps but the ultimate goal is do get records from a db, put them in to a spreadsheet, and email that to an address provided by the client.
Here it is broken in to steps:
Get all records from db using params provided by client
Create either a csv or excel populated with results of the query
Create password protected zip file containing the sheet
Send sheet and email address info to another api which will actually work out sending the email
In the future I may need to:
Support exporting from other tables
If exporting from other tables, the headers of the spreadsheet will need to be different
Sending the email in other formats eg: json
At the moment I am just going through the step one at a time in the controller. But if I need to account for the future scenarios listed above then I can see it getting extremely bloated.
You are right. It is none of those which you've mentioned. You need multiple patterns to achieve this which might include ones you've mentioned.
From controller prepare data and pass it to some class which will be responsible to whole that flow. Then within that class delegate to separate classes for each of those concerns.