mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 15:05: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,
|
||||
employeeType,
|
||||
isSufficientlyIndependent,
|
||||
notes
|
||||
} = req.body as CreateEmployeeRequest;
|
||||
|
||||
// Validierung
|
||||
@@ -107,8 +106,8 @@ export const createEmployee = async (req: AuthRequest, res: Response): Promise<v
|
||||
await db.run(
|
||||
`INSERT INTO users (
|
||||
id, email, password, name, role, employee_type, is_sufficiently_independent,
|
||||
notes, is_active
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
is_active
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
[
|
||||
employeeId,
|
||||
email,
|
||||
@@ -117,7 +116,6 @@ export const createEmployee = async (req: AuthRequest, res: Response): Promise<v
|
||||
role,
|
||||
employeeType,
|
||||
isSufficientlyIndependent ? 1 : 0,
|
||||
notes || null,
|
||||
1
|
||||
]
|
||||
);
|
||||
@@ -128,7 +126,7 @@ export const createEmployee = async (req: AuthRequest, res: Response): Promise<v
|
||||
id, email, name, role, is_active as isActive,
|
||||
employee_type as employeeType,
|
||||
is_sufficiently_independent as isSufficientlyIndependent,
|
||||
notes, created_at as createdAt,
|
||||
created_at as createdAt,
|
||||
last_login as lastLogin
|
||||
FROM users
|
||||
WHERE id = ?
|
||||
|
||||
@@ -8,7 +8,8 @@ CREATE TABLE IF NOT EXISTS users (
|
||||
employee_type TEXT CHECK(employee_type IN ('chef', 'neuling', 'erfahren')),
|
||||
is_sufficiently_independent BOOLEAN DEFAULT FALSE,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
last_login DATETIME
|
||||
);
|
||||
|
||||
-- Tabelle für Schichtvorlagen
|
||||
|
||||
@@ -7,7 +7,6 @@ export interface Employee {
|
||||
employeeType: 'chef' | 'neuling' | 'erfahren';
|
||||
isSufficientlyIndependent: boolean;
|
||||
isActive: boolean;
|
||||
notes?: string;
|
||||
createdAt: string;
|
||||
lastLogin?: string | null;
|
||||
}
|
||||
@@ -19,7 +18,6 @@ export interface CreateEmployeeRequest {
|
||||
role: 'admin' | 'instandhalter' | 'user';
|
||||
employeeType: 'chef' | 'neuling' | 'erfahren';
|
||||
isSufficientlyIndependent: boolean;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export interface UpdateEmployeeRequest {
|
||||
@@ -28,7 +26,6 @@ export interface UpdateEmployeeRequest {
|
||||
employeeType?: 'chef' | 'neuling' | 'erfahren';
|
||||
isSufficientlyIndependent?: boolean;
|
||||
isActive?: boolean;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export interface EmployeeWithPassword extends Employee {
|
||||
|
||||
@@ -53,7 +53,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
||||
role: 'user' as 'admin' | 'instandhalter' | 'user',
|
||||
employeeType: 'neuling' as 'chef' | 'neuling' | 'erfahren',
|
||||
isSufficientlyIndependent: false,
|
||||
notes: '',
|
||||
isActive: true
|
||||
});
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -69,7 +68,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
||||
role: employee.role,
|
||||
employeeType: employee.employeeType,
|
||||
isSufficientlyIndependent: employee.isSufficientlyIndependent,
|
||||
notes: employee.notes || '',
|
||||
isActive: employee.isActive
|
||||
});
|
||||
}
|
||||
@@ -114,7 +112,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
||||
role: formData.role,
|
||||
employeeType: formData.employeeType,
|
||||
isSufficientlyIndependent: formData.isSufficientlyIndependent,
|
||||
notes: formData.notes || undefined
|
||||
};
|
||||
await employeeService.createEmployee(createData);
|
||||
} else if (employee) {
|
||||
@@ -124,7 +121,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
||||
employeeType: formData.employeeType,
|
||||
isSufficientlyIndependent: formData.isSufficientlyIndependent,
|
||||
isActive: formData.isActive,
|
||||
notes: formData.notes || undefined
|
||||
};
|
||||
await employeeService.updateEmployee(employee.id, updateData);
|
||||
}
|
||||
@@ -406,40 +402,6 @@ const EmployeeForm: React.FC<EmployeeFormProps> = ({
|
||||
</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) */}
|
||||
{hasRole(['admin']) && (
|
||||
<div style={{
|
||||
|
||||
@@ -9,7 +9,6 @@ export interface Employee {
|
||||
isActive: boolean;
|
||||
createdAt: string;
|
||||
lastLogin?: string | null;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export interface CreateEmployeeRequest {
|
||||
@@ -19,7 +18,6 @@ export interface CreateEmployeeRequest {
|
||||
role: 'admin' | 'instandhalter' | 'user';
|
||||
employeeType: 'chef' | 'neuling' | 'erfahren';
|
||||
isSufficientlyIndependent: boolean;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export interface UpdateEmployeeRequest {
|
||||
@@ -28,7 +26,6 @@ export interface UpdateEmployeeRequest {
|
||||
employeeType?: 'chef' | 'neuling' | 'erfahren';
|
||||
isSufficientlyIndependent?: boolean;
|
||||
isActive?: boolean;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export interface Availability {
|
||||
|
||||
Reference in New Issue
Block a user