mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
# frozen_string_literal: true
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: institutions
|
|
#
|
|
# id :bigint not null, primary key
|
|
# contact_person :string
|
|
# deleted_at :datetime
|
|
# email :string not null
|
|
# name :string not null
|
|
# phone :string
|
|
# settings :jsonb
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
class Institution < ApplicationRecord
|
|
# Layer 1: Foundation relationships (FloDoc - standalone institutions)
|
|
has_many :cohorts, dependent: :destroy
|
|
|
|
# Validations
|
|
validates :name, presence: true, length: { minimum: 2, maximum: 255 }
|
|
validates :email, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
|
|
|
# Settings accessor with defaults
|
|
def settings_with_defaults
|
|
{
|
|
allow_student_enrollment: settings['allow_student_enrollment'] || true,
|
|
require_verification: settings['require_verification'] || true,
|
|
auto_finalize: settings['auto_finalize'] || false,
|
|
email_notifications: settings['email_notifications'] || true,
|
|
**settings
|
|
}.with_indifferent_access
|
|
end
|
|
end
|