lib/generators/rider_kick/templates/db/structures/example.yaml.tt in rider-kick-0.0.5 vs lib/generators/rider_kick/templates/db/structures/example.yaml.tt in rider-kick-0.0.6
- old
+ new
@@ -1,7 +1,8 @@
model: <%= @model_class %>
resource_name: <%= @scope_path %>
+resource_owner_id: <%= @resource_owner_id %>
actor: <%= @actor %>
fields:
<% @model_class.columns.each do |field| -%>
- <%= field.name.to_s %>
<% end -%>
@@ -34,13 +35,18 @@
<% (@fields).each do |field| -%>
- name: <%= field %>
type: string
<% end -%>
<% (@uploaders).each do |field| -%>
+<% if is_singular?(field) -%>
- name: <%= field %>
type: file
+<% else -%>
+ - name: <%= field %>
+ type: files
<% end -%>
+<% end -%>
domains:
action_list:
use_case:
contract:
action_fetch_by_id:
@@ -52,12 +58,16 @@
contract:
<% (@fields + @uploaders).each do |field| -%>
<% column_type = get_column_type(field) -%>
<% dry_type = @type_mapping[column_type.to_s] || ':string' -%>
<% if @uploaders.include?(field) -%>
+<% if is_singular?(field) -%>
- optional(:<%= field %>).maybe(<%= dry_type %>)
<% else -%>
+ - optional(:<%= field %>).maybe(:array)
+<% end -%>
+<% else -%>
- required(:<%= field %>).filled(<%= dry_type %>)
<% end -%>
<% end -%>
action_update:
use_case:
@@ -65,10 +75,14 @@
- required(:id).filled(:string)
<% (@fields + @uploaders).each do |field| -%>
<% column_type = get_column_type(field) -%>
<% dry_type = @type_mapping[column_type.to_s] || ':string' -%>
<% if @uploaders.include?(field) -%>
+<% if is_singular?(field) -%>
- optional(:<%= field %>).maybe(<%= dry_type %>)
+<% else -%>
+ - optional(:<%= field %>).maybe(:array)
+<% end -%>
<% else -%>
- optional(:<%= field %>).maybe(<%= dry_type %>)
<% end -%>
<% end -%>
action_destroy:
\ No newline at end of file