Enhance employee and user management with linked user functionality

- Introduced `EmployeeUserWrite` type to manage user details associated with employees.
- Updated `EmployeesService` and `EmployeesRepository` to support user assignment and retrieval by user ID.
- Enhanced DTOs to include user information for employee creation and updates.
- Implemented validation to ensure proper handling of user data during employee operations.
- Added unit and e2e tests to validate the new functionality and ensure data integrity in user-employee relationships.
- Modified existing controllers to accommodate the new user linkage features in employee management.
This commit is contained in:
shancheas
2026-08-27 12:22:25 +07:00
parent 8a61c94078
commit 790725e227
16 changed files with 736 additions and 18 deletions
@@ -107,6 +107,12 @@ describe('EmployeesRepository', () => {
expect(employee?.code).toBe('EMP_01');
});
it('findByUserId maps a row', async () => {
limit.mockResolvedValueOnce([row]);
const employee = await repository.findByUserId('user-1');
expect(employee?.id).toBe('emp-1');
});
it('list returns mapped rows and total', async () => {
select
.mockImplementationOnce(() => ({