k_domain 0.0.1 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +39 -1
  3. data/Gemfile +10 -0
  4. data/Guardfile +30 -0
  5. data/Rakefile +3 -4
  6. data/STORIES.md +63 -0
  7. data/USAGE.md +19 -0
  8. data/k_domain.gemspec +4 -0
  9. data/lib/k_domain/domain_model/load.rb +29 -0
  10. data/lib/k_domain/domain_model/transform.rb +110 -0
  11. data/lib/k_domain/domain_model/transform_steps/_.rb +10 -0
  12. data/lib/k_domain/domain_model/transform_steps/step.rb +142 -0
  13. data/lib/k_domain/domain_model/transform_steps/step1_attach_db_schema.rb +21 -0
  14. data/lib/k_domain/domain_model/transform_steps/step2_attach_models.rb +62 -0
  15. data/lib/k_domain/domain_model/transform_steps/step3_attach_columns.rb +137 -0
  16. data/lib/k_domain/domain_model/transform_steps/step4_attach_erd_files.rb +454 -0
  17. data/lib/k_domain/domain_model/transform_steps/step5_attach_dictionary.rb +58 -0
  18. data/lib/k_domain/domain_model/transform_steps/step8_locate_rails_models.rb +44 -0
  19. data/lib/k_domain/raw_db_schema/load.rb +29 -0
  20. data/lib/k_domain/raw_db_schema/transform.rb +82 -0
  21. data/lib/k_domain/schemas/_.rb +15 -0
  22. data/lib/k_domain/schemas/database/_.rb +7 -0
  23. data/lib/k_domain/schemas/database/foreign_key.rb +14 -0
  24. data/lib/k_domain/schemas/database/index.rb +14 -0
  25. data/lib/k_domain/schemas/database/schema.rb +31 -0
  26. data/lib/k_domain/schemas/database/table.rb +32 -0
  27. data/lib/k_domain/schemas/dictionary.rb +19 -0
  28. data/lib/k_domain/schemas/domain/_.rb +65 -0
  29. data/lib/k_domain/schemas/domain/domain.rb +11 -0
  30. data/lib/k_domain/schemas/domain/erd_file.rb +80 -0
  31. data/lib/k_domain/schemas/domain/models/column.rb +49 -0
  32. data/lib/k_domain/schemas/domain/models/model.rb +111 -0
  33. data/lib/k_domain/schemas/domain/old/belongs_to.rb +25 -0
  34. data/lib/k_domain/schemas/domain/old/column_old.rb +225 -0
  35. data/lib/k_domain/schemas/domain/old/domain_statistics.rb +29 -0
  36. data/lib/k_domain/schemas/domain/old/entity.rb +338 -0
  37. data/lib/k_domain/schemas/domain/old/entity_statistics.rb +22 -0
  38. data/lib/k_domain/schemas/domain/old/foreign_key.rb +17 -0
  39. data/lib/k_domain/schemas/domain/old/has_and_belongs_to_many.rb +20 -0
  40. data/lib/k_domain/schemas/domain/old/has_many.rb +27 -0
  41. data/lib/k_domain/schemas/domain/old/has_one.rb +41 -0
  42. data/lib/k_domain/schemas/domain/old/name_options.rb +10 -0
  43. data/lib/k_domain/schemas/domain/old/rails_controller.rb +10 -0
  44. data/lib/k_domain/schemas/domain/old/rails_model.rb +92 -0
  45. data/lib/k_domain/schemas/domain/old/related_entity.rb +36 -0
  46. data/lib/k_domain/schemas/domain/old/statistics.rb +21 -0
  47. data/lib/k_domain/schemas/domain/old/validate.rb +25 -0
  48. data/lib/k_domain/schemas/domain/old/validates.rb +50 -0
  49. data/lib/k_domain/schemas/domain_model.rb +14 -0
  50. data/lib/k_domain/schemas/investigate.rb +15 -0
  51. data/lib/k_domain/schemas/rails_resource.rb +16 -0
  52. data/lib/k_domain/version.rb +1 -1
  53. data/lib/k_domain.rb +22 -1
  54. data/templates/load_schema.rb +226 -0
  55. metadata +91 -2
