-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
997 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ata/dto/request/apply_cancel_request.dart → ...ply/dto/request/apply_cancel_request.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...ta/dto/request/send_fcm_info_request.dart → ...ly/dto/request/send_fcm_info_request.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:lotura/data/apply/data_source/remote/remote_apply_data_source.dart'; | ||
import 'package:lotura/data/apply/dto/request/apply_cancel_request.dart'; | ||
import 'package:lotura/data/apply/dto/request/send_fcm_info_request.dart'; | ||
import 'package:lotura/domain/apply/entity/apply_entity.dart'; | ||
import 'package:lotura/domain/apply/repository/apply_repository.dart'; | ||
|
||
class ApplyRepositoryImpl implements ApplyRepository { | ||
final RemoteApplyDataSource _remoteApplyDataSource; | ||
|
||
ApplyRepositoryImpl({required RemoteApplyDataSource remoteApplyDataSource}) | ||
: _remoteApplyDataSource = remoteApplyDataSource; | ||
|
||
@override | ||
Future<List<ApplyEntity>> getApplyList() => | ||
_remoteApplyDataSource.getApplyList(); | ||
|
||
@override | ||
Future<void> sendFCMInfo({required SendFCMInfoRequest sendFCMInfoRequest}) => | ||
_remoteApplyDataSource.sendFCMInfo( | ||
sendFCMInfoRequest: sendFCMInfoRequest); | ||
|
||
@override | ||
Future<void> applyCancel({required ApplyCancelRequest applyCancelRequest}) => | ||
_remoteApplyDataSource.applyCancel( | ||
applyCancelRequest: applyCancelRequest); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...a/repository/laundry_repository_impl.dart → ...y/repository/laundry_repository_impl.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
lib/data/notice/data_source/local/local_notice_data_source.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'package:hive/hive.dart'; | ||
|
||
class LocalNoticeDataSource { | ||
final Box<int> _box; | ||
|
||
const LocalNoticeDataSource({required Box<int> box}) : _box = box; | ||
|
||
Future<void> setValue({required String key, required int value}) => | ||
_box.put(key, value); | ||
|
||
int? getValue({required String key}) => _box.get(key); | ||
} |
19 changes: 19 additions & 0 deletions
19
lib/data/notice/data_source/remote/remote_notice_data_source.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'dart:async'; | ||
import 'dart:convert'; | ||
|
||
import 'package:http/http.dart' as http; | ||
import 'package:lotura/data/notice/dto/response/notice_response.dart'; | ||
import 'package:lotura/domain/notice/entity/notice_entity.dart'; | ||
import 'package:lotura/secret.dart'; | ||
|
||
class RemoteNoticeDataSource { | ||
Future<List<NoticeEntity>> getNotice() async { | ||
final response = await http.get(Uri.parse("$baseurl/notice")); | ||
if (response.statusCode != 200) { | ||
throw Exception(response.body); | ||
} | ||
return (jsonDecode(utf8.decode(response.bodyBytes)) as List<dynamic>) | ||
.map((i) => NoticeResponse.fromJson(i).toEntity()) | ||
.toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:lotura/domain/notice/entity/notice_entity.dart'; | ||
|
||
class NoticeResponse { | ||
final int id; | ||
final String title; | ||
final String contents; | ||
final String date; | ||
|
||
NoticeResponse({ | ||
required this.id, | ||
required this.title, | ||
required this.contents, | ||
required this.date, | ||
}); | ||
|
||
factory NoticeResponse.fromJson(Map<String, dynamic> json) { | ||
return NoticeResponse( | ||
id: json['id'], | ||
title: json['title'], | ||
contents: json['contents'], | ||
date: json['date'], | ||
); | ||
} | ||
|
||
NoticeEntity toEntity() { | ||
return NoticeEntity( | ||
noticeId: id, | ||
title: title, | ||
contents: contents, | ||
date: date, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:lotura/data/notice/data_source/local/local_notice_data_source.dart'; | ||
import 'package:lotura/data/notice/data_source/remote/remote_notice_data_source.dart'; | ||
import 'package:lotura/domain/notice/entity/notice_entity.dart'; | ||
import 'package:lotura/domain/notice/repository/notice_repository.dart'; | ||
|
||
class NoticeRepositoryImpl implements NoticeRepository { | ||
final RemoteNoticeDataSource _remoteNoticeDataSource; | ||
final LocalNoticeDataSource _localNoticeDataSource; | ||
|
||
const NoticeRepositoryImpl({ | ||
required RemoteNoticeDataSource remoteNoticeDataSource, | ||
required LocalNoticeDataSource localNoticeDataSource, | ||
}) : _remoteNoticeDataSource = remoteNoticeDataSource, | ||
_localNoticeDataSource = localNoticeDataSource; | ||
|
||
@override | ||
Future<List<NoticeEntity>> getNotice() => _remoteNoticeDataSource.getNotice(); | ||
|
||
@override | ||
int? getLastNoticeId({required String key}) => | ||
_localNoticeDataSource.getValue(key: key); | ||
|
||
@override | ||
Future<void> setLastNoticeId({required String key, required int value}) => | ||
_localNoticeDataSource.setValue(key: key, value: value); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.