feat: add priority field to conversation (#6921) (#6927)

* feat: add priority

* feat: add indexes
This commit is contained in:
Shivam Mishra
2023-04-19 13:23:14 +05:30
committed by GitHub
parent ea2c442328
commit 9c0259da6b
3 changed files with 15 additions and 1 deletions

View File

@@ -11,6 +11,7 @@
# first_reply_created_at :datetime
# identifier :string
# last_activity_at :datetime not null
# priority :integer
# snoozed_until :datetime
# status :integer default("open"), not null
# uuid :uuid not null
@@ -38,7 +39,9 @@
# index_conversations_on_id_and_account_id (account_id,id)
# index_conversations_on_inbox_id (inbox_id)
# index_conversations_on_last_activity_at (last_activity_at)
# index_conversations_on_priority (priority)
# index_conversations_on_status_and_account_id (status,account_id)
# index_conversations_on_status_and_priority (status,priority)
# index_conversations_on_team_id (team_id)
# index_conversations_on_uuid (uuid) UNIQUE
#
@@ -61,6 +64,7 @@ class Conversation < ApplicationRecord
validate :validate_referer_url
enum status: { open: 0, resolved: 1, pending: 2, snoozed: 3 }
enum priority: { low: 0, medium: 1, high: 2, urgent: 3 }
scope :unassigned, -> { where(assignee_id: nil) }
scope :assigned, -> { where.not(assignee_id: nil) }