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:
@@ -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(() => ({
|
||||
|
||||
Reference in New Issue
Block a user