sis_core 1.0.2 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/sis/core/application_controller.rb +10 -2
  3. data/app/controllers/sis/core/menus_controller.rb +22 -0
  4. data/app/controllers/sis/core/users_controller.rb +71 -0
  5. data/app/models/sis/core/academic_programme.rb +17 -0
  6. data/app/models/sis/core/academic_year.rb +7 -0
  7. data/app/models/sis/core/applicant.rb +8 -1
  8. data/app/models/sis/core/application.rb +50 -0
  9. data/app/models/sis/core/application_document.rb +12 -0
  10. data/app/models/sis/core/application_module.rb +8 -0
  11. data/app/models/sis/core/application_setup.rb +23 -0
  12. data/app/models/sis/core/course.rb +10 -0
  13. data/app/models/sis/core/course_registration.rb +9 -0
  14. data/app/models/sis/core/document_requirement.rb +13 -0
  15. data/app/models/sis/core/{program_type.rb → document_type.rb} +1 -1
  16. data/app/models/sis/core/exam.rb +17 -0
  17. data/app/models/sis/core/exam_result.rb +25 -0
  18. data/app/models/sis/core/exam_setup.rb +15 -0
  19. data/app/models/sis/core/instructor.rb +6 -0
  20. data/app/models/sis/core/instructor_course.rb +8 -0
  21. data/app/models/sis/core/menu.rb +11 -0
  22. data/app/models/sis/core/programme.rb +7 -0
  23. data/app/models/sis/core/programme_level.rb +6 -0
  24. data/app/models/sis/core/programme_type.rb +6 -0
  25. data/app/models/sis/core/semester.rb +11 -0
  26. data/app/models/sis/core/student.rb +7 -0
  27. data/app/models/sis/core/user.rb +13 -0
  28. data/app/models/sis/core/user_role.rb +10 -0
  29. data/app/services/sis/core/user_service.rb +25 -0
  30. data/app/uploaders/sis/core/application_document_uploader.rb +51 -0
  31. data/app/uploaders/sis/core/photo_uploader.rb +51 -0
  32. data/config/routes.rb +6 -0
  33. data/db/migrate/20200105072142_create_sis_core_academic_years.rb +10 -0
  34. data/db/migrate/20200106072246_create_sis_core_semesters.rb +14 -0
  35. data/db/migrate/20200106130428_create_sis_core_programmes.rb +10 -0
  36. data/db/migrate/20200106132035_create_sis_core_academic_programmes.rb +21 -0
  37. data/db/migrate/20200106132521_create_sis_core_application_setups.rb +19 -0
  38. data/db/migrate/20200106133034_create_sis_core_document_requirements.rb +19 -0
  39. data/db/migrate/20200106133937_create_sis_core_applicants.rb +14 -2
  40. data/db/migrate/20200107094449_create_sis_core_applications.rb +24 -0
  41. data/db/migrate/20200107101638_create_sis_core_application_documents.rb +16 -0
  42. data/db/migrate/20200107302251_create_sis_core_exam_setups.rb +15 -0
  43. data/db/migrate/20200107333411_create_sis_core_exams.rb +17 -0
  44. data/db/migrate/20200107434658_create_sis_core_exam_results.rb +18 -0
  45. data/db/migrate/20200307033100_create_sis_core_courses.rb +19 -0
  46. data/db/migrate/20200307071511_create_sis_core_instructors.rb +10 -0
  47. data/db/migrate/20200307071736_create_sis_core_instructor_courses.rb +16 -0
  48. data/db/migrate/20200307072006_create_sis_core_students.rb +16 -0
  49. data/db/migrate/20200307072317_create_sis_core_course_registrations.rb +20 -0
  50. data/db/migrate/20200507114003_create_sis_core_users.rb +17 -0
  51. data/db/migrate/20200511165121_create_sis_core_application_modules.rb +15 -0
  52. data/db/migrate/20200511165241_create_sis_core_user_roles.rb +15 -0
  53. data/db/migrate/20200511165450_create_sis_core_menus.rb +18 -0
  54. data/lib/authorize_request.rb +18 -0
  55. data/lib/json_web_token.rb +12 -0
  56. data/lib/sis/core/engine.rb +2 -2
  57. data/lib/sis/core/version.rb +1 -1
  58. data/lib/sis_core.rb +5 -0
  59. data/spec/factories/sis/core/academic_programmes.rb +8 -0
  60. data/spec/factories/sis/core/academic_years.rb +6 -0
  61. data/spec/factories/sis/core/applicants.rb +9 -2
  62. data/spec/factories/sis/core/application_documents.rb +7 -0
  63. data/spec/factories/sis/core/application_modules.rb +6 -0
  64. data/spec/factories/sis/core/application_setups.rb +9 -0
  65. data/spec/factories/sis/core/applications.rb +11 -0
  66. data/spec/factories/sis/core/course_registrations.rb +7 -0
  67. data/spec/factories/sis/core/courses.rb +12 -0
  68. data/spec/factories/sis/core/document_requirements.rb +9 -0
  69. data/spec/factories/sis/core/document_types.rb +5 -0
  70. data/spec/factories/sis/core/exam_results.rb +8 -0
  71. data/spec/factories/sis/core/exam_setups.rb +8 -0
  72. data/spec/factories/sis/core/exams.rb +10 -0
  73. data/spec/factories/sis/core/instructor_courses.rb +6 -0
  74. data/spec/factories/sis/core/instructors.rb +6 -0
  75. data/spec/factories/sis/core/menus.rb +9 -0
  76. data/spec/factories/sis/core/programme_levels.rb +5 -0
  77. data/spec/factories/sis/core/programme_types.rb +5 -0
  78. data/spec/factories/sis/core/programmes.rb +6 -0
  79. data/spec/factories/sis/core/semesters.rb +7 -0
  80. data/spec/factories/sis/core/students.rb +9 -0
  81. data/spec/factories/sis/core/user_roles.rb +6 -0
  82. data/spec/factories/sis/core/users.rb +9 -0
  83. metadata +169 -22
  84. data/app/models/sis/core/attached_document.rb +0 -8
  85. data/app/models/sis/core/enrollment_application.rb +0 -9
  86. data/app/models/sis/core/program.rb +0 -9
  87. data/app/models/user.rb +0 -9
  88. data/config/initializers/devise_token_auth.rb +0 -55
  89. data/db/migrate/20200106001016_create_sis_core_field_of_studies.rb +0 -9
  90. data/db/migrate/20200106130428_create_sis_core_programs.rb +0 -10
  91. data/db/migrate/20200108092202_devise_token_auth_create_users.rb +0 -53
  92. data/db/migrate/20200108094449_create_sis_core_enrollment_applications.rb +0 -10
  93. data/db/migrate/20200108101638_create_sis_core_attached_documents.rb +0 -11
  94. data/spec/factories/sis/core/attached_documents.rb +0 -7
  95. data/spec/factories/sis/core/enrollment_applications.rb +0 -7
  96. data/spec/factories/sis/core/field_of_studies.rb +0 -6
  97. data/spec/factories/sis/core/program_types.rb +0 -5
  98. data/spec/factories/sis/core/programs.rb +0 -7
