주석화 진행상황 정리하고 핵심 모듈에 한글 주석 추가
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:superport_v2/core/common/utils/json_utils.dart';
|
||||
|
||||
import '../../domain/entities/customer.dart';
|
||||
|
||||
/// 고객(Customer) API 응답을 다루는 DTO.
|
||||
class CustomerDto {
|
||||
CustomerDto({
|
||||
this.id,
|
||||
@@ -36,6 +37,7 @@ class CustomerDto {
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
/// 원본 JSON으로부터 DTO를 생성한다.
|
||||
factory CustomerDto.fromJson(Map<String, dynamic> json) {
|
||||
return CustomerDto(
|
||||
id: json['id'] as int?,
|
||||
@@ -57,6 +59,7 @@ class CustomerDto {
|
||||
);
|
||||
}
|
||||
|
||||
/// DTO를 JSON 맵으로 변환한다.
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
if (id != null) 'id': id,
|
||||
@@ -76,6 +79,7 @@ class CustomerDto {
|
||||
};
|
||||
}
|
||||
|
||||
/// DTO를 도메인 [Customer] 엔티티로 변환한다.
|
||||
Customer toEntity() => Customer(
|
||||
id: id,
|
||||
customerCode: customerCode,
|
||||
@@ -93,6 +97,7 @@ class CustomerDto {
|
||||
updatedAt: updatedAt,
|
||||
);
|
||||
|
||||
/// 페이징 응답을 파싱해 [PaginatedResult] 형식으로 반환한다.
|
||||
static PaginatedResult<Customer> parsePaginated(Map<String, dynamic>? json) {
|
||||
final rawItems = JsonUtils.extractList(json, keys: const ['items']);
|
||||
final items = rawItems
|
||||
@@ -108,6 +113,7 @@ class CustomerDto {
|
||||
}
|
||||
}
|
||||
|
||||
/// 고객 주소의 우편번호 정보를 담는 DTO.
|
||||
class CustomerZipcodeDto {
|
||||
CustomerZipcodeDto({
|
||||
required this.zipcode,
|
||||
@@ -121,6 +127,7 @@ class CustomerZipcodeDto {
|
||||
final String? sigungu;
|
||||
final String? roadName;
|
||||
|
||||
/// JSON에서 우편번호 정보를 파싱한다.
|
||||
factory CustomerZipcodeDto.fromJson(Map<String, dynamic> json) {
|
||||
return CustomerZipcodeDto(
|
||||
zipcode: json['zipcode'] as String,
|
||||
@@ -130,6 +137,7 @@ class CustomerZipcodeDto {
|
||||
);
|
||||
}
|
||||
|
||||
/// DTO를 JSON 맵으로 직렬화한다.
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'zipcode': zipcode,
|
||||
@@ -139,6 +147,7 @@ class CustomerZipcodeDto {
|
||||
};
|
||||
}
|
||||
|
||||
/// DTO를 [CustomerZipcode] 엔티티로 변환한다.
|
||||
CustomerZipcode toEntity() => CustomerZipcode(
|
||||
zipcode: zipcode,
|
||||
sido: sido,
|
||||
@@ -147,6 +156,7 @@ class CustomerZipcodeDto {
|
||||
);
|
||||
}
|
||||
|
||||
/// 문자열/DateTime 값을 파싱해 [DateTime]으로 변환한다.
|
||||
DateTime? _parseDate(Object? value) {
|
||||
if (value == null) return null;
|
||||
if (value is DateTime) return value;
|
||||
@@ -154,6 +164,7 @@ DateTime? _parseDate(Object? value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// 고객 입력 모델을 API 요청 바디로 변환한다.
|
||||
Map<String, dynamic> customerInputToJson(CustomerInput input) {
|
||||
final map = input.toPayload();
|
||||
map.removeWhere((key, value) => value == null);
|
||||
|
||||
Reference in New Issue
Block a user