feat(app): stabilize recommendation flow
This commit is contained in:
@@ -140,6 +140,7 @@ class RecommendationNotifier extends StateNotifier<AsyncValue<Restaurant?>> {
|
||||
Future<RecommendationRecord> saveRecommendationRecord(
|
||||
Restaurant restaurant, {
|
||||
DateTime? recommendationTime,
|
||||
bool visited = false,
|
||||
}) async {
|
||||
final now = DateTime.now();
|
||||
|
||||
@@ -147,7 +148,7 @@ class RecommendationNotifier extends StateNotifier<AsyncValue<Restaurant?>> {
|
||||
id: const Uuid().v4(),
|
||||
restaurantId: restaurant.id,
|
||||
recommendationDate: recommendationTime ?? now,
|
||||
visited: false,
|
||||
visited: visited,
|
||||
createdAt: now,
|
||||
);
|
||||
|
||||
@@ -172,7 +173,11 @@ class RecommendationNotifier extends StateNotifier<AsyncValue<Restaurant?>> {
|
||||
await visitNotifier.createVisitFromRecommendation(
|
||||
restaurantId: recommendation.restaurantId,
|
||||
recommendationTime: recommendation.recommendationDate,
|
||||
isConfirmed: true,
|
||||
);
|
||||
|
||||
// 방문 기록을 만들었으므로 추천 기록은 숨김 처리
|
||||
await _repository.deleteRecommendationRecord(recommendationId);
|
||||
} catch (e, stack) {
|
||||
state = AsyncValue.error(e, stack);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user