@@ -1,8 +0,0 @@
1
- module Sis
2
- module Core
3
- class AttachedDocument < ApplicationRecord
4
- validates :document, :document_type, presence: true
5
- belongs_to :enrollment_application, class_name: 'Sis::Core::EnrollmentApplication'
6
- end
7
- end
8
- end
@@ -1,9 +0,0 @@
1
- module Sis
2
- module Core
3
- class EnrollmentApplication < ApplicationRecord
4
- validates :status, presence: true
5
- belongs_to :applicant, class_name: 'Sis::Core::Applicant'
6
- belongs_to :program, class_name: 'Sis::Core::Program'
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- module Sis
2
- module Core
3
- class Program < ApplicationRecord
4
- belongs_to :program_type, class_name: 'Sis::Core::ProgramType', foreign_key: 'lookup_id'
5
- belongs_to :field_of_study, class_name: 'Sis::Core::FieldOfStudy'
6
- validates :mode_of_attendance, presence: true
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class User < ActiveRecord::Base
4
- # Include default devise modules. Others available are:
5
- # :confirmable, :lockable, :timeoutable and :omniauthable
6
- devise :database_authenticatable, :registerable,
7
- :recoverable, :rememberable, :trackable, :validatable
8
- include DeviseTokenAuth::Concerns::User
9
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- DeviseTokenAuth.setup do |config|
4
- # By default the authorization headers will change after each request. The
5
- # client is responsible for keeping track of the changing tokens. Change
6
- # this to false to prevent the Authorization header from changing after
7
- # each request.
8
- # config.change_headers_on_each_request = true
9
-
10
- # By default, users will need to re-authenticate after 2 weeks. This setting
11
- # determines how long tokens will remain valid after they are issued.
12
- # config.token_lifespan = 2.weeks
13
-
14
- # Limiting the token_cost to just 4 in testing will increase the performance of
15
- # your test suite dramatically. The possible cost value is within range from 4
16
- # to 31. It is recommended to not use a value more than 10 in other environments.
17
- config.token_cost = Rails.env.test? ? 4 : 10
18
-
19
- # Sets the max number of concurrent devices per user, which is 10 by default.
20
- # After this limit is reached, the oldest tokens will be removed.
21
- # config.max_number_of_devices = 10
22
-
23
- # Sometimes it's necessary to make several requests to the API at the same
24
- # time. In this case, each request in the batch will need to share the same
25
- # auth token. This setting determines how far apart the requests can be while
26
- # still using the same auth token.
27
- # config.batch_request_buffer_throttle = 5.seconds
28
-
29
- # This route will be the prefix for all oauth2 redirect callbacks. For
30
- # example, using the default '/omniauth', the github oauth2 provider will
31
- # redirect successful authentications to '/omniauth/github/callback'
32
- # config.omniauth_prefix = "/omniauth"
33
-
34
- # By default sending current password is not needed for the password update.
35
- # Uncomment to enforce current_password param to be checked before all
36
- # attribute updates. Set it to :password if you want it to be checked only if
37
- # password is updated.
38
- # config.check_current_password_before_update = :attributes
39
-
40
- # By default we will use callbacks for single omniauth.
41
- # It depends on fields like email, provider and uid.
42
- # config.default_callbacks = true
43
-
44
- # Makes it possible to change the headers names
45
- # config.headers_names = {:'access-token' => 'access-token',
46
- # :'client' => 'client',
47
- # :'expiry' => 'expiry',
48
- # :'uid' => 'uid',
49
- # :'token-type' => 'token-type' }
50
-
51
- # By default, only Bearer Token authentication is implemented out of the box.
52
- # If, however, you wish to integrate with legacy Devise authentication, you can
53
- # do so by enabling this flag. NOTE: This feature is highly experimental!
54
- # config.enable_standard_devise_support = false
55
- end
@@ -1,9 +0,0 @@
1
- class CreateSisCoreFieldOfStudies < ActiveRecord::Migration[6.0]
2
- def change
3
- create_table :sis_core_field_of_studies do |t|
4
- t.string :name
5
- t.references :lookup, index: true, null: false, foreign_key: { to_table: :sis_core_lookups }
6
- t.timestamps
7
- end
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- class CreateSisCorePrograms < ActiveRecord::Migration[6.0]
2
- def change
3
- create_table :sis_core_programs do |t|
4
- t.string :mode_of_attendance, null: false
5
- t.references :lookup, index: true, null: false, foreign_key: { to_table: :sis_core_lookups }
6
- t.references :field_of_study, index: true, null: false, foreign_key: { to_table: :sis_core_field_of_studies }
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,53 +0,0 @@
1
- class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[6.0]
2
- def change
3
- create_table(:users) do |t|
4
- ## Required
5
- t.string :provider, null: false, default: 'email'
6
- t.string :uid, null: false, default: ''
7
-
8
- ## Database authenticatable
9
- t.string :encrypted_password, null: false, default: ''
10
-
11
- ## Recoverable
12
- t.string :reset_password_token
13
- t.datetime :reset_password_sent_at
14
- t.boolean :allow_password_change, default: false
15
-
16
- ## Rememberable
17
- t.datetime :remember_created_at
18
-
19
- ## Confirmable
20
- t.string :confirmation_token
21
- t.datetime :confirmed_at
22
- t.datetime :confirmation_sent_at
23
- t.string :unconfirmed_email # Only if using reconfirmable
24
- ## Trackable
25
- t.integer :sign_in_count, default: 0, null: false
26
- t.datetime :current_sign_in_at
27
- t.datetime :last_sign_in_at
28
- t.string :current_sign_in_ip
29
- t.string :last_sign_in_ip
30
- ## Lockable
31
- # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
32
- # t.string :unlock_token # Only if unlock strategy is :email or :both
33
- # t.datetime :locked_at
34
-
35
- ## User Info
36
- t.string :name
37
- t.string :nickname
38
- t.string :image
39
- t.string :email
40
-
41
- ## Tokens
42
- t.text :tokens
43
-
44
- t.timestamps
45
- end
46
-
47
- add_index :users, :email, unique: true
48
- add_index :users, %i[uid provider], unique: true
49
- add_index :users, :reset_password_token, unique: true
50
- add_index :users, :confirmation_token, unique: true
51
- # add_index :users, :unlock_token, unique: true
52
- end
53
- end
@@ -1,10 +0,0 @@
1
- class CreateSisCoreEnrollmentApplications < ActiveRecord::Migration[6.0]
2
- def change
3
- create_table :sis_core_enrollment_applications do |t|
4
- t.string :status, null: false
5
- t.references :applicant, index: true, null: false, foreign_key: { to_table: :sis_core_applicants }
6
- t.references :program, index: true, null: false, foreign_key: { to_table: :sis_core_programs }
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,11 +0,0 @@
1
- class CreateSisCoreAttachedDocuments < ActiveRecord::Migration[6.0]
2
- def change
3
- create_table :sis_core_attached_documents do |t|
4
- t.string :document, null: false
5
- t.string :document_type, null: false
6
- t.references :enrollment_application, index: true, null: false,
7
- foreign_key: { to_table: :sis_core_enrollment_applications }
8
- t.timestamps
9
- end
10
- end
11
- end
@@ -1,7 +0,0 @@
1
- FactoryBot.define do
2
- factory :attached_document, class: 'Sis::Core::AttachedDocument' do
3
- document { FFaker::Name.name }
4
- document_type { FFaker::Name.name }
5
- association :enrollment_application
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- FactoryBot.define do
2
- factory :enrollment_application, class: 'Sis::Core::EnrollmentApplication' do
3
- status { FFaker::Name.name }
4
- association :applicant
5
- association :program
6
- end
7
- end
@@ -1,6 +0,0 @@
1
- FactoryBot.define do
2
- factory :field_of_study, class: 'Sis::Core::FieldOfStudy' do
3
- name { FFaker::Name.name }
4
- association :program_type
5
- end
6
- end
@@ -1,5 +0,0 @@
1
- FactoryBot.define do
2
- factory :program_type, class: 'Sis::Core::ProgramType', parent: :lookup do
3
- type { 'Sis::Core::ProgramType' }
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- FactoryBot.define do
2
- factory :program, class: 'Sis::Core::Program' do
3
- mode_of_attendance { FFaker::Name.name }
4
- association :program_type
5
- association :field_of_study
6
- end
7
- end