번호 자동 부여 대응 및 API 공통 처리 보강

This commit is contained in:
JiWoong Sul
2025-10-23 14:02:31 +09:00
parent 09c31b2503
commit 7e933a2dda
55 changed files with 948 additions and 586 deletions

View File

@@ -49,8 +49,7 @@ class ProductRepositoryRemote implements ProductRepository {
data: productInputToJson(input),
options: Options(responseType: ResponseType.json),
);
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
return ProductDto.fromJson(data).toEntity();
return ProductDto.fromJson(_api.unwrapAsMap(response)).toEntity();
}
/// 제품 정보를 수정한다.
@@ -62,8 +61,7 @@ class ProductRepositoryRemote implements ProductRepository {
data: payload,
options: Options(responseType: ResponseType.json),
);
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
return ProductDto.fromJson(data).toEntity();
return ProductDto.fromJson(_api.unwrapAsMap(response)).toEntity();
}
/// 제품을 삭제한다.
@@ -79,7 +77,6 @@ class ProductRepositoryRemote implements ProductRepository {
'$_basePath/$id/restore',
options: Options(responseType: ResponseType.json),
);
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
return ProductDto.fromJson(data).toEntity();
return ProductDto.fromJson(_api.unwrapAsMap(response)).toEntity();
}
}

View File

@@ -156,7 +156,7 @@ class _ProductEnabledPageState extends State<_ProductEnabledPage> {
final currentPage = result?.page ?? 1;
final totalPages = result == null || result.pageSize == 0
? 1
: (result.total / result.pageSize).ceil().clamp(1, 9999) as int;
: (result.total / result.pageSize).ceil().clamp(1, 9999);
final hasNext = result == null
? false
: (result.page * result.pageSize) < result.total;