edgar.mendez ad264107f6 feat: add departments and employees management components
- Implement DepartmentsService for CRUD operations on departments.
- Create Employees.vue for managing employee listings, including viewing, editing, and deleting employees.
- Add EmployeesForm.vue for creating and editing employee details with validation.
- Introduce employees.interfaces.ts to define employee-related TypeScript interfaces.
- Implement EmployeesService for API interactions related to employees.
- Add positions.interface.ts and positions.services.ts for managing job positions.
2026-03-10 16:13:26 -06:00

45 lines
1.4 KiB
TypeScript

import api from "@/services/api";
import type { CreatePositionDTO, ResponsePositionsDTO, UpdatePositionDTO } from "./positions.interface";
export class PositionsService {
public async getPositions(): Promise<ResponsePositionsDTO> {
try {
const response = await api.get('/api/rh/job-positions');
return response.data;
} catch (error) {
console.error('Error fetching positions:', error);
throw error;
}
}
public async createPosition(data: CreatePositionDTO): Promise<ResponsePositionsDTO> {
try {
const response = await api.post('/api/rh/job-positions', data);
return response.data;
} catch (error) {
console.error('Error creating position:', error);
throw error;
}
}
public async updatePosition(id: number, data: UpdatePositionDTO): Promise<ResponsePositionsDTO> {
try {
const response = await api.put(`/api/rh/job-positions/${id}`, data);
return response.data;
} catch (error) {
console.error('Error updating position:', error);
throw error;
}
}
public async deletePosition(id: number): Promise<void> {
try {
await api.delete(`/api/rh/job-positions/${id}`);
} catch (error) {
console.error('Error deleting position:', error);
throw error;
}
}
}