feat(employees): added daily_expected_hours to returns to display and manage daily expected hours by employees using the app

This commit is contained in:
Matthieu Haineault 2026-01-07 09:39:10 -05:00
parent 6cbf37ed86
commit 4646b2f445
4 changed files with 9 additions and 1 deletions

View File

@ -12,6 +12,7 @@ export class EmployeeDetailedDto {
@IsEmail() @IsOptional() email: string;
@IsString() phone_number: string;
@IsDateString() first_work_day: string;
@IsInt() daily_expected_hours: number;
@IsDateString() @IsOptional() last_work_day?: string | null;
@IsString() @IsOptional() residence?: string;
@IsInt() @IsPositive() @Type(() => Number) external_payroll_id: number;

View File

@ -41,9 +41,9 @@ export class EmployeesCreateService {
data: {
user_id: user.id,
external_payroll_id: dto.external_payroll_id,
daily_expected_hours: dto.daily_expected_hours,
company_code: company_code,
job_title: dto.job_title,
daily_expected_hours: 8,
first_work_day: first_work_day,
is_supervisor: dto.is_supervisor,
supervisor_id: supervisor_id,

View File

@ -38,6 +38,7 @@ export class EmployeesGetService {
},
},
is_supervisor: true,
daily_expected_hours: true,
job_title: true,
company_code: true,
external_payroll_id: true,
@ -52,6 +53,7 @@ export class EmployeesGetService {
email: r.user.email,
company_name: toStringFromCompanyCode(r.company_code),
job_title: r.job_title ?? '',
daily_expected_hours: r.daily_expected_hours,
external_payroll_id: r.external_payroll_id,
employee_full_name: `${r.user.first_name} ${r.user.last_name}`,
is_supervisor: r.is_supervisor,
@ -85,6 +87,7 @@ export class EmployeesGetService {
external_payroll_id: true,
is_supervisor: true,
schedule_preset_id: true,
daily_expected_hours: true,
supervisor: {
select: {
id: true, user: {
@ -108,6 +111,7 @@ export class EmployeesGetService {
email: existing_profile.user.email,
supervisor_full_name: `${existing_profile.supervisor?.user.first_name} ${existing_profile.supervisor?.user.last_name}`,
company_name: company_name,
daily_expected_hours: existing_profile.daily_expected_hours,
job_title: existing_profile.job_title ?? '',
external_payroll_id: existing_profile.external_payroll_id,
is_supervisor: existing_profile.is_supervisor,
@ -162,6 +166,7 @@ export class EmployeesGetService {
last_work_day: true,
external_payroll_id: true,
is_supervisor: true,
daily_expected_hours: true,
schedule_preset_id: true,
schedule_preset: {
select: {
@ -197,6 +202,7 @@ export class EmployeesGetService {
last_work_day: employee.last_work_day ? toStringFromDate(employee.last_work_day) : undefined,
supervisor_full_name: employee.supervisor ? `${employee.supervisor?.user.first_name} ${employee.supervisor?.user.last_name}` : '',
user_module_access: module_access_array,
daily_expected_hours: employee.daily_expected_hours,
preset_id: employee.schedule_preset_id ? employee.schedule_preset_id : undefined,
},
};

View File

@ -62,6 +62,7 @@ export class EmployeesUpdateService {
data: {
company_code: company_code,
job_title: dto.job_title,
daily_expected_hours: dto.daily_expected_hours,
first_work_day: toDateFromString(dto.first_work_day),
last_work_day: last_work_day,
is_supervisor: dto.is_supervisor,