# typed: strict
class Domain::UserPostCreation < ReduxApplicationRecord
  include AttrJsonRecordAliases
  include BelongsToWithCounterCache

  self.table_name = "domain_user_post_creations"
  self.primary_key = %i[user_id post_id]

  validates :user_id, uniqueness: { scope: :post_id }

  belongs_to :post,
             class_name: "::Domain::Post",
             inverse_of: :user_post_creations

  belongs_to_with_counter_cache :user,
                                class_name: "::Domain::User",
                                inverse_of: :user_post_creations
end
