From 9bbb887181342c8efb212fa6ae5b39391bc4ff0b Mon Sep 17 00:00:00 2001 From: Conner Date: Thu, 24 Oct 2024 08:42:10 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20#7/=EA=B3=B5=EA=B3=A0=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20Usecase=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../job_posting/domain/usecases/usecases.dart | 10 ++++++- .../domain/usecases/usecases_impl.dart | 28 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/lib/feature/job_posting/domain/usecases/usecases.dart b/lib/feature/job_posting/domain/usecases/usecases.dart index 038192b..3e2c6e8 100644 --- a/lib/feature/job_posting/domain/usecases/usecases.dart +++ b/lib/feature/job_posting/domain/usecases/usecases.dart @@ -14,7 +14,15 @@ abstract class JobPostingUseCase { }); /// 공고 등록 - Future createJobPosting(JobPostingRequestEntity entity); + Future createJobPosting({ + required JobPostingRequestEntity entity, + }); + + /// 공고 수정 + Future updateJobPosting({ + required String jobPostingId, + required JobPostingRequestEntity entity, + }); /// 공고 상세 조회 Future> getJobPosting({ diff --git a/lib/feature/job_posting/domain/usecases/usecases_impl.dart b/lib/feature/job_posting/domain/usecases/usecases_impl.dart index d09eba2..3e9f278 100644 --- a/lib/feature/job_posting/domain/usecases/usecases_impl.dart +++ b/lib/feature/job_posting/domain/usecases/usecases_impl.dart @@ -29,7 +29,9 @@ class JobPostingUseCaseImpl implements JobPostingUseCase { /// 공고 등록 @override - Future createJobPosting(JobPostingRequestEntity entity) async { + Future createJobPosting({ + required JobPostingRequestEntity entity, + }) async { if (!isValidEntity(entity)) { return false; } @@ -45,6 +47,30 @@ class JobPostingUseCaseImpl implements JobPostingUseCase { return result.maybeWhen(success: (_) => true, orElse: () => false); } + /// 공고 수정 + @override + Future updateJobPosting({ + required String jobPostingId, + required JobPostingRequestEntity entity, + }) async { + if (!isValidEntity(entity)) { + return false; + } + + final dto = entity.toDto(); + + if (dto == null) { + return false; + } + + final result = await repository.updateJobPosting( + jobPostingId: jobPostingId, + dto: dto, + ); + + return result.maybeWhen(success: (_) => true, orElse: () => false); + } + /// 공고 상세 조회 @override Future> getJobPosting({