Add endpoint to get reviewer for an in-progress project

This commit is contained in:
Alex Cabal 2025-01-07 21:42:28 -06:00
parent 87620287f1
commit bc16b1fff8
5 changed files with 110 additions and 2 deletions

View file

@ -675,6 +675,17 @@ final class Project{
return Db::Query('SELECT * from Projects where ProjectId = ?', [$projectId], Project::class)[0] ?? throw new Exceptions\ProjectNotFoundException();
}
/**
* @throws Exceptions\ProjectNotFoundException If the `Project` can't be found.
*/
public static function GetByIdentifierAndIsInProgress(?string $identifier): Project{
if($identifier === null){
throw new Exceptions\ProjectNotFoundException();
}
return Db::Query('SELECT Projects.* from Ebooks inner join Projects using (EbookId) where Ebooks.Identifier = ? and Projects.Status = ?', [$identifier, Enums\ProjectStatusType::InProgress], Project::class)[0] ?? throw new Exceptions\ProjectNotFoundException();
}
/**
* @return array<Project>
*/