Skip to content

Overview

Models that are used/referred across all namespaces are present in the root of the models directory. They usually do not have any tenancy scoping.


AccessTokenDeviceDetail

Summary

The AccessTokenDeviceDetail model manages device details associated with OAuth access tokens. It captures information about the device and user agent used during authentication.

Fields/Columns

  • name: The name of the browser.
  • device_details: A JSON field storing details about the device, platform, and user agent.
  • oauth_access_token_id: The ID of the associated OAuth access token.

Relationships

  • belongs_to :oauth_access_token, class_name: Doorkeeper::AccessToken.name: Each access token device detail is associated with an OAuth access token.

AdminUser

Summary

The AdminUser model represents administrative users in the system. It manages authentication, password recovery, and session management for admin users.

Fields/Columns

  • email: The email address of the admin user.
  • encrypted_password: The encrypted password of the admin user.
  • reset_password_token: The token used for password recovery.
  • reset_password_sent_at: The timestamp when the password recovery token was sent.
  • remember_created_at: The timestamp when the user chose to be remembered.

Relationships

  • None

Concerns Used

  • Devise: Provides authentication and session management for the model.

ApplicationRecord

Summary

The ApplicationRecord model serves as the base class for all models in the application. It includes common functionality and configurations shared across all models.

Fields/Columns

  • None (abstract class)

Relationships

  • None

Concerns Used

  • RansackEverything: Provides search functionality for the model.

ExternalService

Summary

The ExternalService model manages external services integrated with the school system. It handles configuration and validation of service keys and options.

Fields/Columns

  • key: The key identifying the external service.
  • options: A JSON field storing configuration options for the service.

Relationships

  • None

Concerns Used

  • SchoolTenant: Provides multi-tenant support for the model.

FirebaseModel

Summary

The FirebaseModel model manages Firebase-related data for polymorphic models. It ensures that each Firebase model has a unique migration key and is associated with a specific model.

Fields/Columns

  • migration_key: The key used for migration.
  • model_id: The ID of the associated model.
  • model_type: The type of the associated model.

Relationships

  • belongs_to :model, polymorphic: true: Each Firebase model is associated with a polymorphic model.

Library

Summary

The Library module provides a namespace for all library-related models. It includes a method to set the table name prefix for library models.

Fields/Columns

  • None (module)

Relationships

  • None

LibrarySchoolSubgoalUnionView

Summary

The LibrarySchoolSubgoalUnionView model represents a union view of library and school subgoals. It provides a read-only view of subgoals associated with specific goals and students.

Fields/Columns

  • subgoal_id: The ID of the associated subgoal.
  • subgoal_type: The type of the associated subgoal.
  • goal_id: The ID of the associated goal.
  • student_id: The ID of the associated student.
  • school_id: The ID of the associated school.

Relationships

  • belongs_to :subgoal, polymorphic: true: Each union view is associated with a polymorphic subgoal.
  • belongs_to :goal, class_name: "Library::Goal": Each union view is associated with a goal.

LibrarySchoolSubgoalUnionView

Summary

The LibrarySchoolSubgoalUnionView model represents a union view of library and school subgoals. It provides a read-only view of subgoals associated with specific goals and students.

Fields/Columns

  • subgoal_id: The ID of the associated subgoal.
  • subgoal_type: The type of the associated subgoal.
  • goal_id: The ID of the associated goal.
  • student_id: The ID of the associated student.
  • school_id: The ID of the associated school.

Relationships

  • belongs_to :subgoal, polymorphic: true: Each union view is associated with a polymorphic subgoal.
  • belongs_to :goal, class_name: "Library::Goal": Each union view is associated with a goal.

Concerns Used

  • None

License

Summary

The License model represents licenses within the school system. It manages the association of licenses with curriculums and ensures the proper handling of license-related data.

Fields/Columns

  • name: The name of the license.
  • description: A description of the license.

Relationships

  • has_many :license_curriculums, dependent: :destroy: Each license can have many license curriculums.
  • has_many :curriculums, through: :license_curriculums: Each license can have many curriculums through license curriculums.

LicenseCurriculum

Summary

The LicenseCurriculum model represents the association between licenses and curriculums. It manages the domains associated with each curriculum under a specific license.

Fields/Columns

  • license_id: The ID of the associated license.
  • curriculum_id: The ID of the associated curriculum.

Relationships

  • belongs_to :curriculum, class_name: Library::Curriculum.name: Each license curriculum is associated with a curriculum.
  • has_many :curriculum_domains, class_name: LicenseCurriculumDomain.name, dependent: :destroy: Each license curriculum can have many curriculum domains.
  • has_many :domains, through: :curriculum_domains, class_name: Library::Domain.name: Each license curriculum can have many domains through curriculum domains.

