闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
949 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: imports
  5. #
  6. # id :integer not null, primary key
  7. # type :integer not null
  8. # approved :boolean default(FALSE), not null
  9. # created_at :datetime not null
  10. # updated_at :datetime not null
  11. # data_file_name :string
  12. # data_content_type :string
  13. # data_file_size :integer
  14. # data_updated_at :datetime
  15. # account_id :integer not null
  16. #
  17. class Import < ApplicationRecord
  18. FILE_TYPES = ['text/plain', 'text/csv'].freeze
  19. self.inheritance_column = false
  20. belongs_to :account
  21. enum type: [:following, :blocking, :muting]
  22. validates :type, presence: true
  23. has_attached_file :data, url: '/system/:hash.:extension', hash_secret: ENV['PAPERCLIP_SECRET']
  24. validates_attachment_content_type :data, content_type: FILE_TYPES
  25. validates_attachment_presence :data
  26. end