first stab at log query

This commit is contained in:
carlad 2016-07-29 17:02:07 +02:00
parent 14866201ff
commit 8e71c4501d

View File

@ -1,9 +1,18 @@
module Travis::API::V3
class Queries::Log < Query
def find(job)
#TODO check for the log in the DB, and then fetch it from S3 if not.
job.log
#TODO check for the log in the DB, if it's not there then fetch it from S3.
log = Models::Log.find_by_job_id
#if the log exists and has not bee archived yet, then collect the log_parts and return the contents
unless log.nil? || !log.archived_at.nil?
log_parts = Models::Log::Part.where(log_id: log.id)
contents = log_parts.each do |log_part|
log_part.content
end
contents
else
#go look in S3
end
end
end
end