Task me sync

This commit is contained in:
Senad Uka
2020-06-03 07:24:01 +02:00
parent e3d4d22a34
commit 88836e937e
76 changed files with 847 additions and 497 deletions

View File

@@ -54,7 +54,7 @@ class Account < ApplicationRecord
Download.where(project: projects),
User.joins(:project_memberships).where(project_memberships: { project: projects }),
Broadcast.where(project: projects),
ZoomMeeting.where(project: projects),
TaskRequest.where(project: projects),
self
])).sum(:byte_size).to_f
end
@@ -79,6 +79,10 @@ class Account < ApplicationRecord
plan_uid.to_s == "me_suite" || plan_uid.to_s == "releaseme"
end
def assistme_enabled?
plan_uid.to_s == "me_suite" || plan_uid.to_s == "assistme"
end
def plan_name
case plan_uid.to_s
when "deliverme"
@@ -87,6 +91,8 @@ class Account < ApplicationRecord
"DirectME"
when "releaseme"
"ReleaseME"
when "assistme"
"AssistME"
when "me_suite"
"ME Suite"
end

View File

@@ -7,6 +7,8 @@ class Broadcast < ApplicationRecord
has_secure_token
scope :order_by_recent, -> { order(created_at: :desc) }
validates :name, presence: true
enum status: [:created, :active, :idle]

View File

@@ -1,6 +1,8 @@
class BroadcastRecording < ApplicationRecord
belongs_to :broadcast
scope :order_by_recent, -> { order(created_at: :desc) }
delegate :name, to: :broadcast, prefix: :broadcast
validates :asset_uid, uniqueness: true

View File

@@ -1,9 +0,0 @@
# frozen_string_literal: true
module Attachable
extend ActiveSupport::Concern
included do
has_many_attached :attachments
end
end

View File

@@ -6,6 +6,8 @@ module Releasable
included do
belongs_to :project, touch: true
belongs_to :contract_template, optional: true
scope :order_by_recent, -> { order(created_at: :desc) }
end
def release_number

View File

@@ -5,7 +5,7 @@ class HeadshotCollection
def self.for_project(project)
appearance_releases_with_photo = project.appearance_releases.with_person_photo
new(project.headshot_collection_uid, appearance_releases_with_photo + project.talent_releases)
new(project.id, appearance_releases_with_photo + project.talent_releases)
end
def initialize(collection_uid, releasables)
@@ -23,7 +23,7 @@ class HeadshotCollection
collection_uid: collection_uid.to_s,
bucket_name: aws_bucket_name,
ids_to_images: map_ids_to_images,
}.reject { |_, v| v.blank? }
}
end
private

View File

@@ -1,7 +0,0 @@
# frozen_string_literal: true
class MatchingRequest < ApplicationRecord
include Attachable
belongs_to :project
end

View File

@@ -4,4 +4,6 @@ class Note < ApplicationRecord
belongs_to :notable, polymorphic: true
validates :content, presence: true
scope :order_by_recent, -> { order(created_at: :desc) }
end

View File

@@ -22,6 +22,7 @@ class Project < ApplicationRecord
has_many :downloads, dependent: :destroy
has_many :broadcasts, dependent: :destroy
has_many :zoom_meetings, dependent: :destroy
has_many :task_requests, dependent: :destroy
accepts_nested_attributes_for :project_memberships

View File

@@ -0,0 +1,8 @@
class TaskRequest < ApplicationRecord
belongs_to :project
has_many_attached :files
enum status: [:pending, :completed, :cancelled]
scope :order_by_recent, -> { order(created_at: :desc) }
end

View File

@@ -4,9 +4,6 @@ class ZoomMeeting < ApplicationRecord
belongs_to :project, optional: true
belongs_to :zoom_user
has_one_attached :recording
validates :recording, content_type: ['video/mp4']
enum status: [:created, :started, :ended]
after_create :create_api_meeting, if: -> { api_meeting_id.nil? }

View File

@@ -1,4 +1,3 @@
require 'zoom_gateway'
class ZoomUser < ApplicationRecord
has_many :zoom_meetings, dependent: :nullify