주석화 진행상황 정리하고 핵심 모듈에 한글 주석 추가
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:superport_v2/core/common/utils/json_utils.dart';
|
||||
|
||||
import '../../domain/entities/group.dart';
|
||||
|
||||
/// 권한 그룹(Group) API 응답을 표현하는 DTO.
|
||||
class GroupDto {
|
||||
GroupDto({
|
||||
this.id,
|
||||
@@ -26,6 +27,7 @@ class GroupDto {
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
/// JSON에서 그룹 정보를 파싱한다.
|
||||
factory GroupDto.fromJson(Map<String, dynamic> json) {
|
||||
return GroupDto(
|
||||
id: json['id'] as int?,
|
||||
@@ -40,6 +42,7 @@ class GroupDto {
|
||||
);
|
||||
}
|
||||
|
||||
/// DTO를 도메인 [Group] 엔티티로 변환한다.
|
||||
Group toEntity() => Group(
|
||||
id: id,
|
||||
groupName: groupName,
|
||||
@@ -52,6 +55,7 @@ class GroupDto {
|
||||
updatedAt: updatedAt,
|
||||
);
|
||||
|
||||
/// 페이징 응답을 [PaginatedResult]로 변환한다.
|
||||
static PaginatedResult<Group> parsePaginated(Map<String, dynamic>? json) {
|
||||
final rawItems = JsonUtils.extractList(json, keys: const ['items']);
|
||||
final items = rawItems
|
||||
@@ -67,6 +71,7 @@ class GroupDto {
|
||||
}
|
||||
}
|
||||
|
||||
/// 문자열/DateTime을 파싱해 [DateTime]으로 반환한다.
|
||||
DateTime? _parseDate(Object? value) {
|
||||
if (value == null) return null;
|
||||
if (value is DateTime) return value;
|
||||
|
||||
@@ -6,6 +6,7 @@ import '../../domain/entities/group.dart';
|
||||
import '../../domain/repositories/group_repository.dart';
|
||||
import '../dtos/group_dto.dart';
|
||||
|
||||
/// 권한 그룹 API를 호출하는 원격 저장소 구현체.
|
||||
class GroupRepositoryRemote implements GroupRepository {
|
||||
GroupRepositoryRemote({required ApiClient apiClient}) : _api = apiClient;
|
||||
|
||||
@@ -13,6 +14,7 @@ class GroupRepositoryRemote implements GroupRepository {
|
||||
|
||||
static const _basePath = '/groups';
|
||||
|
||||
/// 그룹 목록을 조회한다.
|
||||
@override
|
||||
Future<PaginatedResult<Group>> list({
|
||||
int page = 1,
|
||||
@@ -35,6 +37,7 @@ class GroupRepositoryRemote implements GroupRepository {
|
||||
return GroupDto.parsePaginated(response.data ?? const {});
|
||||
}
|
||||
|
||||
/// 새 그룹을 생성한다.
|
||||
@override
|
||||
Future<Group> create(GroupInput input) async {
|
||||
final response = await _api.post<Map<String, dynamic>>(
|
||||
@@ -46,6 +49,7 @@ class GroupRepositoryRemote implements GroupRepository {
|
||||
return GroupDto.fromJson(data).toEntity();
|
||||
}
|
||||
|
||||
/// 그룹 정보를 수정한다.
|
||||
@override
|
||||
Future<Group> update(int id, GroupInput input) async {
|
||||
final response = await _api.patch<Map<String, dynamic>>(
|
||||
@@ -57,11 +61,13 @@ class GroupRepositoryRemote implements GroupRepository {
|
||||
return GroupDto.fromJson(data).toEntity();
|
||||
}
|
||||
|
||||
/// 그룹을 삭제한다.
|
||||
@override
|
||||
Future<void> delete(int id) async {
|
||||
await _api.delete<void>('$_basePath/$id');
|
||||
}
|
||||
|
||||
/// 삭제된 그룹을 복구한다.
|
||||
@override
|
||||
Future<Group> restore(int id) async {
|
||||
final response = await _api.post<Map<String, dynamic>>(
|
||||
|
||||
Reference in New Issue
Block a user