Skip to content

Commit

Permalink
enable injection of tenant id with tenant alias
Browse files Browse the repository at this point in the history
  • Loading branch information
dinosath authored and Konstantinos Athanasiou committed Jan 11, 2025
1 parent 8045720 commit 17c26cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{# inject in controller.rs #}
{# inject tenant in controller.rs #}
{% if 'multitenancy' in values.application and 'enabled' in values.application.multitenancy and values.application.multitenancy.enabled == true and values.application.multitenancy.type == 'column' -%}
{% set tenant_name = (values.application.multitenancy.alias | default('company')) | snake_case -%}
{% for entity_name,entity in entities | items -%}
{% if entity_name == tenant_name -%}{% continue -%}{% endif -%}
{% set file_name = entity.title | snake_case -%}
---
message: "Controller `{{module_name}}` was added successfully."
injections:
- into: {{ values.outputFolder }}/src/models/{{ file_name }}.rs
after: "pub updated_at: DateTimeWithTimeZone,"
content: "\tpub tenant_id: i32,"
content: "\tpub {{ tenant_name }}_id: i32,"
---
// Add tenant_id to the entity
{% endfor -%}
Expand Down
2 changes: 1 addition & 1 deletion generators/spring-rs-multitenancy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ application:
multitenancy:
enabled: true
type: "column"
entity-alias: workspace
entity-alias: company

0 comments on commit 17c26cb

Please sign in to comment.