source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/notes/destroy.rb
Ruby
mit
45
main
1,188
# frozen_string_literal: true class Notes::Destroy < ApplicationOperation include Dry::Monads[:result, :do] option :id, Types::Strict::String | Types::Strict::Integer option :actor_account, Types::Instance(Account) def call note = Note.find(id) note_thread = note.note_thread ActiveRecord::Base.t...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/positions/order.rb
Ruby
mit
45
main
639
# frozen_string_literal: true class Positions::Order < ApplicationOperation include Dry::Monads[:result] MULTIPLIER = { "open" => 10, "on_hold" => 1, "draft" => 0.1, "closed" => 0 }.freeze option :positions, Types::Strict::Array.of(Types::Instance(Position)) option :query, Types::Strict::String def call ...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/positions/change.rb
Ruby
mit
45
main
6,246
# frozen_string_literal: true class Positions::Change < ApplicationOperation include Dry::Monads[:result, :do] option :position, Types::Instance(Position) option :params, Types::Strict::Hash.schema( name?: Types::Strict::String, recruiter_id?: Types::Strict::String.optional, location_id?: Types::Str...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/positions/change_status.rb
Ruby
mit
45
main
2,764
# frozen_string_literal: true class Positions::ChangeStatus < ApplicationOperation include Dry::Monads[:result, :do] option :position, Types::Instance(Position) option :actor_account, Types::Instance(Account) option :new_status, Types::Strict::String option :new_change_status_reason, Types::Strict::String ...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/positions/add.rb
Ruby
mit
45
main
2,077
# frozen_string_literal: true class Positions::Add < ApplicationOperation include Dry::Monads[:result, :do] option :params, Types::Strict::Hash.schema( name: Types::Strict::String, location_id?: Types::Coercible::Integer.optional.fallback(nil) ) option :actor_account, Types::Instance(Account) def c...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/positions/change_stages.rb
Ruby
mit
45
main
1,054
# frozen_string_literal: true class Positions::ChangeStages < ApplicationOperation include Dry::Monads[:result, :do] option :position, Types::Instance(Position) option :stages_attributes, Types::Strict::Hash option :actor_account, Types::Instance(Account) def call new_and_changed_stages = stages_attrib...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/scorecard_template_questions/add.rb
Ruby
mit
45
main
1,041
# frozen_string_literal: true class ScorecardTemplateQuestions::Add < ApplicationOperation include Dry::Monads[:result, :try] option :params, Types::Strict::Hash.schema( scorecard_template: Types.Instance(ScorecardTemplate), list_index: Types::Integer, question: Types::String ) def call score...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/select_component/score.rb
Ruby
mit
45
main
2,300
# frozen_string_literal: true # This logic comes from selectize score function. class SelectComponent::Score < ApplicationOperation include Dry::Monads[:result] option :text, Types::Strict::String option :query, Types::Strict::String def call string_for_regex = Regexp.escape(query).chars.map { |letter| D...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/tasks/add.rb
Ruby
mit
45
main
2,692
# frozen_string_literal: true class Tasks::Add < ApplicationOperation include Dry::Monads[:result, :do] option :params, Types::Strict::Hash.schema( name: Types::Strict::String, due_date: Types::Strict::String | Types::Instance(Date), description?: Types::Strict::String, repeat_interval?: Types::St...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/tasks/change_status.rb
Ruby
mit
45
main
2,461
# frozen_string_literal: true class Tasks::ChangeStatus < ApplicationOperation include Dry::Monads[:result, :do] option :task, Types::Instance(Task) option :new_status, Types::Strict::String.enum(*Task.statuses.keys) option :actor_account, Types::Instance(Account) def call return Success(task) if task....
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/tasks/change.rb
Ruby
mit
45
main
2,574
# frozen_string_literal: true class Tasks::Change < ApplicationOperation include Dry::Monads[:result, :do] option :task, Types::Instance(Task) option :params, Types::Strict::Hash.schema( name?: Types::Strict::String, due_date?: Types::Strict::String | Types::Instance(Date), description?: Types::Stri...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/upload_file.rb
Ruby
mit
45
main
1,942
# frozen_string_literal: true class Candidates::UploadFile < ApplicationOperation include Dry::Monads[:result, :do] option :candidate, Types::Instance(Candidate) option :actor_account, Types::Instance(Account).optional, optional: true option :file, Types::Instance(ActionDispatch::Http::UploadedFile) option ...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/upload_pdf_file.rb
Ruby
mit
45
main
2,758
# frozen_string_literal: true class Candidates::UploadPDFFile < ApplicationOperation include Dry::Monads[:result, :do] option :candidate, Types::Instance(Candidate) option :actor_account, Types::Instance(Account).optional, optional: true option :file, Types::Instance(ActionDispatch::Http::UploadedFile) opti...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/change.rb
Ruby
mit
45
main
8,215
# frozen_string_literal: true class Candidates::Change < ApplicationOperation include Dry::Monads[:result, :do] option :candidate, Types::Instance(Candidate) option :actor_account, Types::Instance(Account).optional, optional: true option :namespace, Types::Strict::Symbol, optional: true, default: -> { :ats } ...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/apply.rb
Ruby
mit
45
main
2,141
# frozen_string_literal: true class Candidates::Apply < ApplicationOperation include Dry::Monads[:result, :do, :try] option :actor_account, Types::Instance(Account).optional option :method, Types::Strict::String, default: -> { "applied" } option :params, Types::Strict::Hash.schema( email: Types::Strict::S...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/remove_file.rb
Ruby
mit
45
main
1,004
# frozen_string_literal: true class Candidates::RemoveFile < ApplicationOperation include Dry::Monads[:result, :do] option :candidate, Types::Instance(Candidate) option :actor_account, Types::Instance(Account) option :file, Types::Instance(ActiveStorage::Attachment) def call ActiveRecord::Base.transact...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/add.rb
Ruby
mit
45
main
6,246
# frozen_string_literal: true class Candidates::Add < ApplicationOperation include Dry::Monads[:do, :result] option :actor_account, Types::Instance(Account).optional option :method, Types::String.enum("api", "applied", "manual") option :params, Types::Strict::Hash.schema( alternative_names?: Types::Strict...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/merge.rb
Ruby
mit
45
main
18,976
# frozen_string_literal: true class Candidates::Merge < ApplicationOperation include Dry::Monads[:result] # target is used to perform the merge on a list of candidates: target + duplicates. option :target, Types::Instance(Candidate) # actor_account_id is the one who performed the merge. option :actor_accou...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/update_from_cv.rb
Ruby
mit
45
main
3,998
# frozen_string_literal: true class Candidates::UpdateFromCV < ApplicationOperation include Dry::Monads[:result, :do] option :cv_file, Types::Instance(ActionDispatch::Http::UploadedFile) option :candidate, Types.Instance(Candidate) option :actor_account, Types::Instance(Account).optional, optional: true de...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/alternative_names/change.rb
Ruby
mit
45
main
1,425
# frozen_string_literal: true class Candidates::AlternativeNames::Change < ApplicationOperation include Dry::Monads[:result, :do, :try] option :candidate, Types::Instance(Candidate) option :actor_account, Types::Instance(Account) option :alternative_names, Types::Strict::Array.of( Types::Strict::Hash.sche...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/candidates/alternative_names/add.rb
Ruby
mit
45
main
836
# frozen_string_literal: true class Candidates::AlternativeNames::Add < ApplicationOperation include Dry::Monads[:result, :try] option :candidate, Types::Instance(Candidate) option :alternative_name, Types::Strict::String def call result = Try[ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique] d...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/placements/change_status.rb
Ruby
mit
45
main
1,633
# frozen_string_literal: true class Placements::ChangeStatus < ApplicationOperation include Dry::Monads[:result, :do] option :new_status, Types::Strict::String.enum(*Placement.statuses.keys) option :disqualify_reason_id, Types::Coercible::Integer.optional, optional: true option :placement, Types::Instance(Pla...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/placements/destroy.rb
Ruby
mit
45
main
1,094
# frozen_string_literal: true class Placements::Destroy < ApplicationOperation include Dry::Monads[:result, :do] option :placement, Types::Instance(Placement) option :actor_account, Types::Instance(Account) def call ActiveRecord::Base.transaction do add_event(placement:, actor_account:) yield...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/placements/add.rb
Ruby
mit
45
main
2,104
# frozen_string_literal: true class Placements::Add < ApplicationOperation include Dry::Monads[:result, :do] option :params, Types::Strict::Hash.schema( candidate_id: Types::Coercible::Integer, position_id: Types::Coercible::Integer, suggestion_disqualify_reason?: Types::Strict::String.optional ) ...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/placements/change_stage.rb
Ruby
mit
45
main
1,199
# frozen_string_literal: true class Placements::ChangeStage < ApplicationOperation include Dry::Monads[:result, :do] option :new_stage, Types::Strict::String option :placement, Types::Instance(Placement) option :actor_account, Types::Instance(Account).optional, optional: true def call old_stage = place...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/scorecards/new.rb
Ruby
mit
45
main
814
# frozen_string_literal: true class Scorecards::New < ApplicationOperation include Dry::Monads[:result, :do] option :scorecard_template, Types.Instance(ScorecardTemplate) option :placement, Types.Instance(Placement) def call params = { placement: } params[:position_stage_id] = scorecard_template.posi...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/scorecards/destroy.rb
Ruby
mit
45
main
757
# frozen_string_literal: true class Scorecards::Destroy < ApplicationOperation include Dry::Monads[:result] option :scorecard, Types.Instance(Scorecard) option :actor_account, Types.Instance(Account) def call placement = scorecard.placement candidate_id = placement.candidate_id ActiveRecord::Bas...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/scorecards/add.rb
Ruby
mit
45
main
1,838
# frozen_string_literal: true class Scorecards::Add < ApplicationOperation include Dry::Monads[:result, :do] option :params, Types::Params::Hash.schema( title: Types::Params::String, interviewer_id: Types::Params::Integer, score: Types::Params::String, summary?: Types::Params::String, position...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/scorecards/change.rb
Ruby
mit
45
main
2,579
# frozen_string_literal: true class Scorecards::Change < ApplicationOperation include Dry::Monads[:result, :do] option :params, Types::Params::Hash.schema( interviewer_id: Types::Params::Integer, score: Types::Params::String, summary?: Types::Params::String ) option :questions_params, Types::Stric...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/settings/recruitment/sources/change.rb
Ruby
mit
45
main
2,430
# frozen_string_literal: true class Settings::Recruitment::Sources::Change < ApplicationOperation include Dry::Monads[:result, :do] option :actor_account, Types::Instance(Account).optional option :candidate_sources_params, Types::Strict::Array.of( Types::Strict::Hash.schema( id?...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/settings/recruitment/disqualify_reasons/bulk_update.rb
Ruby
mit
45
main
3,495
# frozen_string_literal: true class Settings::Recruitment::DisqualifyReasons::BulkUpdate < ApplicationOperation include Dry::Monads[:result, :do] option :disqualify_reasons_params, Types::Strict::Array.of( Types::Strict::Hash.schema( id?: Types::Strict::String, title:...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/members/invite.rb
Ruby
mit
45
main
1,214
# frozen_string_literal: true class Members::Invite < ApplicationOperation include Dry::Monads[:result] option :email, Types::Strict::String option :actor_account, Types::Instance(Account) def call access_token = nil cleaned_email = email.strip return Failure(:invalid_email) unless EmailRegexp::...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/scorecard_questions/add.rb
Ruby
mit
45
main
988
# frozen_string_literal: true class ScorecardQuestions::Add < ApplicationOperation include Dry::Monads[:result, :try] option :params, Types::Strict::Hash.schema( scorecard: Types.Instance(Scorecard), list_index: Types::Strict::Integer, question: Types::Params::String, answer?: Types::Params::Strin...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/scorecard_questions/new.rb
Ruby
mit
45
main
378
# frozen_string_literal: true class ScorecardQuestions::New < ApplicationOperation include Dry::Monads[:result] option :params, Types::Strict::Hash.schema( scorecard: Types.Instance(Scorecard), list_index: Types::Integer, question: Types::String ) def call scorecard_question = ScorecardQuesti...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/scorecard_questions/change.rb
Ruby
mit
45
main
834
# frozen_string_literal: true class ScorecardQuestions::Change < ApplicationOperation include Dry::Monads[:result, :try] option :scorecard_question, Types.Instance(ScorecardQuestion) option :answer, Types::Params::String def call scorecard_question.answer = answer result = Try[ActiveRecord::RecordIn...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/attachment_informations/add.rb
Ruby
mit
45
main
487
# frozen_string_literal: true class AttachmentInformations::Add < ApplicationOperation include Dry::Monads[:result] option :params, Types::Strict::Hash def call attachment_information = AttachmentInformation.new attachment_information.assign_attributes(params) if attachment_information.valid? ...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/attachment_informations/change.rb
Ruby
mit
45
main
508
# frozen_string_literal: true class AttachmentInformations::Change < ApplicationOperation include Dry::Monads[:result] option :attachment_information, Types::Instance(AttachmentInformation) option :params, Types::Strict::Hash def call attachment_information.assign_attributes(params) if attachment_in...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/email_threading/find_existing_email_thread.rb
Ruby
mit
45
main
3,115
# frozen_string_literal: true class EmailThreading::FindExistingEmailThread < ApplicationOperation include Dry::Monads[:result, :do] option :imap_message, Types::Instance(Imap::Message) def call # Try to go easy route and find the message current one replies to. if imap_message.in_reply_to.present? || ...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/email_threading/thread.rb
Ruby
mit
45
main
9,381
# frozen_string_literal: true # Based on the algorithm described at https://www.jwz.org/doc/threading.html. class EmailThreading::Thread < ApplicationOperation class Container attr_accessor :message, :parent, :children def initialize(message:, parent: nil, children: []) @message = message @paren...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/locations/order.rb
Ruby
mit
45
main
998
# frozen_string_literal: true class Locations::Order < ApplicationOperation include Dry::Monads[:result] option :locations, Types::Strict::Array.of(Types::Instance(Location)) option :query, Types::Strict::String def call locations_with_score = locations.map do |location| location_score = SelectComp...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/email_synchronization/synchronize.rb
Ruby
mit
45
main
2,345
# frozen_string_literal: true class EmailSynchronization::Synchronize < ApplicationOperation include Dry::Monads[:result, :do] option :imap_account, Types::Instance(Imap::Account) option :only_for_email_addresses, [Types::Strict::String], default: proc { [] } BATCH_SIZE = 50 def call if only_for_email...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/email_synchronization/retrieve_gmail_tokens.rb
Ruby
mit
45
main
1,636
# frozen_string_literal: true class EmailSynchronization::RetrieveGmailTokens < ApplicationOperation include Dry::Monads[:result, :do] option :current_member, Types::Instance(Member) option :code, Types::Strict::String option :redirect_uri, Types::Strict::String def call access_token, refresh_token = y...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/email_synchronization/message_member.rb
Ruby
mit
45
main
201
# frozen_string_literal: true class EmailSynchronization::MessageMember < ApplicationOperation option :field, Types::Symbol.enum(:from, :to, :cc, :bcc) option :member, Types::Instance(Member) end
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/email_synchronization/process_single_message.rb
Ruby
mit
45
main
5,950
# frozen_string_literal: true class EmailSynchronization::ProcessSingleMessage < ApplicationOperation include Dry::Monads[:result, :do] option :message, Types::Instance(Imap::Message) REPLY_DURATION = 1.hour def call return Failure(:message_already_exists) if EmailMessage.exists?(message_id: message.mes...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/email_synchronization/process_single_message/create_from_imap.rb
Ruby
mit
45
main
2,227
# frozen_string_literal: true class EmailSynchronization::ProcessSingleMessage::CreateFromImap < ApplicationOperation include Dry::Monads[:result] option :message, Types::Instance(Imap::Message) option :email_thread_id, Types::Coercible::Integer option :message_member, Types::Instance(EmailSynchronization::Me...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/email_synchronization/process_single_message/advance_placements_to_replied_stage.rb
Ruby
mit
45
main
647
# frozen_string_literal: true class EmailSynchronization::ProcessSingleMessage::AdvancePlacementsToRepliedStage < ApplicationOperation include Dry::Monads[:result, :do] option :email_message, Types::Instance(EmailMessage) def call email_message.email_thread.candidates_in_thread.each do |candidate| ...
github
freeats/freeats
https://github.com/freeats/freeats
app/operations/email_synchronization/process_single_message/upload_attachments.rb
Ruby
mit
45
main
1,400
# frozen_string_literal: true class EmailSynchronization::ProcessSingleMessage::UploadAttachments < ApplicationOperation # Do not include "do" here, apparently it doesn't play nice with file manipulations and # causes flaky tests with the error: # NoMethodError: super: no superclass method `call' include Dry::...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/access_token.rb
Ruby
mit
45
main
519
# frozen_string_literal: true class AccessToken < ApplicationRecord include EmailRegexp MEMBER_INVITATION_TTL = 4.weeks acts_as_tenant(:tenant) enum :context, [:member_invitation].index_with(&:to_s) validates :hashed_token, :sent_to, :context, presence: true validates :sent_to, format: { with: EMAIL_REG...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/invited_member.rb
Ruby
mit
45
main
340
# frozen_string_literal: true class InvitedMember include ActiveModel::Model include ActiveModel::Attributes attribute :name, :string attribute :email, :string attribute :access_level, :string attribute :created_at, :datetime attribute :id, :integer def param_key "invited_user" end def avata...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/email_message.rb
Ruby
mit
45
main
10,418
# frozen_string_literal: true class EmailMessage < ApplicationRecord acts_as_tenant(:tenant) MAIL_SERVICE_ADDRESSES = %w[ mailer-daemon@googlemail.com mailer-daemon@yahoo.com mailer-daemon@kapsi.fi notifications@gitflow.com notification@slack.com notifications@mixmax.com postmaster@out...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/candidate_alternative_name.rb
Ruby
mit
45
main
211
# frozen_string_literal: true class CandidateAlternativeName < ApplicationRecord acts_as_tenant(:tenant) belongs_to :candidate strip_attributes collapse_spaces: true, allow_empty: true, only: :name end
github
freeats/freeats
https://github.com/freeats/freeats
app/models/location_hierarchy.rb
Ruby
mit
45
main
243
# frozen_string_literal: true class LocationHierarchy < ApplicationRecord belongs_to :parent_location, optional: true, class_name: "Location" belongs_to :location validates :path, presence: true validates :path, uniqueness: true end
github
freeats/freeats
https://github.com/freeats/freeats
app/models/liquid_template.rb
Ruby
mit
45
main
2,064
# frozen_string_literal: true class LiquidTemplate EMAIL_TEMPLATE_VARIABLE_NAMES = %w[first_name full_name sender_first_name sender_full_name company position].freeze def self.extract_attributes_from(current_member:, candidate:) { "first_name" => candidate.full_name.split.first, "full_name" =>...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/event.rb
Ruby
mit
45
main
4,575
# frozen_string_literal: true class Event < ApplicationRecord acts_as_tenant(:tenant) TASK_TYPES_FOR_PROFILE_ACTIVITY_TAB = %i[task_added task_changed task_status_changed].freeze belongs_to :actor_account, class_name: "Account", optional: true belongs_to :eventable, polymorphic: true belongs_to :assigned_m...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/candidate_source.rb
Ruby
mit
45
main
307
# frozen_string_literal: true class CandidateSource < ApplicationRecord acts_as_tenant(:tenant) has_many :candidates, dependent: :nullify strip_attributes collapse_spaces: true, allow_empty: true, only: :name validates :name, presence: true validates :name, uniqueness: { scope: :tenant } end
github
freeats/freeats
https://github.com/freeats/freeats
app/models/placement.rb
Ruby
mit
45
main
2,462
# frozen_string_literal: true class Placement < ApplicationRecord acts_as_tenant(:tenant) has_many :events, as: :eventable, dependent: :destroy has_many :scorecards, dependent: :destroy has_one :added_event, -> { where(type: "placement_added") }, class_name: "Event", foreign_key...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/disqualify_reason.rb
Ruby
mit
45
main
563
# frozen_string_literal: true class DisqualifyReason < ApplicationRecord acts_as_tenant(:tenant) MANDATORY_REASONS = ["No reply", "Position closed"].freeze has_many :placements, dependent: :restrict_with_exception validates :title, presence: true, uniqueness: { scope: :tenant_id, con...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/scorecard_question.rb
Ruby
mit
45
main
234
# frozen_string_literal: true class ScorecardQuestion < ApplicationRecord acts_as_tenant(:tenant) belongs_to :scorecard validates :question, presence: true validates :list_index, presence: true has_rich_text :answer end
github
freeats/freeats
https://github.com/freeats/freeats
app/models/candidate.rb
Ruby
mit
45
main
15,417
# frozen_string_literal: true class Candidate < ApplicationRecord include Dry::Monads[:result] include Locatable include Avatar acts_as_tenant(:tenant) has_many :placements, dependent: :destroy has_many :candidate_links, class_name: "CandidateLink", dependent: :destroy, in...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/member.rb
Ruby
mit
45
main
5,405
# frozen_string_literal: true class Member < ApplicationRecord acts_as_tenant(:tenant) has_and_belongs_to_many :reacted_notes, class_name: "Note", join_table: :note_reactions has_and_belongs_to_many :note_threads has_and_belongs_to_many :collaborator_positio...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/scorecard.rb
Ruby
mit
45
main
1,125
# frozen_string_literal: true class Scorecard < ApplicationRecord acts_as_tenant(:tenant) has_many :scorecard_questions, -> { order(:list_index) }, dependent: :destroy, inverse_of: :scorecard has_many :events, as: :eventable, dependent: :destroy has_one :added_event, ...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/position.rb
Ruby
mit
45
main
6,371
# frozen_string_literal: true class Position < ApplicationRecord include Locatable extend FriendlyId acts_as_tenant(:tenant) DEFAULT_STAGES = %w[Sourced Contacted Replied Hired].freeze LATEST_STAGE_NAME = "Hired" CHANGE_STATUS_REASON_LABELS = { other: "Other", filled: "We filled the position", ...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/position_stage.rb
Ruby
mit
45
main
2,336
# frozen_string_literal: true class PositionStage < ApplicationRecord acts_as_tenant(:tenant) has_many :scorecards, dependent: :destroy has_many :moved_to_events, lambda { where(type: :placement_changed, changed_field: :stage) }, class_name: "Event", inverse_of: :stage_to, ...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/account.rb
Ruby
mit
45
main
1,211
# frozen_string_literal: true class Account < ApplicationRecord include Rodauth::Model(RodauthMain) include Avatar acts_as_tenant(:tenant) has_one :member, dependent: :destroy enum :status, unverified: 1, verified: 2, closed: 3 validates :name, presence: true validates :email, presence: true befor...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/email_thread.rb
Ruby
mit
45
main
1,432
# frozen_string_literal: true class EmailThread < ApplicationRecord acts_as_tenant(:tenant) DATE_RANGE_TYPES = [Date, DateTime, ActiveSupport::TimeWithZone, NilClass].freeze has_many :messages, -> { order(timestamp: :desc) }, dependent: :destroy, inverse_of: :email_thread, ...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/task.rb
Ruby
mit
45
main
3,363
# frozen_string_literal: true class Task < ApplicationRecord acts_as_tenant(:tenant) has_and_belongs_to_many :watchers, class_name: "Member", join_table: :tasks_watchers, association_foreign_key: :watcher_id has_many :note_threads, as...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/note.rb
Ruby
mit
45
main
2,528
# frozen_string_literal: true class Note < ApplicationRecord acts_as_tenant(:tenant) has_and_belongs_to_many :reacted_members, class_name: "Member", join_table: :note_reactions has_many :events, as: :eventable, dependent: :destroy has_one :added_event, ...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/email_template.rb
Ruby
mit
45
main
612
# frozen_string_literal: true class EmailTemplate < ApplicationRecord acts_as_tenant(:tenant) has_rich_text :message strip_attributes only: :name, collapse_spaces: true validates :name, presence: true validates :message, presence: true validate :liquid_template_must_be_valid def liquid_template_must_...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/note_thread.rb
Ruby
mit
45
main
921
# frozen_string_literal: true class NoteThread < ApplicationRecord acts_as_tenant(:tenant) has_and_belongs_to_many :members has_many :notes, dependent: :destroy belongs_to :notable, polymorphic: true scope :visible_to, lambda { |member| left_outer_joins(:members) .where("members.id = ? AND hidd...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/candidate_email_address.rb
Ruby
mit
45
main
3,003
# frozen_string_literal: true class CandidateEmailAddress < ApplicationRecord include EmailRegexp acts_as_tenant(:tenant) self.inheritance_column = nil belongs_to :candidate belongs_to :created_by, class_name: "Member", optional: true enum :status, %i[ current invalid outdated ].index_wit...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/tenant.rb
Ruby
mit
45
main
2,673
# frozen_string_literal: true class Tenant < ApplicationRecord extend FriendlyId friendly_id :name, use: :slugged, routes: nil has_many :candidate_sources, dependent: :destroy has_many :disqualify_reasons, dependent: :destroy has_many :enabled_features, dependent: :destroy ...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/email_message_address.rb
Ruby
mit
45
main
572
# frozen_string_literal: true class EmailMessageAddress < ApplicationRecord include EmailRegexp acts_as_tenant(:tenant) belongs_to :email_message enum :field, %i[from to cc bcc].index_with(&:to_s), suffix: true validates :address, presence: true validates :address, format: { with: EMAIL_REGEXP } vali...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/scorecard_template.rb
Ruby
mit
45
main
444
# frozen_string_literal: true class ScorecardTemplate < ApplicationRecord acts_as_tenant(:tenant) has_many :events, as: :eventable, dependent: :destroy has_many :scorecard_template_questions, -> { order(:list_index) }, dependent: :destroy, inverse_of: :scorecard_template belon...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/enabled_feature.rb
Ruby
mit
45
main
237
# frozen_string_literal: true class EnabledFeature < ApplicationRecord belongs_to :tenant enum :name, %i[ emails ].index_with(&:to_s) validates :name, presence: true validates :name, uniqueness: { scope: :tenant_id } end
github
freeats/freeats
https://github.com/freeats/freeats
app/models/scorecard_template_question.rb
Ruby
mit
45
main
261
# frozen_string_literal: true class ScorecardTemplateQuestion < ApplicationRecord acts_as_tenant(:tenant) belongs_to :scorecard_template validates :question, presence: true validates :list_index, presence: true, numericality: { greater_than: 0 } end
github
freeats/freeats
https://github.com/freeats/freeats
app/models/candidate_link.rb
Ruby
mit
45
main
1,144
# frozen_string_literal: true class CandidateLink < ApplicationRecord acts_as_tenant(:tenant) belongs_to :candidate belongs_to :created_by, class_name: "Member", optional: true enum :status, %i[ current outdated ].index_with(&:to_s), prefix: true enum :created_via, %i[ api manual ].ind...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/location.rb
Ruby
mit
45
main
2,576
# frozen_string_literal: true class Location < ApplicationRecord self.inheritance_column = nil # self.ignored_columns += %w[ # geoname_feature_code # geoname_modification_date # geoname_admin1_code # geoname_admin2_code # geoname_admin3_code # geoname_admin4_code # ] has_many :hierarch...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/candidate_phone.rb
Ruby
mit
45
main
2,347
# frozen_string_literal: true class CandidatePhone < ApplicationRecord acts_as_tenant(:tenant) self.inheritance_column = nil # Numbers in E164 format. BLACKLISTED_PHONES = [ "+46706240058" ].freeze belongs_to :candidate belongs_to :created_by, class_name: "Member", optional: true enum :type, %i...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/concerns/email_regexp.rb
Ruby
mit
45
main
443
# frozen_string_literal: true module EmailRegexp extend ActiveSupport::Concern EMAIL_REGEXP = %r{\A(?:[\w!#$%&*+\-\/=?^'`{|}~]+\.?)+(?<!\.)@(?:[a-z\d-]+\.)+[a-z]+\z} # No working method found that transfertes EMAIL_REGEXP into a pattern # for html. In some browsers specifying `type: :email` solves some of ...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/concerns/locatable.rb
Ruby
mit
45
main
607
# frozen_string_literal: true module Locatable extend ActiveSupport::Concern IN_LOCATION_QUERY = <<~SQL EXISTS ( SELECT 1 FROM location_hierarchies WHERE path <@ ANY (SELECT path FROM location_hierarchies WHERE location_id IN (:location_ids)) AND location_id = %s.location_id LIMI...
github
freeats/freeats
https://github.com/freeats/freeats
app/models/concerns/merged_candidate_is_read_only_validator.rb
Ruby
mit
45
main
855
# frozen_string_literal: true class MergedCandidateIsReadOnlyValidator < ActiveModel::Validator def validate(record) if record.respond_to?(:taskable_id) return unless record.taskable_type == "Candidate" candidate = record.taskable elsif record.respond_to?(:notable_id) return unless record....
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/account_link.rb
Ruby
mit
45
main
13,510
# frozen_string_literal: true class AccountLink attr_reader :link, :uri def initialize(link) @link = link.is_a?(String) ? link&.strip : link @uri = Addressable::URI.parse(@link) @normalized_link = link.blank? ? link : normalize end def low_level_domain uri.hostname.split(".").first end d...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/recaptcha_v3.rb
Ruby
mit
45
main
235
# frozen_string_literal: true module RecaptchaV3 MIN_SCORE = 0.5 SITE_KEY = ENV.fetch("RECAPTCHA_V3_SITE_KEY", nil) SECRET_KEY = ENV.fetch("RECAPTCHA_V3_SECRET_KEY", nil) ENABLED = SITE_KEY.present? && SECRET_KEY.present? end
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/action_list.rb
Ruby
mit
45
main
5,163
# frozen_string_literal: true # # The ActionList is a mechanism for sequentially performing actions on models. # # How to use # # First, you need to initialize the instance of the `ActionList` object # and pass necessary parameters to the constructor. # # action_list = ActionList.new( # target_candidate_id:,...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/avatar.rb
Ruby
mit
45
main
317
# frozen_string_literal: true module Avatar extend ActiveSupport::Concern included do has_one_attached :avatar do |attachable| attachable.variant(:icon, resize_to_fill: [144, 144], preprocessed: true) attachable.variant(:medium, resize_to_fill: [450, 450], preprocessed: true) end end end
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/active_storage_attachment.rb
Ruby
mit
45
main
1,911
# frozen_string_literal: true module ActiveStorageAttachment extend ActiveSupport::Concern include Dry::Monads[:result] included do has_many :events, as: :eventable, dependent: :destroy has_one :attachment_information, foreign_key: :active_storage_attachment_id, dependent: :destr...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/active_storage_create_one.rb
Ruby
mit
45
main
1,950
# frozen_string_literal: true module ActiveStorageCreateOne # https://github.com/rails/rails/blob/main/activestorage/lib/active_storage/attached/changes/create_one.rb#L68 # Copied method to pass an additional argument to `build_after_unfurling` def find_or_build_blob case attachable when ActiveStorage::B...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/location_parser.rb
Ruby
mit
45
main
7,119
# frozen_string_literal: true # Current deficiencies: # - Region can be parsed as city: Stockholm County is parsed as Stockholm city. # - When only region is present - it fails to parse anything. # - "Washington, District of Columbia, United States" -> "Colombia" class LocationParser # Characters only in the role of...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/active_storage_blob.rb
Ruby
mit
45
main
510
# frozen_string_literal: true module ActiveStorageBlob def build_after_unfurling(*, **kwargs) attached_as = kwargs.delete(:attached_as) blob = super # The initial `blob.key` is a unique secure token # https://github.com/rails/rails/blob/main/activestorage/app/models/active_storage/blob.rb#L188 ...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/ats/logger.rb
Ruby
mit
45
main
3,697
# frozen_string_literal: true class ATS::Logger PRODUCTION_LOG_LEVEL = ::Logger::INFO class ExternalLogger attr_reader :logger attr_accessor :where def initialize(logger:, where:) @logger = logger @where = where end def log(...) if Rails.env.in?(Sentry.configuration.enabled...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/imap/account.rb
Ruby
mit
45
main
4,555
# frozen_string_literal: true require "mail" require "net/imap" class Imap::Account IMAP_ADDRESS = "imap.gmail.com" IMAP_PORT = 993 AUTHORIZATION_RETRY_DELAY = 1.second DEFAULT_BATCH_SIZE = 100 DEFAULT_SEARCH_CHARSET = "UTF-8" DEFAULT_MAILBOX = "[Gmail]/All Mail" DATE_FORMAT = "%d-%b-%Y" # https://ww...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/imap/message.rb
Ruby
mit
45
main
10,194
# frozen_string_literal: true module Imap Message = Data.define( :message_id, :imap_uid, :timestamp, :flags, # https://datatracker.ietf.org/doc/html/rfc9051#name-flags-message-attribute :to, :from, :cc, :bcc, :subject, :plain_body, :plain_mime_type, :html_body, :at...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/rails_admin/config/actions/delete_account.rb
Ruby
mit
45
main
882
# frozen_string_literal: true require "rails_admin/config/actions" require "rails_admin/config/actions/base" class RailsAdmin::Config::Actions::DeleteAccount < RailsAdmin::Config::Actions::Base register_instance_option :visible? do authorized? && bindings[:object].is_a?(Account) end register_instance_option...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/gmail/auth.rb
Ruby
mit
45
main
2,224
# frozen_string_literal: true require "multi_json" require "signet/oauth_2/client" module Gmail::Auth class ServerError < ::Gmail::Error; end class ClientError < ::Gmail::Error; end class AuthorizationError < ClientError; end CLIENT_ID = ENV.fetch("GMAIL_LINKING_CLIENT_ID", nil) CLIENT_SECRET = ENV.fetch("G...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/cv_parser/content.rb
Ruby
mit
45
main
2,454
# frozen_string_literal: true class CVParser::Content PHONE_REGEX = /[+]*(?:[-()\u00a0\d]\s{0,2}){5,}/ EMAIL_REGEX = /[^@\s\u00a0]+@[^@\s\u00a0]+/ URL_REGEX = %r{(?:https?://)?(?:\w+\.)+(?:[a-zA-Z]{2,4})(?:[/\w.?%=:-]*)/?} DEFAULT_COUNTRY_CODE = ENV.fetch("COUNTRY_CODE_FOR_PHONE_PARSING", nil) attr_reader :...
github
freeats/freeats
https://github.com/freeats/freeats
app/lib/cv_parser/parser.rb
Ruby
mit
45
main
2,278
# frozen_string_literal: true module CVParser class CVParserError < StandardError; end class UnsupportedFileType < CVParserError; end class Parser class << self def parse_pdf(file) reader = PDF::Reader.new(file) plain_text = reader.pages.reduce("") { |text, page| "#{text} #{page.text}"...
github
freeats/freeats
https://github.com/freeats/freeats
app/helpers/application_helper.rb
Ruby
mit
45
main
4,805
# frozen_string_literal: true module ApplicationHelper PRIORITY_COLORS = { "low" => "code-green", "medium" => "code-yellow", "high" => "code-red" }.freeze def options_for_priority(collection, selected_value = nil) options = collection.map do |_, value| { text: value.human...
github
freeats/freeats
https://github.com/freeats/freeats
app/helpers/scorecards_helper.rb
Ruby
mit
45
main
936
# frozen_string_literal: true module ScorecardsHelper SCORE_STYLES = { irrelevant: [:mood_sad, "text-red"], relevant: [:mood_empty, "text-red-300"], good: [:mood_smile, "text-green-300"], perfect: [:mood_happy, "text-green"] }.freeze def score_icon(score, with_text: false) icon, color = SCOR...
github
freeats/freeats
https://github.com/freeats/freeats
app/helpers/candidates_grid_helper.rb
Ruby
mit
45
main
1,406
# frozen_string_literal: true module CandidatesGridHelper def candidates_grid_render_position_stage(model) placements = candidates_grid_sort_placements(model.placements).map do |placement| safe_join( [ (if allowed_to?(:show?, placement.position, with: ATS::PositionPolicy) lin...
github
freeats/freeats
https://github.com/freeats/freeats
app/helpers/candidates_helper.rb
Ruby
mit
45
main
7,559
# frozen_string_literal: true module CandidatesHelper def ats_candidate_duplicates_merge_association_select(form, form_field_name, options_for_select) options = options_for_select.map do |text, value| { text:, value: } end render SingleSelectComponent.new( form, method: form_field_name,...