dscf-core 0.1.7 → 0.1.8

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.
@@ -0,0 +1,33 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe <%= spec_describe_name %>, type: :request do
4
+ include_context "authenticated_user"
5
+ it_behaves_like "request_shared_spec", "<%= controller_name %>", 14, []
6
+
7
+ let(:valid_attributes) do
8
+ {
9
+ # TODO: Add your valid attributes here
10
+ # Example:
11
+ # name: "Test Name",
12
+ # email: "test@example.com",
13
+ # status: "active"
14
+ }
15
+ end
16
+
17
+ let(:invalid_attributes) do
18
+ {
19
+ # TODO: Add your invalid attributes here
20
+ # Example:
21
+ # name: "",
22
+ # email: "invalid-email"
23
+ }
24
+ end
25
+
26
+ let(:new_attributes) do
27
+ {
28
+ # TODO: Add your update attributes here
29
+ # Example:
30
+ # name: "Updated Name"
31
+ }
32
+ end
33
+ end
@@ -0,0 +1,43 @@
1
+ <% if controller_namespace_modules.any? -%>
2
+ <% controller_namespace_modules.each do |mod| -%>
3
+ module <%= mod %>
4
+ <% end -%>
5
+ class <%= model_class_name %>Serializer < ActiveModel::Serializer
6
+ attributes <%= serializer_attributes %>
7
+ <% if model_exists? -%>
8
+ <% serializer_associations.each do |macro, associations| -%>
9
+
10
+ <% associations.each do |association| -%>
11
+ <%= macro %> :<%= association[:name] %><%= association[:serializer] ? ", serializer: #{association[:serializer]}" : "" %>
12
+ <% end -%>
13
+ <% end -%>
14
+ <% else -%>
15
+
16
+ # TODO: Model not found. Please ensure the model exists and add associations manually:
17
+ # belongs_to :association_name, serializer: AssociationSerializer
18
+ # has_many :association_names, serializer: AssociationSerializer
19
+ # has_one :association_name, serializer: AssociationSerializer
20
+ <% end -%>
21
+ end
22
+ <% controller_namespace_modules.reverse.each do |mod| -%>
23
+ end
24
+ <% end -%>
25
+ <% else -%>
26
+ class <%= model_class_name %>Serializer < ActiveModel::Serializer
27
+ attributes <%= serializer_attributes %>
28
+ <% if model_exists? -%>
29
+ <% serializer_associations.each do |macro, associations| -%>
30
+
31
+ <% associations.each do |association| -%>
32
+ <%= macro %> :<%= association[:name] %><%= association[:serializer] ? ", serializer: #{association[:serializer]}" : "" %>
33
+ <% end -%>
34
+ <% end -%>
35
+ <% else -%>
36
+
37
+ # TODO: Model not found. Please ensure the model exists and add associations manually:
38
+ # belongs_to :association_name, serializer: AssociationSerializer
39
+ # has_many :association_names, serializer: AssociationSerializer
40
+ # has_one :association_name, serializer: AssociationSerializer
41
+ <% end -%>
42
+ end
43
+ <% end -%>
@@ -0,0 +1,11 @@
1
+ FactoryBot.define do
2
+ factory :review, class: "Dscf::Core::Review" do
3
+ reviewable { create(:user) }
4
+ context { Faker::Lorem.word }
5
+
6
+ status { "pending" }
7
+ feedback { {} }
8
+ reviewed_by { create(:user) }
9
+ reviewed_at { nil }
10
+ end
11
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-16 00:00:00.000000000 Z
10
+ date: 2025-09-29 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -430,6 +430,7 @@ files:
430
430
  - app/controllers/concerns/dscf/core/filterable.rb
431
431
  - app/controllers/concerns/dscf/core/json_response.rb
432
432
  - app/controllers/concerns/dscf/core/pagination.rb
433
+ - app/controllers/concerns/dscf/core/reviewable_controller.rb
433
434
  - app/controllers/concerns/dscf/core/token_authenticatable.rb
434
435
  - app/controllers/dscf/core/addresses_controller.rb
435
436
  - app/controllers/dscf/core/application_controller.rb
@@ -437,6 +438,7 @@ files:
437
438
  - app/errors/dscf/core/authentication_error.rb
438
439
  - app/jobs/dscf/core/application_job.rb
439
440
  - app/mailers/dscf/core/application_mailer.rb
441
+ - app/models/concerns/dscf/core/reviewable_model.rb
440
442
  - app/models/concerns/dscf/core/user_authenticatable.rb
441
443
  - app/models/dscf/core/address.rb
442
444
  - app/models/dscf/core/application_record.rb
@@ -444,10 +446,20 @@ files:
444
446
  - app/models/dscf/core/business_type.rb
445
447
  - app/models/dscf/core/document.rb
446
448
  - app/models/dscf/core/refresh_token.rb
449
+ - app/models/dscf/core/review.rb
447
450
  - app/models/dscf/core/role.rb
448
451
  - app/models/dscf/core/user.rb
449
452
  - app/models/dscf/core/user_profile.rb
450
453
  - app/models/dscf/core/user_role.rb
454
+ - app/serializers/dscf/core/address_serializer.rb
455
+ - app/serializers/dscf/core/business_serializer.rb
456
+ - app/serializers/dscf/core/business_type_serializer.rb
457
+ - app/serializers/dscf/core/review_serializer.rb
458
+ - app/serializers/dscf/core/role_serializer.rb
459
+ - app/serializers/dscf/core/user_auth_serializer.rb
460
+ - app/serializers/dscf/core/user_profile_serializer.rb
461
+ - app/serializers/dscf/core/user_role_serializer.rb
462
+ - app/serializers/dscf/core/user_serializer.rb
451
463
  - app/services/dscf/core/auth_service.rb
452
464
  - app/services/dscf/core/token_service.rb
453
465
  - config/initializers/jwt.rb
@@ -466,15 +478,22 @@ files:
466
478
  - db/migrate/20250824114725_create_dscf_core_refresh_tokens.rb
467
479
  - db/migrate/20250824200927_make_email_and_phone_optional_for_users.rb
468
480
  - db/migrate/20250825192113_add_defaults_to_user_profiles.rb
481
+ - db/migrate/20250926102025_create_dscf_core_reviews.rb
469
482
  - lib/dscf/core.rb
470
483
  - lib/dscf/core/engine.rb
471
484
  - lib/dscf/core/version.rb
485
+ - lib/generators/common/USAGE
486
+ - lib/generators/common/common_generator.rb
487
+ - lib/generators/common/templates/controller.rb.erb
488
+ - lib/generators/common/templates/request_spec.rb.erb
489
+ - lib/generators/common/templates/serializer.rb.erb
472
490
  - lib/tasks/dscf/core_tasks.rake
473
491
  - spec/factories/dscf/core/addresses.rb
474
492
  - spec/factories/dscf/core/business_types.rb
475
493
  - spec/factories/dscf/core/businesses.rb
476
494
  - spec/factories/dscf/core/documents.rb
477
495
  - spec/factories/dscf/core/refresh_tokens.rb
496
+ - spec/factories/dscf/core/reviews.rb
478
497
  - spec/factories/dscf/core/roles.rb
479
498
  - spec/factories/dscf/core/user_profiles.rb
480
499
  - spec/factories/dscf/core/user_roles.rb