新增: 评论相关api根据需求重写

This commit is contained in:
2022-07-27 14:52:49 +08:00
parent a35db9fe80
commit d6b5dc326a
18 changed files with 432 additions and 17 deletions

View File

@@ -13,6 +13,15 @@
# comments_count :integer default("0")
# reply_id :integer
# review_id :integer
# commit_id :string(255)
# diff :text(4294967295)
# line_code :string(255)
# path :string(255)
# state :integer default("0")
# resolve_at :datetime
# resolveer_id :integer
# need_respond :boolean default("0")
# updated_on :datetime
#
# Indexes
#
@@ -24,9 +33,12 @@
#
class Journal < ApplicationRecord
serialize :diff, JSON
belongs_to :user
belongs_to :issue, foreign_key: :journalized_id, :touch => true, optional: true
belongs_to :journalized, polymorphic: true
belongs_to :review, optional: true
belongs_to :resolveer, class_name: 'User', foreign_key: :resolveer_id, optional: true
has_many :journal_details, :dependent => :delete_all
has_many :attachments, as: :container, dependent: :destroy
@@ -34,6 +46,7 @@ class Journal < ApplicationRecord
scope :parent_journals, ->{where(parent_id: nil)}
scope :children_journals, lambda{|journal_id| where(parent_id: journal_id)}
enum state: {opened: 0, resolved: 1, disabled: 2}
def is_journal_detail?
self.notes.blank? && self.journal_details.present?