TDD 작성
This commit is contained in:
@@ -474,32 +474,47 @@ class EventService with ChangeNotifier {
|
||||
// 팀 관리 기능
|
||||
// 이벤트 팀 목록 가져오기
|
||||
Future<List<Team>> fetchEventTeams(String eventId) async {
|
||||
if (_token == null || _clubId == null) {
|
||||
throw Exception('인증 또는 클럽 정보가 필요합니다');
|
||||
if (_token == null) {
|
||||
throw Exception('인증 정보가 필요합니다');
|
||||
}
|
||||
|
||||
_isLoading = true;
|
||||
notifyListeners();
|
||||
|
||||
try {
|
||||
final data = await _apiService.post(
|
||||
'${ApiConfig.clubs}/events/teams',
|
||||
'${ApiConfig.events}/teams',
|
||||
data: {'eventId': eventId},
|
||||
);
|
||||
|
||||
final List<dynamic> teamsData = data['teams'] ?? [];
|
||||
_teams = teamsData.map((teamData) => Team.fromJson(teamData)).toList();
|
||||
_teams = teamsData
|
||||
.map((teamData) => Team.fromJson(teamData))
|
||||
.toList();
|
||||
|
||||
_isLoading = false;
|
||||
notifyListeners();
|
||||
|
||||
return _teams;
|
||||
} catch (e) {
|
||||
_isLoading = false;
|
||||
notifyListeners();
|
||||
throw Exception('팀 목록을 불러오는데 실패했습니다: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 이벤트에 팀이 있는지 확인 (간략 조회)
|
||||
Future<bool> hasEventTeams(String eventId) async {
|
||||
if (_token == null) {
|
||||
throw Exception('인증 정보가 필요합니다');
|
||||
}
|
||||
|
||||
try {
|
||||
final data = await _apiService.post(
|
||||
'${ApiConfig.events}/teams',
|
||||
data: {'eventId': eventId},
|
||||
);
|
||||
|
||||
final List<dynamic> teamsData = data['teams'] ?? [];
|
||||
return teamsData.isNotEmpty;
|
||||
} catch (e) {
|
||||
print('팀 확인 실패: $e');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 팀 생성
|
||||
Future<List<Team>> generateTeams(
|
||||
|
||||
Reference in New Issue
Block a user