This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb5c6f6
commit c6ce1b3
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,13 +41,28 @@ export class TaskService { | |
|
||
const tasksWithLogs = Object.keys(this.availableTasks).map((t) => { | ||
return new this.availableTasks[t]( | ||
this.getLogForTask(logs, t)?.status || 'unknown', | ||
this.getLogForTask(logs, t)?.status || 'not started', | ||
); | ||
}); | ||
|
||
return tasksWithLogs; | ||
} | ||
|
||
public async getTask( | ||
user: string, | ||
taskId: string, | ||
): Promise<Task | undefined> { | ||
const task = this.availableTasks[taskId]; | ||
|
||
if (!task) { | ||
return undefined; | ||
} | ||
|
||
const log = await this.taskRepository.getTaskLog(user, taskId); | ||
|
||
return new task(log?.status ?? 'not started'); | ||
Check failure Code scanning / CodeQL Unvalidated dynamic method call High
Invocation of method with
user-controlled Error loading related location Loading Invocation of method with user-controlled name may dispatch to unexpected target and cause an exception. |
||
} | ||
|
||
public async startTask(user: string, task: string): Promise<TaskLog> { | ||
// Only one concurrent task should be allowed | ||
const startedTasks = await this.taskRepository.getStartedTasksForUser(user); | ||
|