exec method
セルフチェックの回答を登録する。
セルフチェックの回答を登録し、リハビリテーションの継続を判断します。
Parameters:
rehabilitationId: リハビリテーションのIDversion: 問診データのバージョンanswers: ユーザーの回答リスト
Return: Future<bool> が返されます。このFutureは、リハビリテーションを続けるべきかを示すブール値を持ちます。
使用するリポジトリ:
- RehabilitationRepository : リハビリテーションのデータ操作を管理するリポジトリ 使用するAPI:
RehabilitationApi.registerSelfcheckAnswer: セルフチェックの回答を登録するAPI
Implementation
Future<bool> exec({
required String rehabilitationId,
required int version,
required List<String> answers,
}) async {
try {
/// リハビリを続けるかどうかを返す
final shouldContinueRehabilitation =
await _rehabilitationRepository.registerSelfcheckAnswer(
rehabilitationId: rehabilitationId,
version: version,
formType: FormType.preRehabilitation,
answers: answers,
);
return shouldContinueRehabilitation;
} on RepositoryException catch (error, stackTrace) {
throw _errorHandler.handleRepositoryError(error, stackTrace);
} catch (error, stackTrace) {
throw _errorHandler.handleUnknownError(error, stackTrace);
}
}