<commit_before>ProjectMediaType = GraphqlCrudOperations.define_default_type do
  name 'ProjectMedia'
  description 'ProjectMedia type'

  interfaces [NodeIdentification.interface]

  field :id, field: GraphQL::Relay::GlobalIdField.new('ProjectMedia')
  field :updated_at, types.String
  field :created_at, types.String
  field :media_id, types.Int
  field :project_id, types.Int
  field :user_id, types.Int
  field :dbid, types.Int
  field :permissions, types.String

  field :url do
    type types.String

    resolve -> (project_media, _args, _ctx) {
      project_media.media.url
    }
  end

  field :quote do
    type types.String

    resolve -> (project_media, _args, _ctx) {
      project_media.media.quote
    }
  end

  field :domain do
    type types.String

    resolve -> (project_media, _args, _ctx) {
      project_media.media.domain
    }
  end

  field :pusher_channel do
    type types.String

    resolve -> (project_media, _args, _ctx) {
      project_media.media.pusher_channel
    }
  end

  field :account do
    type -> { AccountType }

    resolve -> (project_media, _args, _ctx) {
      project_media.media.account
    }
  end

  field :project do
    type -> { ProjectType }

    resolve -> (project_media, _args, _ctx) {
      project_media.project
    }
  end

  connection :projects, -> { ProjectType.connection_type } do
    resolve -> (project_media, _args, _ctx) {
      project_media.media.projects
    }
  end

  field :media do
    type -> { MediaType }

    resolve -> (project_media, _args, _ctx) {
      project_media.media
    }
  end

  field :user do
    type -> { UserType }

    resolve -> (project_media, _args, _ctx) {
      project_media.user
    }
  end

  field :team do
    type -> { TeamType }

    resolve ->(project_media, _args, _ctx) {
      project_media.project.team
    }
  end

  connection :annotations, -> { AnnotationType.connection_type } do
    resolve ->(project_media, _args, _ctx) {
      project_media.get_annotations(annotation_types)
    }
  end

  field :annotations_count do
    type types.Int

    resolve ->(project_media, _args, _ctx) {
      project_media.get_annotations(annotation_types).size
    }
  end

  connection :tags, -> { TagType.connection_type } do
    resolve ->(project_media, _args, _ctx) {
      project_media.get_annotations('tag')
    }
  end

  field :embed do
    type types.String

    resolve ->(project_media, _args, _ctx) {
      project_media.embed.to_json
    }
  end

  field :last_status do
    type types.String

    resolve ->(project_media, _args, _ctx) {
      project_media.last_status
    }
  end

  field :published do
    type types.String

    resolve ->(project_media, _args, _ctx) {
      project_media.created_at.to_i.to_s
    }
  end

  instance_exec :media, &GraphqlCrudOperations.field_verification_statuses

# End of fields
end

def annotation_types
  ['comment', 'status', 'tag', 'flag']
end

<commit_msg>Ticket #5222 - fix tests<commit_after>ProjectMediaType = GraphqlCrudOperations.define_default_type do
  name 'ProjectMedia'
  description 'ProjectMedia type'

  interfaces [NodeIdentification.interface]

  field :id, field: GraphQL::Relay::GlobalIdField.new('ProjectMedia')
  field :updated_at, types.String
  field :created_at, types.String
  field :media_id, types.Int
  field :project_id, types.Int
  field :user_id, types.Int
  field :dbid, types.Int

  field :url do
    type types.String

    resolve -> (project_media, _args, _ctx) {
      project_media.media.url
    }
  end

  field :quote do
    type types.String

    resolve -> (project_media, _args, _ctx) {
      project_media.media.quote
    }
  end

  field :domain do
    type types.String

    resolve -> (project_media, _args, _ctx) {
      project_media.media.domain
    }
  end

  field :pusher_channel do
    type types.String

    resolve -> (project_media, _args, _ctx) {
      project_media.media.pusher_channel
    }
  end

  field :account do
    type -> { AccountType }

    resolve -> (project_media, _args, _ctx) {
      project_media.media.account
    }
  end

  field :project do
    type -> { ProjectType }

    resolve -> (project_media, _args, _ctx) {
      project_media.project
    }
  end

  connection :projects, -> { ProjectType.connection_type } do
    resolve -> (project_media, _args, _ctx) {
      project_media.media.projects
    }
  end

  field :media do
    type -> { MediaType }

    resolve -> (project_media, _args, _ctx) {
      project_media.media
    }
  end

  field :user do
    type -> { UserType }

    resolve -> (project_media, _args, _ctx) {
      project_media.user
    }
  end

  field :team do
    type -> { TeamType }

    resolve ->(project_media, _args, _ctx) {
      project_media.project.team
    }
  end

  connection :annotations, -> { AnnotationType.connection_type } do
    resolve ->(project_media, _args, _ctx) {
      project_media.get_annotations(annotation_types)
    }
  end

  field :annotations_count do
    type types.Int

    resolve ->(project_media, _args, _ctx) {
      project_media.get_annotations(annotation_types).size
    }
  end

  connection :tags, -> { TagType.connection_type } do
    resolve ->(project_media, _args, _ctx) {
      project_media.get_annotations('tag')
    }
  end

  field :embed do
    type types.String

    resolve ->(project_media, _args, _ctx) {
      project_media.embed.to_json
    }
  end

  field :last_status do
    type types.String

    resolve ->(project_media, _args, _ctx) {
      project_media.last_status
    }
  end

  field :published do
    type types.String

    resolve ->(project_media, _args, _ctx) {
      project_media.created_at.to_i.to_s
    }
  end

  instance_exec :media, &GraphqlCrudOperations.field_verification_statuses

# End of fields
end

def annotation_types
  ['comment', 'status', 'tag', 'flag']
end


{'fraction_non_alphanumeric': 0.09862778730703259, 'fraction_numerical': 0.0006861063464837049, 'mean_word_length': 2.8211009174311927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '655051', 'n_tokens_mistral': 1948, 'n_tokens_neox': 1886, 'n_words': 444}