mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
class documentation
This commit is contained in:
parent
f9837747f6
commit
02c1014412
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# AgeRange is an optional filter used to categorize Events
|
||||
# AgeRange
|
||||
class AgeRange < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# StatisticCustomAggregation is an ElasticSearch aggregation that will run when the end-user is browsing the statistics
|
||||
# page for the related statisticType.
|
||||
# page for the related StatisticType.
|
||||
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html
|
||||
class StatisticCustomAggregation < ApplicationRecord
|
||||
belongs_to :statistic_type
|
||||
|
@ -1,3 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Tag is a way to restrict an Availability for reservation to users with the same Tag.
|
||||
class Tag < ApplicationRecord
|
||||
has_many :user_tags, dependent: :destroy
|
||||
has_many :users, through: :user_tags
|
||||
|
@ -1,3 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Theme is an optional filter used to categorize Projects
|
||||
class Theme < ApplicationRecord
|
||||
has_and_belongs_to_many :projects, join_table: :projects_themes
|
||||
validates :name, presence: true, length: { maximum: 80 }
|
||||
|
@ -1,3 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Ticket is an reservation of a member for an Event, with a specific PriceCategory
|
||||
# For example, Member John Smith smith has book 2 places on Event "Arduino initiation" at price "reduces fare"
|
||||
class Ticket < ApplicationRecord
|
||||
belongs_to :reservation
|
||||
belongs_to :event_price_category
|
||||
|
@ -1,3 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Training is a course for members to acquire knowledge on a specific matter.
|
||||
# Trainings are designed to be scheduled periodically through Availabilities.
|
||||
# A Training can be a prerequisite before members can book a Machine.
|
||||
class Training < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
|
@ -1,4 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# TrainingImage is the main picture for a Training
|
||||
class TrainingImage < Asset
|
||||
mount_uploader :attachment, TrainingImageUploader
|
||||
end
|
@ -1,3 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# TrainingsAvailability is the relation table between a Training and an Availability.
|
||||
# Is is used to schedule a training session, for members to be able to book it.
|
||||
class TrainingsAvailability < ApplicationRecord
|
||||
belongs_to :training
|
||||
belongs_to :availability
|
||||
|
@ -1,3 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# TrainingsPricing configures the price of a Training session, per Group
|
||||
class TrainingsPricing < ApplicationRecord
|
||||
belongs_to :training
|
||||
belongs_to :group
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# User is a physical or moral person with its authentication parameters
|
||||
# It is linked to the Profile model with hold informations about this person (like address, name, etc.)
|
||||
# It is linked to the Profile model with hold information about this person (like address, name, etc.)
|
||||
class User < ApplicationRecord
|
||||
include NotifyWith::NotificationReceiver
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
|
@ -1,3 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# UserAvatar is the profile picture for an User
|
||||
class UserAvatar < Asset
|
||||
include ImageValidatorConcern
|
||||
mount_uploader :attachment, ProfilImageUploader
|
||||
|
@ -1,3 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# UserTag is the relation table between a Tag and an User.
|
||||
# Users with Tags, can book Availabilities associated with the same Tags.
|
||||
class UserTag < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :tag
|
||||
|
@ -1,7 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# UserCredit is the relation table between a Credit and an User.
|
||||
# It saves the consumed credits only
|
||||
class UsersCredit < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :credit
|
||||
|
||||
belongs_to :training_credit, ->{ where('credits.creditable_type = ?', 'Training') }, foreign_key: 'credit_id', class_name: 'Credit'
|
||||
belongs_to :machine_credit, ->{ where('credits.creditable_type = ?', 'Machine') }, foreign_key: 'credit_id', class_name: 'Credit'
|
||||
belongs_to :training_credit, -> { where('credits.creditable_type = ?', 'Training') }, foreign_key: 'credit_id', class_name: 'Credit'
|
||||
belongs_to :machine_credit, -> { where('credits.creditable_type = ?', 'Machine') }, foreign_key: 'credit_id', class_name: 'Credit'
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user