addFile :: (TS m, MonadError JobError m) => Job.Name -> Job.FileId -> UUID -> m ()
addFile jn fn uuid = do
    js <- existing id jn
    mapM_ (const . throwError $ FileAlreadyExists jn fn) =<< ES.fileUUID jn fn
    when (Job.anyAvailability js /= MayBecomeAvailable) . throwError $ UploadClosed jn
    ES.insertFile jn fn uuid
addFile :: (TS m, MonadError JobError m) => Job.Name -> Job.FileId -> UUID -> m ()
addFile jn fn uuid = do
    js <- existing id jn
    mapM_ (const . throwError $ FileAlreadyExists jn fn) =<< ES.fileUUID jn fn
    when (Job.anyAvailability js /= MayBecomeAvailable) . throwError $ UploadClosed jn
    ES.insertFile jn fn uuid
addFile jn fn uuid = do
    js <- existing id jn
    mapM_ (const . throwError $ FileAlreadyExists jn fn) =<< ES.fileUUID jn fn
    when (Job.anyAvailability js /= MayBecomeAvailable) . throwError $ UploadClosed jn
    ES.insertFile jn fn uuid