Concerns Used

  • LicenseTenant: Provides multi-tenant support for the model.

LicenseCurriculumDomain

Summary

The LicenseCurriculumDomain model represents the association between license curriculums and domains. It ensures that each domain is properly linked to a license curriculum.

Fields/Columns

  • domain_id: The ID of the associated domain.
  • license_curriculum_id: The ID of the associated license curriculum.

Relationships

  • belongs_to :domain, class_name: "Library::Domain": Each license curriculum domain is associated with a domain.
  • belongs_to :license_curriculum: Each license curriculum domain is associated with a license curriculum.

Medium

Summary

The Medium model represents media files within the school system. It manages the uploading, validation, and storage of various media types, including images, PDFs, and CSV files.

Fields/Columns

  • file: The attached media file.
  • access_mode: The access mode of the media file (e.g., public, private).
  • record_id: The ID of the associated record.
  • record_type: The type of the associated record.

Relationships

  • belongs_to :record, polymorphic: true, optional: true: Each medium can optionally be associated with a polymorphic record.

Concerns Used

  • ActiveStoragePath: Provides methods for managing the storage path of the media file.

Migration

Summary

The Migration module handles the setup and migration of data within the school system. It provides methods for loading and processing data dumps to initialize or update the database.

Fields/Columns

  • None (module)

Relationships

  • None

Profile

Summary

The Profile model represents user profiles within the school system. It manages user-specific information and delegates certain attributes to the associated user model.

Fields/Columns

  • user_id: The ID of the associated user.
  • role: The role of the profile (e.g., student, teacher, admin).

Relationships

  • belongs_to :user: Each profile is associated with a user.

Concerns Used

  • FirebaseEntity: Provides integration with Firebase for the model.

RichtextRecord

Summary

The RichtextRecord model represents rich text content within the school system. It manages the association of rich text content with various polymorphic owners.

Fields/Columns

  • content: The rich text content.
  • editor: The editor used to create the content.
  • owner_id: The ID of the associated owner.
  • owner_type: The type of the associated owner.

Relationships

  • belongs_to :owner, polymorphic: true: Each rich text record is associated with a polymorphic owner.

SchoolCurriculumDomain

Summary

The SchoolCurriculumDomain model represents the association between school curriculums and domains. It ensures that each domain is properly linked to a school curriculum.

Fields/Columns

  • school_curriculum_id: The ID of the associated school curriculum.
  • domain_id: The ID of the associated domain.

Relationships

  • belongs_to :school_curriculum: Each school curriculum domain is associated with a school curriculum.
  • belongs_to :domain, class_name: "Library::Domain": Each school curriculum domain is associated with a domain.

SchoolCurriculum

Summary

The SchoolCurriculum model represents the association between schools and curriculums. It manages the domains associated with each curriculum under a specific school.

Fields/Columns

  • school_id: The ID of the associated school.
  • curriculum_id: The ID of the associated curriculum.
  • position: The position of the curriculum within the school.

Relationships

  • belongs_to :school: Each school curriculum is associated with a school.
  • belongs_to :curriculum, class_name: "Library::Curriculum": Each school curriculum is associated with a curriculum.
  • has_many :curriculum_domains, class_name: "SchoolCurriculumDomain", dependent: :destroy: Each school curriculum can have many curriculum domains.
  • has_many :domains, through: :curriculum_domains, class_name: "Library::Domain": Each school curriculum can have many domains through curriculum domains.

School

Summary

The School model represents schools within the system. It manages the association of schools with curriculums, classrooms, students, and various other entities.

Fields/Columns

  • name: The name of the school.
  • kind: The type of the school (e.g., platform-school, school).
  • description: A description of the school.

Relationships

  • has_many :school_curriculums, dependent: :destroy: Each school can have many school curriculums.
  • has_many :curriculums, through: :school_curriculums: Each school can have many curriculums through school curriculums.
  • has_many :classrooms, class_name: "School::Classroom": Each school can have many classrooms.
  • has_many :semester_records, class_name: "School::Semester", dependent: :destroy: Each school can have many semester records.
  • has_many :domains, through: :curriculums, class_name: "Library::Domain": Each school can have many domains through curriculums.
  • has_many :categories, through: :domains, class_name: "Library::Category": Each school can have many categories through domains.
  • has_many :goals, through: :categories, class_name: "Library::Goal": Each school can have many goals through categories.
  • has_many :students, class_name: "School::Student": Each school can have many students.
  • has_many :calendar_days: Each school can have many calendar days.
  • has_many :reports, class_name: "School::SchoolReport": Each school can have many reports.
  • has_one :sendgrid_email_service, class_name: "Email::Sendgrid::Service": Each school can have one SendGrid email service.

