diff --git a/lib/feature/job_posting/domain/usecases/usecases.dart b/lib/feature/job_posting/domain/usecases/usecases.dart index 1796c10..038192b 100644 --- a/lib/feature/job_posting/domain/usecases/usecases.dart +++ b/lib/feature/job_posting/domain/usecases/usecases.dart @@ -2,6 +2,7 @@ import 'package:withu_app/core/core.dart'; import 'package:withu_app/feature/job_posting/data/data.dart'; import 'package:withu_app/feature/job_posting/domain/domain.dart'; import 'package:withu_app/feature/job_posting/domain/entities/job_posting_detail_entity.dart'; +import 'package:withu_app/shared/data/data.dart'; part 'usecases_impl.dart'; @@ -24,4 +25,9 @@ abstract class JobPostingUseCase { Future> closeJobPosting({ required String jobPostingId, }); + + /// 공고 삭제 + Future> deleteJobPosting({ + required String jobPostingId, + }); } diff --git a/lib/feature/job_posting/domain/usecases/usecases_impl.dart b/lib/feature/job_posting/domain/usecases/usecases_impl.dart index ec7cf4d..5d8ebfe 100644 --- a/lib/feature/job_posting/domain/usecases/usecases_impl.dart +++ b/lib/feature/job_posting/domain/usecases/usecases_impl.dart @@ -84,6 +84,29 @@ class JobPostingUseCaseImpl implements JobPostingUseCase { }, ); } + + /// 공고 삭제 + @override + Future> deleteJobPosting({ + required String jobPostingId, + }) async { + final result = + await repository.deleteJobPosting(jobPostingId: jobPostingId); + + return result.when( + success: (DeleteResponseDto dto) { + return dto.deleted + ? const Either.success(true) + : Either.fail(dto.message ?? ''); + }, + fail: (FailResponse fail) { + return Either.fail(fail.message); + }, + error: () { + return Either.fail(StringRes.serverError.tr); + }, + ); + } } extension on JobPostingUseCase {