Production deployment with Docker and full system fixes

- Added Docker support (Dockerfiles, docker-compose.yml)
- Fixed authentication and authorization (token storage, CORS, permissions)
- Fixed API response transformations for all modules
- Added production deployment scripts and guides
- Fixed frontend permission checks and module access
- Added database seeding script for production
- Complete documentation for deployment and configuration

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Talal Sharabi
2026-02-11 11:25:20 +04:00
parent 35daa52767
commit f31d71ff5a
52 changed files with 9359 additions and 1578 deletions

View File

@@ -0,0 +1,134 @@
import { api } from '../api'
export interface Employee {
id: string
uniqueEmployeeId: string
firstName: string
lastName: string
firstNameAr?: string
lastNameAr?: string
email: string
phone?: string
mobile: string
dateOfBirth?: string
gender?: string
nationality?: string
nationalId?: string
passportNumber?: string
employmentType: string
contractType?: string
hireDate: string
endDate?: string
departmentId: string
department?: any
positionId: string
position?: any
reportingToId?: string
reportingTo?: any
baseSalary: number
status: string
createdAt: string
updatedAt: string
}
export interface CreateEmployeeData {
firstName: string
lastName: string
firstNameAr?: string
lastNameAr?: string
email: string
phone?: string
mobile: string
dateOfBirth?: string
gender?: string
nationality?: string
nationalId?: string
employmentType: string
contractType?: string
hireDate: string
departmentId: string
positionId: string
reportingToId?: string
baseSalary: number
}
export interface UpdateEmployeeData extends Partial<CreateEmployeeData> {}
export interface EmployeeFilters {
search?: string
departmentId?: string
positionId?: string
status?: string
page?: number
pageSize?: number
}
export interface EmployeesResponse {
employees: Employee[]
total: number
page: number
pageSize: number
totalPages: number
}
export const employeesAPI = {
// Get all employees with filters and pagination
getAll: async (filters: EmployeeFilters = {}): Promise<EmployeesResponse> => {
const params = new URLSearchParams()
if (filters.search) params.append('search', filters.search)
if (filters.departmentId) params.append('departmentId', filters.departmentId)
if (filters.positionId) params.append('positionId', filters.positionId)
if (filters.status) params.append('status', filters.status)
if (filters.page) params.append('page', filters.page.toString())
if (filters.pageSize) params.append('pageSize', filters.pageSize.toString())
const response = await api.get(`/hr/employees?${params.toString()}`)
const { data, pagination } = response.data
return {
employees: data || [],
total: pagination?.total || 0,
page: pagination?.page || 1,
pageSize: pagination?.pageSize || 20,
totalPages: pagination?.totalPages || 0,
}
},
// Get single employee by ID
getById: async (id: string): Promise<Employee> => {
const response = await api.get(`/hr/employees/${id}`)
return response.data.data
},
// Create new employee
create: async (data: CreateEmployeeData): Promise<Employee> => {
const response = await api.post('/hr/employees', data)
return response.data.data
},
// Update existing employee
update: async (id: string, data: UpdateEmployeeData): Promise<Employee> => {
const response = await api.put(`/hr/employees/${id}`, data)
return response.data.data
},
// Delete employee
delete: async (id: string): Promise<void> => {
await api.delete(`/hr/employees/${id}`)
}
}
// Departments API
export const departmentsAPI = {
getAll: async (): Promise<any[]> => {
const response = await api.get('/hr/departments')
return response.data.data
}
}
// Positions API
export const positionsAPI = {
getAll: async (): Promise<any[]> => {
const response = await api.get('/hr/positions')
return response.data.data
}
}