Decouple Queue and related classes from MangaDex

This commit is contained in:
Alex Ling
2020-07-21 11:47:14 +00:00
parent 5cee68d76c
commit ae7c72ab85
6 changed files with 308 additions and 277 deletions

View File

@@ -136,12 +136,12 @@ class APIRouter < Router
begin
chapters = env.params.json["chapters"].as(Array).map { |c| c.as_h }
jobs = chapters.map { |chapter|
MangaDex::Job.new(
Queue::Job.new(
chapter["id"].as_s,
chapter["manga_id"].as_s,
chapter["full_title"].as_s,
chapter["manga_title"].as_s,
MangaDex::JobStatus::Pending,
Queue::JobStatus::Pending,
Time.unix chapter["time"].as_s.to_i
)
}
@@ -179,7 +179,7 @@ class APIRouter < Router
case action
when "delete"
if id.nil?
@context.queue.delete_status MangaDex::JobStatus::Completed
@context.queue.delete_status Queue::JobStatus::Completed
else
@context.queue.delete id
end