Concerns Used

  • School::Settings: Provides configuration settings for the school.

Seeds

Summary

The Seeds module handles the setup and seeding of data within the school system. It provides methods for initializing library and school data.

Fields/Columns

  • None (module)

Relationships

  • None

SimulatedService

Summary

The SimulatedService model represents simulated services within the school system. It manages the generation and validation of service numbers for simulated services.

Fields/Columns

  • service_number: The unique service number for the simulated service.
  • name: The name of the simulated service.

Relationships

  • None

Concerns Used

  • SchoolTenant: Provides multi-tenant support for the model.

Tag

Summary

The Tag model represents tags within the system. It manages the categorization and organization of various entities using tags.

Fields/Columns

  • name: The name of the tag.

Relationships

  • has_many :taggings, dependent: :destroy: Each tag can have many taggings.

Tagging

Summary

The Tagging model represents the association between tags and taggable entities within the system.

Fields/Columns

  • tag_id: The ID of the associated tag.
  • taggable_id: The ID of the associated taggable entity.
  • taggable_type: The type of the associated taggable entity.

Relationships

  • belongs_to :tag: Each tagging is associated with a tag.
  • belongs_to :taggable, polymorphic: true: Each tagging is associated with a polymorphic taggable entity.

User

Summary

The User model represents users within the system. It manages authentication, profiles, and access tokens for users.

Fields/Columns

  • email: The email address of the user.
  • name: The name of the user.
  • encrypted_password: The encrypted password of the user.
  • reset_password_token: The token used for password recovery.
  • reset_password_sent_at: The timestamp when the password recovery token was sent.
  • remember_created_at: The timestamp when the user chose to be remembered.

Relationships

  • has_many :access_grants, class_name: "Doorkeeper::AccessGrant", as: "resource_owner", dependent: :delete_all: Each user can have many access grants.
  • has_many :access_tokens, class_name: "Doorkeeper::AccessToken", as: "resource_owner", dependent: :delete_all: Each user can have many access tokens.
  • has_many :profiles, dependent: :destroy: Each user can have many profiles.
  • has_many :library_profiles, class_name: "Library::Profile", dependent: :destroy: Each user can have many library profiles.
  • has_many :school_profiles, class_name: "School::Profile", dependent: :destroy: Each user can have many school profiles.
  • has_many :staff_profiles, class_name: "School::Profile::Staff", dependent: :destroy: Each user can have many staff profiles.
  • has_many :guardian_profiles, class_name: "School::Profile::Guardian", dependent: :destroy: Each user can have many guardian profiles.
  • has_many :license_profiles, class_name: "License::Profile", dependent: :destroy: Each user can have many license profiles.

Concerns Used

  • Devise: Provides authentication and session management for the model.
  • FirebaseEntity: Provides integration with Firebase for the model.

Medium

Summary

The Medium model represents media files within the school system. It manages the uploading, validation, and storage of various media types, including images, PDFs, and CSV files.

Fields/Columns

  • file: The attached media file.
  • access_mode: The access mode of the media file (e.g., public, private).
  • record_id: The ID of the associated record.
  • record_type: The type of the associated record.

Relationships

  • belongs_to :record, polymorphic: true, optional: true: Each medium can optionally be associated with a polymorphic record.

Concerns Used

  • ActiveStoragePath: Provides methods for managing the storage path of the media file.

Migration

Summary

The Migration module handles the setup and migration of data within the school system. It provides methods for loading and processing data dumps to initialize or update the database.

Fields/Columns

  • None (module)

Relationships

  • None

Profile

Summary

The Profile model represents user profiles within the school system. It manages user-specific information and delegates certain attributes to the associated user model.

Fields/Columns

  • user_id: The ID of the associated user.
  • role: The role of the profile (e.g., student, teacher, admin).

Relationships

  • belongs_to :user: Each profile is associated with a user.

Concerns Used

  • FirebaseEntity: Provides integration with Firebase for the model.

RichtextRecord

Summary

The RichtextRecord model represents rich text content within the school system. It manages the association of rich text content with various polymorphic owners.

Fields/Columns

  • content: The rich text content.
  • editor: The editor used to create the content.
  • owner_id: The ID of the associated owner.
  • owner_type: The type of the associated owner.

Relationships

  • belongs_to :owner, polymorphic: true: Each rich text record is associated with a polymorphic owner.