Implement Invoices fetching and uploading
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* رفع فاتورة لشركة محددة
|
||||
|
||||
@@ -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' },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* تفاصيل فاتورة
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user