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 -%> <% @uploaders.each do |field| -%> - <%= field %> <% end -%> uploaders: <% @uploaders.each do |field| -%> - <%= field %> <% end -%> search_able: <% contract_fields.each do |field| -%> <% if ['title', 'name'].include?(field) -%> - <%= field %> <% end -%> <% end -%> controllers: list_fields: <% @fields.each do |field| -%> - <%= field %> <% end -%> show_fields: <% @model_class.columns.each do |field| -%> - <%= field.name.to_s %> <% end -%> <% @uploaders.each do |field| -%> - <%= field %> <% end -%> form_fields: <% (@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: use_case: contract: - required(:id).filled(:string) action_create: use_case: 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: contract: - 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: use_case: contract: - required(:id).filled(:string) entity: skipped_fields: - id - created_at - updated_at <% if @model_class.columns.map(&:name).include?(:type) -%> - type <% end -%>