Compare commits
No commits in common. "c436389426aa9c68c8ee9fd613f7072dc2c73c36" and "cf6fc3b8f62bcb9f9b885ec3636b4d1842286901" have entirely different histories.
c436389426
...
cf6fc3b8f6
@ -71,10 +71,10 @@ app.MapGet("/Tranga/GetPublicationsFromConnector", (string connectorName, string
|
|||||||
app.MapGet("/Tasks/GetTaskTypes", () => Enum.GetNames(typeof(TrangaTask.Task)));
|
app.MapGet("/Tasks/GetTaskTypes", () => Enum.GetNames(typeof(TrangaTask.Task)));
|
||||||
|
|
||||||
|
|
||||||
app.MapPost("/Tasks/Create", (string taskType, string? connectorName, string? internalId, string reoccurrenceTime, string? language) =>
|
app.MapPost("/Tasks/Create", (string taskType, string? connectorName, string? publicationId, string reoccurrenceTime, string? language) =>
|
||||||
{
|
{
|
||||||
TrangaTask.Task task = Enum.Parse<TrangaTask.Task>(taskType);
|
TrangaTask.Task task = Enum.Parse<TrangaTask.Task>(taskType);
|
||||||
taskManager.AddTask(task, connectorName, internalId, TimeSpan.Parse(reoccurrenceTime), language??"");
|
taskManager.AddTask(task, connectorName, publicationId, TimeSpan.Parse(reoccurrenceTime), language??"");
|
||||||
});
|
});
|
||||||
|
|
||||||
app.MapDelete("/Tasks/Delete", (string taskType, string? connectorName, string? publicationId) =>
|
app.MapDelete("/Tasks/Delete", (string taskType, string? connectorName, string? publicationId) =>
|
||||||
|
@ -152,9 +152,9 @@ public class TaskManager
|
|||||||
case TrangaTask.Task.DownloadNewChapters:
|
case TrangaTask.Task.DownloadNewChapters:
|
||||||
IEnumerable<TrangaTask> matchingdnc =
|
IEnumerable<TrangaTask> matchingdnc =
|
||||||
_allTasks.Where(mTask => mTask.GetType() == typeof(DownloadNewChaptersTask));
|
_allTasks.Where(mTask => mTask.GetType() == typeof(DownloadNewChaptersTask));
|
||||||
if (!matchingdnc.Any(mTask =>
|
if (matchingdnc.All(mTask =>
|
||||||
((DownloadNewChaptersTask)mTask).publication.internalId == ((DownloadNewChaptersTask)newTask).publication.internalId &&
|
((DownloadNewChaptersTask)mTask).publication.internalId != ((DownloadNewChaptersTask)newTask).publication.publicationId &&
|
||||||
((DownloadNewChaptersTask)mTask).connectorName == ((DownloadNewChaptersTask)newTask).connectorName))
|
((DownloadNewChaptersTask)mTask).connectorName != ((DownloadNewChaptersTask)newTask).connectorName))
|
||||||
_allTasks.Add(newTask);
|
_allTasks.Add(newTask);
|
||||||
else
|
else
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Task already exists {newTask}");
|
logger?.WriteLine(this.GetType().ToString(), $"Task already exists {newTask}");
|
||||||
@ -180,7 +180,7 @@ public class TaskManager
|
|||||||
_allTasks.Remove(removeTask);
|
_allTasks.Remove(removeTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrangaTask? AddTask(TrangaTask.Task taskType, string? connectorName, string? internalId,
|
public TrangaTask? AddTask(TrangaTask.Task taskType, string? connectorName, string? publicationId,
|
||||||
TimeSpan reoccurrenceTime, string? language = "en")
|
TimeSpan reoccurrenceTime, string? language = "en")
|
||||||
{
|
{
|
||||||
TrangaTask? newTask = null;
|
TrangaTask? newTask = null;
|
||||||
@ -190,10 +190,10 @@ public class TaskManager
|
|||||||
newTask = new UpdateLibrariesTask(taskType, reoccurrenceTime);
|
newTask = new UpdateLibrariesTask(taskType, reoccurrenceTime);
|
||||||
break;
|
break;
|
||||||
case TrangaTask.Task.DownloadNewChapters:
|
case TrangaTask.Task.DownloadNewChapters:
|
||||||
if(connectorName is null || internalId is null || language is null)
|
if(connectorName is null || publicationId is null || language is null)
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Values connectorName, publicationName and language can not be null.");
|
logger?.WriteLine(this.GetType().ToString(), $"Values connectorName, publicationName and language can not be null.");
|
||||||
GetConnector(connectorName); //Check if connectorName is valid
|
GetConnector(connectorName); //Check if connectorName is valid
|
||||||
Publication publication = GetAllPublications().First(pub => pub.internalId == internalId);
|
Publication publication = GetAllPublications().First(pub => pub.internalId == publicationId);
|
||||||
newTask = new DownloadNewChaptersTask(taskType, connectorName!, publication, reoccurrenceTime, language!);
|
newTask = new DownloadNewChaptersTask(taskType, connectorName!, publication, reoccurrenceTime, language!);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,8 @@ async function GetKomgaTask(){
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateTask(taskType, reoccurrence, connectorName, internalId, language){
|
function CreateTask(taskType, reoccurrence, connectorName, publicationId, language){
|
||||||
var uri = apiUri + `/Tasks/Create?taskType=${taskType}&connectorName=${connectorName}&internalId=${internalId}&reoccurrenceTime=${reoccurrence}&language=${language}`;
|
var uri = apiUri + `/Tasks/Create?taskType=${taskType}&connectorName=${connectorName}&publicationId=${publicationId}&reoccurrenceTime=${reoccurrence}&language=${language}`;
|
||||||
PostData(uri);
|
PostData(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user