번호 자동 부여 대응 및 API 공통 처리 보강
This commit is contained in:
@@ -72,8 +72,7 @@ class ApprovalRepositoryRemote implements ApprovalRepository {
|
||||
query: {if (includeParts.isNotEmpty) 'include': includeParts.join(',')},
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return ApprovalDto.fromJson(data).toEntity();
|
||||
return ApprovalDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 활성화된 결재 행위 목록을 조회한다.
|
||||
@@ -133,8 +132,9 @@ class ApprovalRepositoryRemote implements ApprovalRepository {
|
||||
'$_basePath/$id/can-proceed',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return ApprovalProceedStatusDto.fromJson(data).toEntity();
|
||||
return ApprovalProceedStatusDto.fromJson(
|
||||
_api.unwrapAsMap(response),
|
||||
).toEntity();
|
||||
}
|
||||
|
||||
/// 새로운 결재를 생성한다.
|
||||
@@ -145,8 +145,7 @@ class ApprovalRepositoryRemote implements ApprovalRepository {
|
||||
data: input.toPayload(),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return ApprovalDto.fromJson(data).toEntity();
|
||||
return ApprovalDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 결재 기본 정보를 수정한다.
|
||||
@@ -157,8 +156,7 @@ class ApprovalRepositoryRemote implements ApprovalRepository {
|
||||
data: input.toPayload(),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return ApprovalDto.fromJson(data).toEntity();
|
||||
return ApprovalDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 결재를 삭제(비활성화)한다.
|
||||
@@ -174,8 +172,7 @@ class ApprovalRepositoryRemote implements ApprovalRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return ApprovalDto.fromJson(data).toEntity();
|
||||
return ApprovalDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
/// 결재 단계/행위 응답에서 결재 객체 JSON을 추출한다.
|
||||
|
||||
@@ -51,9 +51,8 @@ class ApprovalTemplateRepositoryRemote implements ApprovalTemplateRepository {
|
||||
query: {if (includeSteps) 'include': 'steps'},
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return ApprovalTemplateDto.fromJson(
|
||||
data,
|
||||
_api.unwrapAsMap(response),
|
||||
).toEntity(includeSteps: includeSteps);
|
||||
}
|
||||
|
||||
@@ -68,9 +67,8 @@ class ApprovalTemplateRepositoryRemote implements ApprovalTemplateRepository {
|
||||
data: input.toCreatePayload(),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
final created = ApprovalTemplateDto.fromJson(
|
||||
data,
|
||||
_api.unwrapAsMap(response),
|
||||
).toEntity(includeSteps: false);
|
||||
if (steps.isNotEmpty) {
|
||||
await _postSteps(created.id, steps);
|
||||
@@ -109,8 +107,9 @@ class ApprovalTemplateRepositoryRemote implements ApprovalTemplateRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return ApprovalTemplateDto.fromJson(data).toEntity(includeSteps: false);
|
||||
return ApprovalTemplateDto.fromJson(
|
||||
_api.unwrapAsMap(response),
|
||||
).toEntity(includeSteps: false);
|
||||
}
|
||||
|
||||
/// 템플릿 단계 전체를 신규로 등록한다.
|
||||
|
||||
Reference in New Issue
Block a user