Add lead company logos and refine Leads stats cards.
Leads can upload/change/remove a logo shown in the list; stats use fixed stage labels with accurate non-archived counts.
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { memoryStorage } from 'multer';
|
||||
import type { Response } from 'express';
|
||||
import ExcelJS from 'exceljs';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
@@ -295,6 +296,32 @@ export class LeadsController {
|
||||
return this.leads.get(user, id);
|
||||
}
|
||||
|
||||
@Get(':id/logo')
|
||||
async logo(@CurrentUser() user: Actor, @Param('id') id: string) {
|
||||
const file = await this.leads.openLogo(user, id);
|
||||
return new StreamableFile(file.stream, { type: file.mimeType });
|
||||
}
|
||||
|
||||
@Post(':id/logo')
|
||||
@UseInterceptors(
|
||||
FileInterceptor('file', {
|
||||
storage: memoryStorage(),
|
||||
limits: { fileSize: 2 * 1024 * 1024 },
|
||||
}),
|
||||
)
|
||||
uploadLogo(
|
||||
@CurrentUser() user: Actor,
|
||||
@Param('id') id: string,
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
) {
|
||||
return this.leads.saveLogo(user, id, file);
|
||||
}
|
||||
|
||||
@Delete(':id/logo')
|
||||
removeLogo(@CurrentUser() user: Actor, @Param('id') id: string) {
|
||||
return this.leads.removeLogo(user, id);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
update(
|
||||
@CurrentUser() user: Actor,
|
||||
|
||||
Reference in New Issue
Block a user