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({