Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | import { Controller, Get, Req, UseGuards } from '@nestjs/common'; import { ProjectService } from '../../../domains/projects/services/project.service'; import { BillingService } from '../../../platform/billing/billing.service'; import { JwtAuthGuard } from '../../../platform/auth/jwt-auth.guard'; import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger'; @Controller('api/v1/mobile/client') @ApiTags('MobileClient') @UseGuards(JwtAuthGuard) export class MobileClientController { constructor( private readonly projectService: ProjectService, private readonly billingService: BillingService, ) {} @Get('projects') @ApiOperation({ summary: 'Get active projects and deliverables for client' }) @ApiResponse({ status: 200, description: 'Active projects list' }) async getProjects(@Req() req: any) { const tenantId = req.user?.tenantId || req.headers['x-tenant-id'] || 'SYSTEM'; const projects = await this.projectService.findAll(tenantId); return projects.map((p: any) => ({ id: p._id || p.id, name: p.name, status: p.status, milestonesCount: p.milestones?.length || 0, })); } @Get('invoices') @ApiOperation({ summary: 'Get invoices and checkout links for client' }) @ApiResponse({ status: 200, description: 'Client invoices list' }) async getInvoices(@Req() req: any) { const tenantId = req.user?.tenantId || req.headers['x-tenant-id'] || 'SYSTEM'; const invoices = await this.billingService.getInvoices(tenantId); return invoices.map((i: any) => ({ id: i._id || i.id, invoiceNumber: i.invoiceNumber, amount: i.total, status: i.status, dueDate: i.dueDate, })); } } |