mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
removed notes as user attribute
This commit is contained in:
@@ -73,7 +73,6 @@ export const createEmployee = async (req: AuthRequest, res: Response): Promise<v
|
|||||||
role,
|
role,
|
||||||
employeeType,
|
employeeType,
|
||||||
isSufficientlyIndependent,
|
isSufficientlyIndependent,
|
||||||
notes
|
|
||||||
} = req.body as CreateEmployeeRequest;
|
} = req.body as CreateEmployeeRequest;
|
||||||
|
|
||||||
// Validierung
|
// Validierung
|
||||||
@@ -107,8 +106,8 @@ export const createEmployee = async (req: AuthRequest, res: Response): Promise<v
|
|||||||
await db.run(
|
await db.run(
|
||||||
`INSERT INTO users (
|
`INSERT INTO users (
|
||||||
id, email, password, name, role, employee_type, is_sufficiently_independent,
|
id, email, password, name, role, employee_type, is_sufficiently_independent,
|
||||||
notes, is_active
|
is_active
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||||
[
|
[
|
||||||
employeeId,
|
employeeId,
|
||||||
email,
|
email,
|
||||||
@@ -117,7 +116,6 @@ export const createEmployee = async (req: AuthRequest, res: Response): Promise<v
|
|||||||
role,
|
role,
|
||||||
employeeType,
|
employeeType,
|
||||||
isSufficientlyIndependent ? 1 : 0,
|
isSufficientlyIndependent ? 1 : 0,
|
||||||
notes || null,
|
|
||||||
1
|
1
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@@ -128,7 +126,7 @@ export const createEmployee = async (req: AuthRequest, res: Response): Promise<v
|
|||||||
id, email, name, role, is_active as isActive,
|
id, email, name, role, is_active as isActive,
|
||||||
employee_type as employeeType,
|
employee_type as employeeType,
|
||||||
is_sufficiently_independent as isSufficientlyIndependent,
|
is_sufficiently_independent as isSufficientlyIndependent,
|
||||||
notes, created_at as createdAt,
|
created_at as createdAt,
|
||||||
last_login as lastLogin
|
last_login as lastLogin
|
||||||
FROM users
|
FROM users
|
||||||
WHERE id = ?
|
WHERE id = ?
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ CREATE TABLE IF NOT EXISTS users (
|
|||||||
employee_type TEXT CHECK(employee_type IN ('chef', 'neuling', 'erfahren')),
|
employee_type TEXT CHECK(employee_type IN ('chef', 'neuling', 'erfahren')),
|
||||||
is_sufficiently_independent BOOLEAN DEFAULT FALSE,
|
is_sufficiently_independent BOOLEAN DEFAULT FALSE,
|
||||||
is_active BOOLEAN DEFAULT TRUE,
|
is_active BOOLEAN DEFAULT TRUE,
|
||||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
last_login DATETIME
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Tabelle für Schichtvorlagen
|
-- Tabelle für Schichtvorlagen
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ export interface Employee {
|
|||||||
employeeType: 'chef' | 'neuling' | 'erfahren';
|
employeeType: 'chef' | 'neuling' | 'erfahren';
|
||||||
isSufficientlyIndependent: boolean;
|
isSufficientlyIndependent: boolean;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
notes?: string;
|
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
lastLogin?: string | null;
|
lastLogin?: string | null;
|
||||||
}
|
}
|
||||||
@@ -19,7 +18,6 @@ export interface CreateEmployeeRequest {
|
|||||||
role: 'admin' | 'instandhalter' | 'user';
|
role: 'admin' | 'instandhalter' | 'user';
|
||||||
employeeType: 'chef' | 'neuling' | 'erfahren';
|
employeeType: 'chef' | 'neuling' | 'erfahren';
|
||||||
isSufficientlyIndependent: boolean;
|
isSufficientlyIndependent: boolean;
|
||||||
notes?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateEmployeeRequest {
|
export interface UpdateEmployeeRequest {
|
||||||
@@ -28,7 +26,6 @@ export interface UpdateEmployeeRequest {
|
|||||||
employeeType?: 'chef' | 'neuling' | 'erfahren';
|
employeeType?: 'chef' | 'neuling' | 'erfahren';
|
||||||
isSufficientlyIndependent?: boolean;
|
isSufficientlyIndependent?: boolean;
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
notes?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EmployeeWithPassword extends Employee {
|
export interface EmployeeWithPassword extends Employee {
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
|||||||
role: 'user' as 'admin' | 'instandhalter' | 'user',
|
role: 'user' as 'admin' | 'instandhalter' | 'user',
|
||||||
employeeType: 'neuling' as 'chef' | 'neuling' | 'erfahren',
|
employeeType: 'neuling' as 'chef' | 'neuling' | 'erfahren',
|
||||||
isSufficientlyIndependent: false,
|
isSufficientlyIndependent: false,
|
||||||
notes: '',
|
|
||||||
isActive: true
|
isActive: true
|
||||||
});
|
});
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -69,7 +68,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
|||||||
role: employee.role,
|
role: employee.role,
|
||||||
employeeType: employee.employeeType,
|
employeeType: employee.employeeType,
|
||||||
isSufficientlyIndependent: employee.isSufficientlyIndependent,
|
isSufficientlyIndependent: employee.isSufficientlyIndependent,
|
||||||
notes: employee.notes || '',
|
|
||||||
isActive: employee.isActive
|
isActive: employee.isActive
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -114,7 +112,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
|||||||
role: formData.role,
|
role: formData.role,
|
||||||
employeeType: formData.employeeType,
|
employeeType: formData.employeeType,
|
||||||
isSufficientlyIndependent: formData.isSufficientlyIndependent,
|
isSufficientlyIndependent: formData.isSufficientlyIndependent,
|
||||||
notes: formData.notes || undefined
|
|
||||||
};
|
};
|
||||||
await employeeService.createEmployee(createData);
|
await employeeService.createEmployee(createData);
|
||||||
} else if (employee) {
|
} else if (employee) {
|
||||||
@@ -124,7 +121,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
|||||||
employeeType: formData.employeeType,
|
employeeType: formData.employeeType,
|
||||||
isSufficientlyIndependent: formData.isSufficientlyIndependent,
|
isSufficientlyIndependent: formData.isSufficientlyIndependent,
|
||||||
isActive: formData.isActive,
|
isActive: formData.isActive,
|
||||||
notes: formData.notes || undefined
|
|
||||||
};
|
};
|
||||||
await employeeService.updateEmployee(employee.id, updateData);
|
await employeeService.updateEmployee(employee.id, updateData);
|
||||||
}
|
}
|
||||||
@@ -406,40 +402,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Bemerkungen */}
|
|
||||||
<div style={{
|
|
||||||
padding: '20px',
|
|
||||||
backgroundColor: '#f8f9fa',
|
|
||||||
borderRadius: '8px',
|
|
||||||
border: '1px solid #e9ecef'
|
|
||||||
}}>
|
|
||||||
<h3 style={{ margin: '0 0 15px 0', color: '#495057' }}>ℹ️ Bemerkungen</h3>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label style={{ display: 'block', marginBottom: '8px', fontWeight: 'bold', color: '#2c3e50' }}>
|
|
||||||
Notizen & Hinweise
|
|
||||||
</label>
|
|
||||||
<textarea
|
|
||||||
name="notes"
|
|
||||||
value={formData.notes}
|
|
||||||
onChange={handleChange}
|
|
||||||
rows={3}
|
|
||||||
style={{
|
|
||||||
width: '100%',
|
|
||||||
padding: '10px',
|
|
||||||
border: '1px solid #ddd',
|
|
||||||
borderRadius: '4px',
|
|
||||||
fontSize: '16px',
|
|
||||||
resize: 'vertical'
|
|
||||||
}}
|
|
||||||
placeholder="Besondere Fähigkeiten, Einschränkungen, Schulungen, wichtige Hinweise..."
|
|
||||||
/>
|
|
||||||
<div style={{ fontSize: '12px', color: '#7f8c8d', marginTop: '5px' }}>
|
|
||||||
Optionale Notizen für interne Zwecke
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Systemrolle (nur für Admins) */}
|
{/* Systemrolle (nur für Admins) */}
|
||||||
{hasRole(['admin']) && (
|
{hasRole(['admin']) && (
|
||||||
<div style={{
|
<div style={{
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ export interface Employee {
|
|||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
lastLogin?: string | null;
|
lastLogin?: string | null;
|
||||||
notes?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateEmployeeRequest {
|
export interface CreateEmployeeRequest {
|
||||||
@@ -19,7 +18,6 @@ export interface CreateEmployeeRequest {
|
|||||||
role: 'admin' | 'instandhalter' | 'user';
|
role: 'admin' | 'instandhalter' | 'user';
|
||||||
employeeType: 'chef' | 'neuling' | 'erfahren';
|
employeeType: 'chef' | 'neuling' | 'erfahren';
|
||||||
isSufficientlyIndependent: boolean;
|
isSufficientlyIndependent: boolean;
|
||||||
notes?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateEmployeeRequest {
|
export interface UpdateEmployeeRequest {
|
||||||
@@ -28,7 +26,6 @@ export interface UpdateEmployeeRequest {
|
|||||||
employeeType?: 'chef' | 'neuling' | 'erfahren';
|
employeeType?: 'chef' | 'neuling' | 'erfahren';
|
||||||
isSufficientlyIndependent?: boolean;
|
isSufficientlyIndependent?: boolean;
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
notes?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Availability {
|
export interface Availability {
|
||||||
|
|||||||
Reference in New Issue
Block a user