src/api/app/models/event/commit.rb
module Event
class Commit < Base
self.message_bus_routing_key = 'package.commit'
self.description = 'New revision of a package was commited'
payload_keys :project, :package, :sender, :comment, :user, :files, :rev, :requestid
create_jobs :update_backend_infos_job
after_create :increase_commits
def subject
"#{payload['project']}/#{payload['package']} r#{payload['rev']} commited"
end
def set_payload(attribs, keys)
attribs['comment'] = attribs['comment'][0..800] if attribs['comment'].present?
attribs['files'] = attribs['files'][0..800] if attribs['files'].present?
super(attribs, keys)
end
private
def increase_commits
CommitActivity.create_from_event_payload(payload)
end
end
end
# == Schema Information
#
# Table name: events
#
# id :bigint not null, primary key
# eventtype :string(255) not null, indexed
# mails_sent :boolean default(FALSE), indexed
# payload :text(16777215)
# undone_jobs :integer default(0)
# created_at :datetime indexed
# updated_at :datetime
#
# Indexes
#
# index_events_on_created_at (created_at)
# index_events_on_eventtype (eventtype)
# index_events_on_mails_sent (mails_sent)
#