번호 자동 부여 대응 및 API 공통 처리 보강
This commit is contained in:
@@ -47,8 +47,7 @@ class CustomerRepositoryRemote implements CustomerRepository {
|
||||
query: {if (includeZipcode) 'include': 'zipcode'},
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return CustomerDto.fromJson(data).toEntity();
|
||||
return CustomerDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 고객을 생성한다.
|
||||
@@ -59,8 +58,7 @@ class CustomerRepositoryRemote implements CustomerRepository {
|
||||
data: customerInputToJson(input),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return CustomerDto.fromJson(data).toEntity();
|
||||
return CustomerDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 고객 정보를 수정한다.
|
||||
@@ -72,8 +70,7 @@ class CustomerRepositoryRemote implements CustomerRepository {
|
||||
data: payload,
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return CustomerDto.fromJson(data).toEntity();
|
||||
return CustomerDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 고객을 삭제한다.
|
||||
@@ -89,7 +86,6 @@ class CustomerRepositoryRemote implements CustomerRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return CustomerDto.fromJson(data).toEntity();
|
||||
return CustomerDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ class _CustomerEnabledPageState extends State<_CustomerEnabledPage> {
|
||||
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;
|
||||
|
||||
@@ -56,8 +56,7 @@ class GroupRepositoryRemote implements GroupRepository {
|
||||
data: input.toPayload(),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return GroupDto.fromJson(data).toEntity();
|
||||
return GroupDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 그룹 정보를 수정한다.
|
||||
@@ -69,8 +68,7 @@ class GroupRepositoryRemote implements GroupRepository {
|
||||
data: payload,
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return GroupDto.fromJson(data).toEntity();
|
||||
return GroupDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 그룹을 삭제한다.
|
||||
@@ -86,7 +84,6 @@ class GroupRepositoryRemote implements GroupRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return GroupDto.fromJson(data).toEntity();
|
||||
return GroupDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ class _GroupEnabledPageState extends State<_GroupEnabledPage> {
|
||||
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;
|
||||
|
||||
@@ -34,7 +34,7 @@ class GroupPermissionRepositoryRemote implements GroupPermissionRepository {
|
||||
if (groupId != null) 'group_id': groupId,
|
||||
if (menuId != null) 'menu_id': menuId,
|
||||
if (isActive != null) 'active': isActive,
|
||||
if (includeDeleted) 'deleted': true,
|
||||
if (includeDeleted) 'include_deleted': true,
|
||||
'include': 'group,menu',
|
||||
},
|
||||
options: Options(responseType: ResponseType.json),
|
||||
@@ -50,8 +50,7 @@ class GroupPermissionRepositoryRemote implements GroupPermissionRepository {
|
||||
data: input.toPayload(),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return GroupPermissionDto.fromJson(data).toEntity();
|
||||
return GroupPermissionDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 그룹 권한을 수정한다.
|
||||
@@ -63,8 +62,7 @@ class GroupPermissionRepositoryRemote implements GroupPermissionRepository {
|
||||
data: payload,
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return GroupPermissionDto.fromJson(data).toEntity();
|
||||
return GroupPermissionDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 그룹 권한을 삭제한다.
|
||||
@@ -80,7 +78,6 @@ class GroupPermissionRepositoryRemote implements GroupPermissionRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return GroupPermissionDto.fromJson(data).toEntity();
|
||||
return GroupPermissionDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class _GroupPermissionEnabledPageState
|
||||
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;
|
||||
@@ -856,6 +856,7 @@ class _PermissionTable extends StatelessWidget {
|
||||
'ID',
|
||||
'그룹명',
|
||||
'메뉴명',
|
||||
'라우트 경로',
|
||||
'생성',
|
||||
'조회',
|
||||
'수정',
|
||||
@@ -872,6 +873,7 @@ class _PermissionTable extends StatelessWidget {
|
||||
permission.id?.toString() ?? '-',
|
||||
permission.group.groupName,
|
||||
permission.menu.menuName,
|
||||
permission.menu.path ?? '-',
|
||||
permission.canCreate ? 'Y' : '-',
|
||||
permission.canRead ? 'Y' : '-',
|
||||
permission.canUpdate ? 'Y' : '-',
|
||||
|
||||
@@ -49,8 +49,7 @@ class MenuRepositoryRemote implements MenuRepository {
|
||||
data: input.toPayload(),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return MenuDto.fromJson(data).toEntity();
|
||||
return MenuDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 메뉴 정보를 수정한다.
|
||||
@@ -62,8 +61,7 @@ class MenuRepositoryRemote implements MenuRepository {
|
||||
data: payload,
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return MenuDto.fromJson(data).toEntity();
|
||||
return MenuDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 메뉴를 삭제한다.
|
||||
@@ -79,7 +77,6 @@ class MenuRepositoryRemote implements MenuRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return MenuDto.fromJson(data).toEntity();
|
||||
return MenuDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ class _MenuEnabledPageState extends State<_MenuEnabledPage> {
|
||||
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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -47,8 +47,7 @@ class UserRepositoryRemote implements UserRepository {
|
||||
data: input.toPayload(),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return UserDto.fromJson(data).toEntity();
|
||||
return UserDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 사용자 정보를 수정한다.
|
||||
@@ -60,8 +59,7 @@ class UserRepositoryRemote implements UserRepository {
|
||||
data: payload,
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return UserDto.fromJson(data).toEntity();
|
||||
return UserDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 사용자를 삭제한다.
|
||||
@@ -77,7 +75,6 @@ class UserRepositoryRemote implements UserRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return UserDto.fromJson(data).toEntity();
|
||||
return UserDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ class _UserEnabledPageState extends State<_UserEnabledPage> {
|
||||
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;
|
||||
|
||||
@@ -44,8 +44,7 @@ class VendorRepositoryRemote implements VendorRepository {
|
||||
data: vendorInputToJson(input),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return VendorDto.fromJson(data).toEntity();
|
||||
return VendorDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -56,8 +55,7 @@ class VendorRepositoryRemote implements VendorRepository {
|
||||
data: payload,
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return VendorDto.fromJson(data).toEntity();
|
||||
return VendorDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -71,7 +69,6 @@ class VendorRepositoryRemote implements VendorRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return VendorDto.fromJson(data).toEntity();
|
||||
return VendorDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ class _VendorEnabledPageState extends State<_VendorEnabledPage> {
|
||||
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;
|
||||
@@ -365,7 +365,7 @@ class _VendorEnabledPageState extends State<_VendorEnabledPage> {
|
||||
final result = _controller.result;
|
||||
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);
|
||||
if (page < 1) {
|
||||
page = 1;
|
||||
} else if (page > totalPages) {
|
||||
|
||||
@@ -46,8 +46,7 @@ class WarehouseRepositoryRemote implements WarehouseRepository {
|
||||
data: warehouseInputToJson(input),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return WarehouseDto.fromJson(data).toEntity();
|
||||
return WarehouseDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 창고 정보를 수정한다.
|
||||
@@ -59,8 +58,7 @@ class WarehouseRepositoryRemote implements WarehouseRepository {
|
||||
data: payload,
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return WarehouseDto.fromJson(data).toEntity();
|
||||
return WarehouseDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 창고를 삭제한다.
|
||||
@@ -76,7 +74,6 @@ class WarehouseRepositoryRemote implements WarehouseRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return WarehouseDto.fromJson(data).toEntity();
|
||||
return WarehouseDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ class _WarehouseEnabledPageState extends State<_WarehouseEnabledPage> {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user