Usage Examples
Here, you find the most used command of ib-scaffold. For more usages, you can run the command
ib-scaffold --help
Generate Model
ib-scaffold -m {metadata}
Here you replace Metadata by the name of the XML file without .xml
This will generate the model, with the default finder.
For Entity, it will only generate the model.
Generate Repository
ib-scaffold -m {metadata} --repo
This will generate the repository along the model.
Generate Controller
ib-scaffold -m {metadata} --url {baseURL}
This will generate the controller, the repository and the model. The base-url needs to start with “/”, eg: /students. It will be used as the base URL of the CRUD end-points.
Generate Form
ib-scaffold -m {metadata} --url {baseUrl} --ui --form
This will generate the form page in the next project. The base-url is needed here because the front needs to know where to make the API calls.
Generate List
ib-scaffold -m {metadata} --url {baseUrl} --ui --list
This setup includes a list page and a detail page. The list page supports full CRUD operations, sorting on each column, client-side filtering, server side filter (when --filter-params option is specified), and server-side pagination with a "go to page" option. When a row in the list is clicked, it navigates to a detail page with options to update or delete the selected item. Additionally, the list page preserves state (sort order, pagination, filters) when returning from the detail page, thanks to caching.
The base-url is required to ensure the front end knows where to make API calls.
Generate List with same page details
ib-scaffold -m {metadata} --url {baseUrl} --ui --list --onepage
This setup enables the generation of a full CRUD list with all the features described above. However, there's one key difference: instead of navigating to a new page upon clicking a row, the list and the form are displayed side by side on the same page, with the list on the left and the form on the right.
“HasValue” Interface
ib-scaffold -m {metadata} --entity-value
This will make your entity implements the “HasValue” interface. ”HasValue” is an interface to represent AR as a value. This will make you have access to methods that can perform basic maths such as mean, average, etc. from the generated collection.
Parameter customization
If you want to customize the parameters for getAll endpoint, you can add “-f” or “—filter-params” , then the cli will ask for which parameters, you want the results to be filtered and which operators you want to use. For more information you can read the section repository#parameter-customization.