added new view in contracts customer and contracts
This commit is contained in:
@@ -5,7 +5,16 @@ import { ApiResponse, AuthRequest } from '../types/index.js';
|
||||
|
||||
export async function getContracts(req: AuthRequest, res: Response): Promise<void> {
|
||||
try {
|
||||
const { customerId, type, status, search, page, limit } = req.query;
|
||||
const { customerId, type, status, search, page, limit, tree } = req.query;
|
||||
|
||||
// Baumstruktur für Kundenansicht
|
||||
if (tree === 'true' && customerId) {
|
||||
const treeData = await contractService.getContractTreeForCustomer(
|
||||
parseInt(customerId as string)
|
||||
);
|
||||
res.json({ success: true, data: treeData } as ApiResponse);
|
||||
return;
|
||||
}
|
||||
|
||||
// Für Kundenportal-Benutzer: nur eigene + vertretene Kunden-Verträge anzeigen
|
||||
let customerIds: number[] | undefined;
|
||||
|
||||
Reference in New Issue
Block a user