refactor: UI 화면 통합 및 불필요한 파일 정리
- 모든 *_redesign.dart 파일을 기본 화면 파일로 통합 - 백업용 컨트롤러 파일들 제거 (*_controller.backup.dart) - 사용하지 않는 예제 및 테스트 파일 제거 - Clean Architecture 적용 후 남은 정리 작업 완료 - 테스트 코드 정리 및 구조 개선 준비 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,7 @@ import 'package:superport/data/models/equipment/equipment_request.dart';
|
||||
import 'package:superport/data/models/equipment/equipment_response.dart';
|
||||
|
||||
abstract class EquipmentRemoteDataSource {
|
||||
Future<List<EquipmentListDto>> getEquipments({
|
||||
Future<EquipmentListResponseDto> getEquipments({
|
||||
int page = 1,
|
||||
int perPage = 20,
|
||||
String? status,
|
||||
@@ -44,7 +44,7 @@ class EquipmentRemoteDataSourceImpl implements EquipmentRemoteDataSource {
|
||||
final ApiClient _apiClient = GetIt.instance<ApiClient>();
|
||||
|
||||
@override
|
||||
Future<List<EquipmentListDto>> getEquipments({
|
||||
Future<EquipmentListResponseDto> getEquipments({
|
||||
int page = 1,
|
||||
int perPage = 20,
|
||||
String? status,
|
||||
@@ -68,8 +68,19 @@ class EquipmentRemoteDataSourceImpl implements EquipmentRemoteDataSource {
|
||||
);
|
||||
|
||||
if (response.data['success'] == true && response.data['data'] != null) {
|
||||
final List<dynamic> data = response.data['data'];
|
||||
return data.map((json) => EquipmentListDto.fromJson(json)).toList();
|
||||
// API 응답 구조를 DTO에 맞게 변환 (warehouse_remote_datasource 패턴 참조)
|
||||
final List<dynamic> dataList = response.data['data'];
|
||||
final pagination = response.data['pagination'] ?? {};
|
||||
|
||||
final listData = {
|
||||
'items': dataList,
|
||||
'total': pagination['total'] ?? 0,
|
||||
'page': pagination['page'] ?? 1,
|
||||
'per_page': pagination['per_page'] ?? 20,
|
||||
'total_pages': pagination['total_pages'] ?? 1,
|
||||
};
|
||||
|
||||
return EquipmentListResponseDto.fromJson(listData);
|
||||
} else {
|
||||
throw ServerException(
|
||||
message: response.data['message'] ?? 'Failed to fetch equipment list',
|
||||
|
||||
@@ -24,4 +24,19 @@ class EquipmentListDto with _$EquipmentListDto {
|
||||
|
||||
factory EquipmentListDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentListDtoFromJson(json);
|
||||
}
|
||||
|
||||
/// 장비 목록 응답 DTO
|
||||
@freezed
|
||||
class EquipmentListResponseDto with _$EquipmentListResponseDto {
|
||||
const factory EquipmentListResponseDto({
|
||||
required List<EquipmentListDto> items,
|
||||
required int total,
|
||||
required int page,
|
||||
@JsonKey(name: 'per_page') required int perPage,
|
||||
@JsonKey(name: 'total_pages') required int totalPages,
|
||||
}) = _EquipmentListResponseDto;
|
||||
|
||||
factory EquipmentListResponseDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$EquipmentListResponseDtoFromJson(json);
|
||||
}
|
||||
@@ -465,3 +465,263 @@ abstract class _EquipmentListDto implements EquipmentListDto {
|
||||
_$$EquipmentListDtoImplCopyWith<_$EquipmentListDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
EquipmentListResponseDto _$EquipmentListResponseDtoFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _EquipmentListResponseDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$EquipmentListResponseDto {
|
||||
List<EquipmentListDto> get items => throw _privateConstructorUsedError;
|
||||
int get total => throw _privateConstructorUsedError;
|
||||
int get page => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'per_page')
|
||||
int get perPage => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'total_pages')
|
||||
int get totalPages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this EquipmentListResponseDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of EquipmentListResponseDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$EquipmentListResponseDtoCopyWith<EquipmentListResponseDto> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $EquipmentListResponseDtoCopyWith<$Res> {
|
||||
factory $EquipmentListResponseDtoCopyWith(EquipmentListResponseDto value,
|
||||
$Res Function(EquipmentListResponseDto) then) =
|
||||
_$EquipmentListResponseDtoCopyWithImpl<$Res, EquipmentListResponseDto>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{List<EquipmentListDto> items,
|
||||
int total,
|
||||
int page,
|
||||
@JsonKey(name: 'per_page') int perPage,
|
||||
@JsonKey(name: 'total_pages') int totalPages});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$EquipmentListResponseDtoCopyWithImpl<$Res,
|
||||
$Val extends EquipmentListResponseDto>
|
||||
implements $EquipmentListResponseDtoCopyWith<$Res> {
|
||||
_$EquipmentListResponseDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of EquipmentListResponseDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? items = null,
|
||||
Object? total = null,
|
||||
Object? page = null,
|
||||
Object? perPage = null,
|
||||
Object? totalPages = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
items: null == items
|
||||
? _value.items
|
||||
: items // ignore: cast_nullable_to_non_nullable
|
||||
as List<EquipmentListDto>,
|
||||
total: null == total
|
||||
? _value.total
|
||||
: total // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
page: null == page
|
||||
? _value.page
|
||||
: page // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
perPage: null == perPage
|
||||
? _value.perPage
|
||||
: perPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalPages: null == totalPages
|
||||
? _value.totalPages
|
||||
: totalPages // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$EquipmentListResponseDtoImplCopyWith<$Res>
|
||||
implements $EquipmentListResponseDtoCopyWith<$Res> {
|
||||
factory _$$EquipmentListResponseDtoImplCopyWith(
|
||||
_$EquipmentListResponseDtoImpl value,
|
||||
$Res Function(_$EquipmentListResponseDtoImpl) then) =
|
||||
__$$EquipmentListResponseDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{List<EquipmentListDto> items,
|
||||
int total,
|
||||
int page,
|
||||
@JsonKey(name: 'per_page') int perPage,
|
||||
@JsonKey(name: 'total_pages') int totalPages});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$EquipmentListResponseDtoImplCopyWithImpl<$Res>
|
||||
extends _$EquipmentListResponseDtoCopyWithImpl<$Res,
|
||||
_$EquipmentListResponseDtoImpl>
|
||||
implements _$$EquipmentListResponseDtoImplCopyWith<$Res> {
|
||||
__$$EquipmentListResponseDtoImplCopyWithImpl(
|
||||
_$EquipmentListResponseDtoImpl _value,
|
||||
$Res Function(_$EquipmentListResponseDtoImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of EquipmentListResponseDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? items = null,
|
||||
Object? total = null,
|
||||
Object? page = null,
|
||||
Object? perPage = null,
|
||||
Object? totalPages = null,
|
||||
}) {
|
||||
return _then(_$EquipmentListResponseDtoImpl(
|
||||
items: null == items
|
||||
? _value._items
|
||||
: items // ignore: cast_nullable_to_non_nullable
|
||||
as List<EquipmentListDto>,
|
||||
total: null == total
|
||||
? _value.total
|
||||
: total // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
page: null == page
|
||||
? _value.page
|
||||
: page // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
perPage: null == perPage
|
||||
? _value.perPage
|
||||
: perPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
totalPages: null == totalPages
|
||||
? _value.totalPages
|
||||
: totalPages // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$EquipmentListResponseDtoImpl implements _EquipmentListResponseDto {
|
||||
const _$EquipmentListResponseDtoImpl(
|
||||
{required final List<EquipmentListDto> items,
|
||||
required this.total,
|
||||
required this.page,
|
||||
@JsonKey(name: 'per_page') required this.perPage,
|
||||
@JsonKey(name: 'total_pages') required this.totalPages})
|
||||
: _items = items;
|
||||
|
||||
factory _$EquipmentListResponseDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$EquipmentListResponseDtoImplFromJson(json);
|
||||
|
||||
final List<EquipmentListDto> _items;
|
||||
@override
|
||||
List<EquipmentListDto> get items {
|
||||
if (_items is EqualUnmodifiableListView) return _items;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_items);
|
||||
}
|
||||
|
||||
@override
|
||||
final int total;
|
||||
@override
|
||||
final int page;
|
||||
@override
|
||||
@JsonKey(name: 'per_page')
|
||||
final int perPage;
|
||||
@override
|
||||
@JsonKey(name: 'total_pages')
|
||||
final int totalPages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EquipmentListResponseDto(items: $items, total: $total, page: $page, perPage: $perPage, totalPages: $totalPages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$EquipmentListResponseDtoImpl &&
|
||||
const DeepCollectionEquality().equals(other._items, _items) &&
|
||||
(identical(other.total, total) || other.total == total) &&
|
||||
(identical(other.page, page) || other.page == page) &&
|
||||
(identical(other.perPage, perPage) || other.perPage == perPage) &&
|
||||
(identical(other.totalPages, totalPages) ||
|
||||
other.totalPages == totalPages));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
const DeepCollectionEquality().hash(_items),
|
||||
total,
|
||||
page,
|
||||
perPage,
|
||||
totalPages);
|
||||
|
||||
/// Create a copy of EquipmentListResponseDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$EquipmentListResponseDtoImplCopyWith<_$EquipmentListResponseDtoImpl>
|
||||
get copyWith => __$$EquipmentListResponseDtoImplCopyWithImpl<
|
||||
_$EquipmentListResponseDtoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$EquipmentListResponseDtoImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _EquipmentListResponseDto implements EquipmentListResponseDto {
|
||||
const factory _EquipmentListResponseDto(
|
||||
{required final List<EquipmentListDto> items,
|
||||
required final int total,
|
||||
required final int page,
|
||||
@JsonKey(name: 'per_page') required final int perPage,
|
||||
@JsonKey(name: 'total_pages') required final int totalPages}) =
|
||||
_$EquipmentListResponseDtoImpl;
|
||||
|
||||
factory _EquipmentListResponseDto.fromJson(Map<String, dynamic> json) =
|
||||
_$EquipmentListResponseDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
List<EquipmentListDto> get items;
|
||||
@override
|
||||
int get total;
|
||||
@override
|
||||
int get page;
|
||||
@override
|
||||
@JsonKey(name: 'per_page')
|
||||
int get perPage;
|
||||
@override
|
||||
@JsonKey(name: 'total_pages')
|
||||
int get totalPages;
|
||||
|
||||
/// Create a copy of EquipmentListResponseDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$EquipmentListResponseDtoImplCopyWith<_$EquipmentListResponseDtoImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -41,3 +41,25 @@ Map<String, dynamic> _$$EquipmentListDtoImplToJson(
|
||||
'branch_name': instance.branchName,
|
||||
'warehouse_name': instance.warehouseName,
|
||||
};
|
||||
|
||||
_$EquipmentListResponseDtoImpl _$$EquipmentListResponseDtoImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$EquipmentListResponseDtoImpl(
|
||||
items: (json['items'] as List<dynamic>)
|
||||
.map((e) => EquipmentListDto.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
total: (json['total'] as num).toInt(),
|
||||
page: (json['page'] as num).toInt(),
|
||||
perPage: (json['per_page'] as num).toInt(),
|
||||
totalPages: (json['total_pages'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$EquipmentListResponseDtoImplToJson(
|
||||
_$EquipmentListResponseDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'items': instance.items,
|
||||
'total': instance.total,
|
||||
'page': instance.page,
|
||||
'per_page': instance.perPage,
|
||||
'total_pages': instance.totalPages,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user