Skip to content

Commit

Permalink
feat: #8/공고 지원자 UI 추가 및 Bloc 연결
Browse files Browse the repository at this point in the history
1. JobPostingWorkersPage 추가
2. WorkerProfile 추가
3. JobPostingWorkersPage와 JobPostingWorkersBloc 연결
  • Loading branch information
Younggun-Kim committed Oct 24, 2024
1 parent 7a8ba84 commit 1120ee1
Show file tree
Hide file tree
Showing 25 changed files with 568 additions and 66 deletions.
9 changes: 8 additions & 1 deletion assets/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,12 @@
"isNotDeadlineYetConfirmClose": "아직 마감날이 아닙니다. 마감할까요?",
"isUpdateContentCorrect": "수정하신 내용이 맞으신가요?",
"canRevertFromPostingManagement": "공고 관리에서 다시 되돌릴 수 있습니다.",
"yearsOld": ""
"yearsOld": "",
"showJobPosting": "공고보기",
"workStatus": "출근현황",
"attendance": "출근",
"leaveWork": "퇴근",
"attendanceScheduled": "출근예정",
"attendanceCompleted": "출근완료",
"noApplicants": "지원자가 없습니다."
}
4 changes: 4 additions & 0 deletions lib/core/router/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ class AppRouter extends RootStackRouter {
page: JobPostingDetailRoute.page,
path: '/job-posting-detail',
),
AutoRoute(
page: JobPostingWorkersRoute.page,
path: '/job-posting-workers',
),
];
}
97 changes: 73 additions & 24 deletions lib/core/router/router.gr.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions lib/core/utils/resource/string_res.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ enum StringRes {
isUpdateContentCorrect,
canRevertFromPostingManagement,
yearsOld,
showJobPosting,
workStatus,
attendance,
leaveWork,
attendanceScheduled,
attendanceCompleted,
noApplicants,
}

extension StringResEx on StringRes {
Expand Down
1 change: 1 addition & 0 deletions lib/feature/job_posting/data/data_sources/dto/dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export 'list/job_postings_model.dart';
export 'request/job_posting_request_dto.dart';
export 'detail/job_posting_detail_dto.dart';
export 'worker/worker.dart';
export 'workers/workers.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extension JobPostingWorkerDtoExt on JobPostingWorkerDto {
required String id,
}) {
return JobPostingWorkerDto(
id: '',
id: id,
workStatus: false,
userInfo: SimpleUserDtoExt.mock(id: id),
workStartTime: DateTime.now(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export 'job_posting_workers_dto.dart';
export '../workers/job_posting_workers_dto.dart';
export 'job_posting_worker_dto.dart';
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:withu_app/core/core.dart';
import 'job_posting_worker_dto.dart';
import '../worker/job_posting_worker_dto.dart';

part 'job_posting_workers_dto.freezed.dart';

part 'job_posting_workers_dto.g.dart';

part 'job_posting_workers_dto.mock.dart';

/// 공고 목록 모델
@freezed
class JobPostingWorkersDto with _$JobPostingWorkersDto {
Expand All @@ -25,16 +27,3 @@ class JobPostingWorkersDto with _$JobPostingWorkersDto {
factory JobPostingWorkersDto.fromJson(Map<String, dynamic> json) =>
_$JobPostingWorkersDtoFromJson(json);
}

extension JobPostingWorkersDtoExt on JobPostingWorkersDto {
static List<JobPostingWorkerDto> mock({
required int page,
}) {
return List.generate(
10,
(int index) => JobPostingWorkerDtoExt.mock(
id: '${(page * 10) + index}',
),
);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
part of 'job_posting_workers_dto.dart';

extension JobPostingWorkersDtoExt on JobPostingWorkersDto {
static JobPostingWorkersDto mock({
required int page,
}) {
const int totalElements = 27;
final List<JobPostingWorkerDto> workers = List.generate(
(10 * page) > totalElements ? (10 * page) - totalElements : 10,
(int index) => JobPostingWorkerDtoExt.mock(
id: '${(page * 10) + index}',
),
);

return JobPostingWorkersDto(
title: '공고제목!',
participants: 49,
workStartDate: DateTime.now(),
workEndDate: DateTime.now().add(const Duration(days: 4)),
content: workers,
totalPages: 3,
totalElements: totalElements,
size: 10,
number: page,
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'job_posting_workers_dto.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class JobPostingMockApi extends JobPostingApi with MockAPI {
path,
(server) => server.reply(
200,
JobPostingWorkersDtoExt.mock(page: page),
JobPostingWorkersDtoExt.mock(page: page).toJson(),
delay: const Duration(milliseconds: 300),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ class JobPostingWorkersEntity {
/// 공고명
final String title;

/// 인원 수
/// 지원한 수
final int applicants;

/// 최대 인원 수
final int participants;

/// 근무 시작 일
Expand All @@ -20,6 +23,7 @@ class JobPostingWorkersEntity {

JobPostingWorkersEntity({
required this.title,
required this.applicants,
required this.participants,
required this.workStartDate,
required this.workEndDate,
Expand All @@ -31,6 +35,7 @@ extension JobPostingWorkersEntityExt on JobPostingWorkersEntity {
static JobPostingWorkersEntity fromDto(JobPostingWorkersDto dto) {
return JobPostingWorkersEntity(
title: dto.title,
applicants: dto.totalElements,
participants: dto.participants,
workStartDate: dto.workStartDate,
workEndDate: dto.workEndDate,
Expand Down
4 changes: 4 additions & 0 deletions lib/feature/job_posting/init_injections.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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/job_posting.dart';
import 'package:withu_app/feature/job_posting/presentation/blocs/workers/job_posting_workers_bloc.dart';

initJobPostingInjections() {
getIt.registerSingleton<JobPostingApi>(
Expand Down Expand Up @@ -31,4 +32,7 @@ initJobPostingInjections() {
getIt.registerFactory<JobPostingDetailBloc>(
() => JobPostingDetailBloc(useCase: getIt()),
);
getIt.registerFactory<JobPostingWorkersBloc>(
() => JobPostingWorkersBloc(useCase: getIt()),
);
}
Loading

0 comments on commit 1120ee1

Please sign in to comment.