@@ -0,0 +1,225 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KDomain
4
+ module DomainModel
5
+ class ColumnOld
6
+ # DONE
7
+ RUBY_TYPE = {
8
+ string: 'String',
9
+ text: 'String',
10
+ primary_key: 'Integer', # this could be GUID in future
11
+ foreign_key: 'Integer', # this could be GUID in future
12
+ integer: 'Integer',
13
+ boolean: 'Boolean',
14
+ float: 'Float',
15
+ decimal: 'Decimal',
16
+ datetime: 'DateTime',
17
+ date: 'DateTime',
18
+ json: 'Hash',
19
+ jsonb: 'Hash',
20
+ hstore: 'Hash'
21
+ }.freeze
22
+
23
+ # DONE
24
+ CSHARP_TYPE = {
25
+ string: 'string',
26
+ text: 'string', # NEED TO DEAL WITH THIS BETTER
27
+ integer: 'int',
28
+ boolean: 'bool',
29
+ decimal: 'decimal',
30
+ float: 'double',
31
+ datetime: 'DateTime',
32
+ date: 'DateTime',
33
+ json: 'object',
34
+ jsonb: 'object',
35
+ hstore: 'object'
36
+ }.freeze
37
+
38
+ # this is used by the ruby migration files
39
+ # DONE
40
+ DB_TYPE = {
41
+ boolean: 'boolean',
42
+ primary_key: 'integer',
43
+ foreign_key: 'integer',
44
+ integer: 'integer',
45
+ decimal: 'decimal',
46
+ float: 'float',
47
+ datetime: 'datetime',
48
+ date: 'date',
49
+ text: 'text',
50
+ string: 'string',
51
+ json: 'json',
52
+ jsonb: 'jsonb',
53
+ hstore: 'hstore'
54
+ }.freeze
55
+
56
+ SIMPLE_ATTRIBS = %i[
57
+ name
58
+ name_plural
59
+ type
60
+ structure_type
61
+ foreign_key?
62
+ foreign_table
63
+ foreign_id
64
+ ].freeze
65
+
66
+ DETAILED_ATTRIBS = SIMPLE_ATTRIBS + %i[
67
+ title
68
+ required
69
+ reference_type
70
+ db_type
71
+ ruby_type
72
+ csharp_type
73
+ format_type
74
+ description
75
+ belongs_to
76
+ ]
77
+
78
+ EXTRA_ATTRIBS = DETAILED_ATTRIBS + %i[
79
+ precision
80
+ scale
81
+ default
82
+ null
83
+ limit
84
+ array
85
+ ]
86
+
87
+ # Name of the column
88
+ attr_accessor :name
89
+
90
+ # Name of the column in plural form
91
+ attr_accessor :name_plural
92
+
93
+ attr_accessor :type
94
+
95
+ # Human readable title
96
+ attr_accessor :title
97
+
98
+ # true
99
+ attr_accessor :required
100
+
101
+ attr_accessor :structure_type # :data, :foreign_key, :timestamp
102
+ attr_accessor :reference_type
103
+
104
+ # 'references' if foreign key, 'primary_key' if primary key, will map_from_type(type)) |
105
+ # attr_accessor :db_type
106
+
107
+ attr_accessor :format_type
108
+ attr_accessor :description
109
+
110
+ attr_accessor :foreign_key
111
+ alias foreign_key? foreign_key
112
+ attr_accessor :foreign_table
113
+ attr_accessor :belongs_to
114
+ # this may not always be accurate, should support override
115
+ attr_accessor :foreign_id
116
+ alias reference_table foreign_id
117
+
118
+ # Extra DB attributes
119
+ attr_accessor :precision
120
+ attr_accessor :scale
121
+ attr_accessor :default
122
+ attr_accessor :null
123
+ alias nullable null
124
+ attr_accessor :limit
125
+ attr_accessor :array
126
+
127
+ def format_default
128
+ return '' if default.nil?
129
+ return "\"#{default}\"" if default.is_a?(String)
130
+
131
+ # || default.is_a?(Symbol)
132
+ default.to_s
133
+ end
134
+
135
+ def format_null
136
+ null.nil? ? '' : null.to_s
137
+ end
138
+
139
+ def format_array
140
+ array.nil? ? '' : array.to_s
141
+ end
142
+
143
+ # DONE
144
+ def db_type
145
+ return @db_type if defined? @db_type
146
+
147
+ @db_type = DB_TYPE[type] || '******'
148
+ end
149
+
150
+ # DONE
151
+ def ruby_type
152
+ return @ruby_type if defined? @ruby_type
153
+
154
+ @ruby_type = RUBY_TYPE[type] || '******'
155
+ end
156
+
157
+ # DONE
158
+ def csharp_type
159
+ return @csharp_type if defined? @csharp_type
160
+
161
+ @csharp_type = CSHARP_TYPE[type] || '******'
162
+ end
163
+
164
+ def debug(*flags)
165
+ debug_simple if flags.include?(:simple)
166
+ debug_detailed if flags.include?(:detailed)
167
+ debug_extra if flags.include?(:extra)
168
+ end
169
+
170
+ private
171
+
172
+ def debug_simple
173
+ log.kv 'name' , name
174
+ log.kv 'name_plural' , name_plural
175
+ log.kv 'type' , type
176
+ log.kv 'structure_type' , structure_type
177
+ end
178
+
179
+ def debug_detailed
180
+ debug_simple
181
+ log.kv 'title' , title
182
+ log.kv 'required' , required
183
+ log.kv 'reference_type' , reference_type
184
+ log.kv 'db_type' , db_type
185
+ log.kv 'ruby_type' , ruby_type
186
+ log.kv 'csharp_type' , csharp_type
187
+ log.kv 'format_type' , format_type
188
+ log.kv 'description' , description
189
+
190
+ log.kv 'foreign_key?' , foreign_key?
191
+ log.kv 'foreign_table' , foreign_table
192
+ log.kv 'belongs_to' , belongs_to
193
+ log.kv 'foreign_id' , foreign_id
194
+ end
195
+
196
+ def debug_extra
197
+ debug_detailed
198
+
199
+ log.kv 'precision' , precision
200
+ log.kv 'scale' , scale
201
+ log.kv 'default' , default
202
+ log.kv 'null' , null
203
+ log.kv 'limit' , limit
204
+ log.kv 'array' , array
205
+ end
206
+ end
207
+
208
+ # ---------------------------------------------
209
+ # Available column keys that can be mapped from
210
+ # ---------------------------------------------
211
+ # name
212
+ # name_plural
213
+ # type
214
+ # foreign_key?
215
+ # foreign_table
216
+ # structure_type
217
+ # precision
218
+ # scale
219
+ # default
220
+ # null
221
+ # limit
222
+ # array
223
+ # belongs_to
224
+ end
225
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Rails model represents information that is found the model.rb class in the rails project
4
+ module KDomain
5
+ module DomainModel
6
+ class DomainStatistics
7
+ attr_reader :domain
8
+ attr_accessor :column_counts
9
+ attr_accessor :code_counts
10
+ attr_accessor :code_dsl_counts
11
+ attr_accessor :data_counts
12
+ attr_accessor :issues
13
+
14
+ def initialize(domain)
15
+ @domain = domain
16
+ # @column_counts = OpenStruct.new(meta[:column_counts])
17
+ # @code_counts = OpenStruct.new(meta[:code_counts])
18
+ # @code_dsl_counts = OpenStruct.new(meta[:code_dsl_counts])
19
+ # @data_counts = OpenStruct.new(meta[:data_counts])
20
+ # @issues = meta[:issues]
21
+ end
22
+
23
+ def print
24
+ log.warn('Statistics ::')
25
+ log.kv('Database Entities', domain.entities.length)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,338 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KDomain
4
+ module DomainModel
5
+ class Entity
6
+ # Name of the entity model
7
+ attr_accessor :name
8
+
9
+ # Name of the entity model in plural form
10
+ attr_accessor :name_plural
11
+
12
+ # @param [Symbol] value The value of ID has different meanings
13
+ # @option value :true Id column exists and it uses an Integer type
14
+ # @option value :false Id column does not exist
15
+ # @option value :bigserial Id column exists and it uses a BigSerial type
16
+ attr_accessor :id
17
+
18
+ # Currently only has the value :cascade
19
+ attr_accessor :force
20
+
21
+ # Model columns
22
+ attr_accessor :columns
23
+
24
+ # Model relationships - one_to_one, one_to_many and many_to_many
25
+ attr_accessor :relations_one_to_one
26
+
27
+ # This entity has a main field that is useful for rendering and may be used for unique constraint, may also be called display_name
28
+ attr_accessor :main_key
29
+
30
+ attr_accessor :trait1
31
+ attr_accessor :trait2
32
+ attr_accessor :trait3
33
+
34
+ # investigate
35
+ attr_accessor :td_query
36
+
37
+ # Model type - :entity, :basic_user, :admin_user
38
+ attr_accessor :model_type
39
+
40
+ attr_accessor :rails_model
41
+ attr_accessor :statistics
42
+
43
+ def key?
44
+ !main_key.nil?
45
+ end
46
+
47
+ def no_key
48
+ main_key.nil?
49
+ end
50
+ alias keyless? no_key
51
+
52
+ # Can probably deprecate model_
53
+ alias model_name name
54
+ alias names name_plural
55
+
56
+ alias td_key1 trait1
57
+ alias td_key2 trait2
58
+ alias td_key3 trait3
59
+
60
+ # alias :name :student_name # not wrong, only for getter
61
+ # alias :name= :student_name= # add this for setter
62
+ # alias :name? :student_name? # add this for boolean
63
+
64
+ attr_accessor :belongs_to
65
+ attr_accessor :has_one
66
+ attr_accessor :has_many
67
+ attr_accessor :has_and_belongs_to_many
68
+
69
+ # Needs to move into RailsModel
70
+ attr_accessor :validates
71
+ attr_accessor :validate
72
+
73
+ def relations?
74
+ # log.kv 'has_one', has_one.length
75
+ # log.kv 'has_many', has_many.length
76
+ # log.kv 'has_and_belongs_to_many', has_and_belongs_to_many.length
77
+ has_one.length.positive? || has_many.length.positive? || has_and_belongs_to_many.length.positive?
78
+ end
79
+
80
+ def initialize
81
+ @columns = []
82
+ @relations = []
83
+
84
+ @belongs_to = []
85
+ @has_one = []
86
+ @has_many = []
87
+ @has_and_belongs_to_many = []
88
+
89
+ @rails_model = nil
90
+ @statistics = nil
91
+ end
92
+
93
+ # Filter helpers
94
+ def filter_columns(type_of_columns)
95
+ case type_of_columns
96
+ when :columns_data
97
+ columns_data
98
+ when :columns_data_optional
99
+ columns_data_optional
100
+ when :columns_data_required
101
+ columns_data_required
102
+ when :columns_data_foreign
103
+ columns_data_foreign
104
+ when :columns_primary
105
+ columns_primary
106
+ when :columns_foreign
107
+ columns_foreign
108
+ when :columns_virtual
109
+ columns_virtual
110
+ when :columns_data_foreign_virtual
111
+ columns_data_foreign_virtual
112
+ when :columns_data_primary
113
+ columns_data_primary
114
+ when :columns_data_virtual
115
+ columns_data_virtual
116
+ else
117
+ columns
118
+ end
119
+ end
120
+
121
+ def to_h
122
+ {
123
+ name: name,
124
+ name_plural: name_plural,
125
+ type: type,
126
+ title: title,
127
+ required: required,
128
+ structure_type: structure_type,
129
+ reference_type: reference_type,
130
+ format_type: format_type,
131
+ description: description,
132
+ foreign_key: foreign_key,
133
+ foreign_table: foreign_table,
134
+ belongs_to: belongs_to,
135
+ foreign_id: foreign_id,
136
+ precision: precision,
137
+ scale: scale,
138
+ default: default,
139
+ null: null,
140
+ limit: limit,
141
+ array: array
142
+ }
143
+ end
144
+
145
+ # DONE
146
+ def columns_data
147
+ @columns_data ||= columns_for_structure_types(:data)
148
+ end
149
+ alias rows_fields columns_data
150
+
151
+ # TODO
152
+ def columns_data_optional
153
+ @columns_data_optional ||= columns_for_structure_types(:data).select { |_c| true }
154
+ end
155
+
156
+ # TODO
157
+ def columns_data_required
158
+ @columns_data_required ||= columns_for_structure_types(:data).select { |_c| false }
159
+ end
160
+
161
+ # DONE
162
+ def columns_primary
163
+ @columns_primary ||= columns_for_structure_types(:primary_key)
164
+ end
165
+
166
+ # DONE
167
+ def columns_foreign
168
+ @columns_foreign ||= columns_for_structure_types(:foreign_key)
169
+ end
170
+
171
+ # DONE
172
+ def columns_timestamp
173
+ @columns_data_timestamp ||= columns_for_structure_types(:timestamp)
174
+ end
175
+
176
+ # DONE
177
+ def columns_deleted_at
178
+ @columns_data_deleted_at ||= columns_for_structure_types(:deleted_at)
179
+ end
180
+
181
+ # DONE
182
+ def columns_virtual
183
+ @columns_virtual ||= columns_for_structure_types(:timestamp, :deleted_at)
184
+ end
185
+
186
+ # DONE
187
+ def columns_data_foreign
188
+ @columns_data_foreign ||= columns_for_structure_types(:data, :foreign_key)
189
+ end
190
+ alias rows_fields_and_fk columns_data_foreign
191
+
192
+ # DONE
193
+ def columns_data_primary
194
+ @columns_data_primary ||= columns_for_structure_types(:data, :primary_key)
195
+ end
196
+ alias rows_fields_and_pk columns_data_primary
197
+
198
+ # DONE
199
+ def columns_data_virtual
200
+ @columns_data_virtual ||= columns_for_structure_types(:data, :timestamp, :deleted_at)
201
+ end
202
+ alias rows_fields_and_virtual columns_data_virtual
203
+
204
+ # DONE
205
+ def columns_data_foreign_virtual
206
+ @columns_data_foreign_virtual ||= columns_for_structure_types(:data, :foreign_key, :timestamp, :deleted_at)
207
+ end
208
+
209
+ # DONE
210
+ def columns_for_structure_types(*structure_types)
211
+ columns.select { |column| structure_types.include?(column.structure_type) }
212
+ end
213
+
214
+ # Debug helpers
215
+
216
+ def debug(*flags)
217
+ debug_simple if flags.include?(:simple)
218
+ debug_detailed if flags.include?(:detailed)
219
+ debug_extra if flags.include?(:extra)
220
+
221
+ debug_columns(*flags)
222
+ debug_belongs_to(*flags)
223
+ debug_has_one(*flags)
224
+ debug_has_many(*flags)
225
+ debug_has_and_belongs_to_many(*flags)
226
+ # log.kv 'relations' , relations
227
+ end
228
+
229
+ def debug_simple
230
+ log.kv 'name' , name
231
+ log.kv 'name_plural' , name_plural
232
+ log.kv 'main_key' , main_key
233
+ log.kv 'model_type' , model_type
234
+ end
235
+
236
+ def debug_detailed
237
+ debug_simple
238
+ log.kv 'id' , id
239
+ log.kv 'trait1' , trait1
240
+ log.kv 'trait2' , trait2
241
+ log.kv 'trait3' , trait3
242
+ log.kv 'td_query' , td_query
243
+ log.kv 'key?' , key?
244
+ log.kv 'no_key' , no_key
245
+ end
246
+
247
+ def debug_extra
248
+ debug_detailed
249
+ log.kv 'force' , force
250
+ end
251
+
252
+ def debug_columns(*flags, column_list: columns)
253
+ c_simple = flags.include?(:columns_simple)
254
+ c_detailed = flags.include?(:columns_detailed)
255
+ c_extra = flags.include?(:columns_extra)
256
+ c_tabular = flags.include?(:columns_tabular_simple) || flags.include?(:columns_tabular)
257
+ c_tabular_detailed = flags.include?(:columns_tabular_detailed)
258
+ c_tabular_extra = flags.include?(:columns_tabular_extra)
259
+
260
+ return unless c_simple || c_detailed || c_extra || c_tabular || c_tabular_detailed || c_tabular_extra
261
+
262
+ log.section_heading('columns')
263
+
264
+ column_list.each { |column| column.debug(:simple) } if c_simple
265
+ column_list.each { |column| column.debug(:detailed) } if c_detailed
266
+ column_list.each { |column| column.debug(:extra) } if c_extra
267
+ tp column_list, *Column::SIMPLE_ATTRIBS if c_tabular
268
+ tp column_list, *Column::DETAILED_ATTRIBS if c_tabular_detailed
269
+ tp column_list, *Column::EXTRA_ATTRIBS if c_tabular_extra
270
+ end
271
+
272
+ def debug_belongs_to(*flags)
273
+ c_simple = flags.include?(:belongs_to_tabular)
274
+
275
+ return unless c_simple && belongs_to.length.positive?
276
+
277
+ log.section_heading('belongs_to')
278
+
279
+ tp belongs_to, :name, :model_name, :model_name_plural, *BelongsTo::KEYS
280
+ end
281
+
282
+ def debug_has_one(*flags)
283
+ c_simple = flags.include?(:has_one_tabular)
284
+
285
+ return unless c_simple && has_one.length.positive?
286
+
287
+ log.section_heading('has_one')
288
+
289
+ tp has_one, :name, :model_name, :model_name_plural, *HasOne::KEYS
290
+ end
291
+
292
+ def debug_has_many(*flags)
293
+ c_simple = flags.include?(:has_many_tabular)
294
+
295
+ return unless c_simple && has_many.length.positive?
296
+
297
+ log.section_heading('has_many')
298
+
299
+ tp has_many, :name, :model_name, :model_name_plural, *HasMany::KEYS
300
+ end
301
+
302
+ def debug_has_and_belongs_to_many(*flags)
303
+ c_simple = flags.include?(:has_and_belongs_to_many_tabular)
304
+
305
+ return unless c_simple && has_and_belongs_to_many.length.positive?
306
+
307
+ log.section_heading('has_and_belongs_to_many')
308
+
309
+ tp has_and_belongs_to_many, :name, :model_name, :model_name_plural, *HasAndBelongsToMany::KEYS
310
+ end
311
+ end
312
+ # ---------------------------------------------
313
+ # Available entity keys that can be mapped from
314
+ # ---------------------------------------------
315
+ # name
316
+ # name_plural
317
+ # id
318
+ # force
319
+ # created
320
+ # updated
321
+ # columns
322
+ # data_columns
323
+ # foreign_columns
324
+ # belongs
325
+ # has_one
326
+ # has_many
327
+ # has_and_belongs_to_many
328
+ # class_methods
329
+ # public_class_methods
330
+ # private_class_methods
331
+ # instance_methods
332
+ # public_instance_methods
333
+ # private_instance_methods
334
+ # default_scope
335
+ # scopes
336
+ # meta
337
+ end
338
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Rails model represents information that is found the model.rb class in the rails project
4
+ module KDomain
5
+ module DomainModel
6
+ class EntityStatistics
7
+ attr_accessor :column_counts
8
+ attr_accessor :code_counts
9
+ attr_accessor :code_dsl_counts
10
+ attr_accessor :data_counts
11
+ attr_accessor :issues
12
+
13
+ def initialize(entity)
14
+ # @column_counts = OpenStruct.new(meta[:column_counts])
15
+ # @code_counts = OpenStruct.new(meta[:code_counts])
16
+ # @code_dsl_counts = OpenStruct.new(meta[:code_dsl_counts])
17
+ # @data_counts = OpenStruct.new(meta[:data_counts])
18
+ # @issues = meta[:issues]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KDomain
4
+ module DomainModel
5
+ class ForeignKey
6
+ KEYS = %i[column name on_update on_delete].freeze
7
+
8
+ attr_accessor :left
9
+ attr_accessor :right
10
+
11
+ attr_accessor :column
12
+ attr_accessor :name
13
+ attr_accessor :on_update
14
+ attr_accessor :on_delete
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KDomain
4
+ module DomainModel
5
+ class HasAndBelongsToMany
6
+ KEYS = %i[a_lambda autosave code_duplicate].freeze
7
+
8
+ attr_accessor :name
9
+
10
+ attr_accessor :model_name
11
+ attr_accessor :model_name_plural
12
+
13
+ attr_accessor :a_lambda
14
+ attr_accessor :autosave
15
+
16
+ attr_accessor :related_entity
17
+ attr_accessor :code_duplicate
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KDomain
4
+ module DomainModel
5
+ class HasMany
6
+ KEYS = %i[a_lambda as dependent through class_name inverse_of primary_key foreign_key source code_duplicate].freeze
7
+
8
+ attr_accessor :name
9
+
10
+ attr_accessor :model_name
11
+ attr_accessor :model_name_plural
12
+
13
+ attr_accessor :a_lambda
14
+ attr_accessor :as
15
+ attr_accessor :dependent
16
+ attr_accessor :through
17
+ attr_accessor :class_name
18
+ attr_accessor :inverse_of
19
+ attr_accessor :primary_key
20
+ attr_accessor :foreign_key
21
+ attr_accessor :source
22
+
23
+ attr_accessor :related_entity
24
+ attr_accessor :code_duplicate
25
+ end
26
+ end
27
+ end