Implement Invoices fetching and uploading

This commit is contained in:
Hamza-Ayed
2026-04-18 00:55:07 +03:00
parent 77434fa815
commit 93591c75e2
3 changed files with 277 additions and 93 deletions

View File

@@ -28,6 +28,14 @@ import { CurrentUser } from '../../common/decorators/current-user.decorator';
@UseGuards(JwtAuthGuard, RolesGuard)
export class InvoicesController {
constructor(private invoicesService: InvoicesService) {}
/**
* قائمة جميع الفواتير للمكتب
*/
@Get()
async findAllByTenant(@CurrentUser() user: any) {
return this.invoicesService.findAllByTenant(user.tenantId);
}
/**
* رفع فاتورة لشركة محددة

View File

@@ -89,6 +89,17 @@ export class InvoicesService {
});
}
/**
* قائمة جميع الفواتير للمكتب
*/
async findAllByTenant(tenantId: string): Promise<Invoice[]> {
return this.invoiceRepository.find({
where: { tenant_id: tenantId },
relations: ['company'],
order: { created_at: 'DESC' },
});
}
/**
* تفاصيل فاتورة
*/