feat(receipt-import): add refresh categories endpoint and UI integration
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { memoryStorage } from 'multer';
|
||||
import { ReceiptImportService } from './receipt-import.service';
|
||||
import { ParsedReceiptItem } from './dto/parsed-receipt-item.dto';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
const ALLOWED_MIMES = [
|
||||
'image/jpeg',
|
||||
@@ -52,4 +53,11 @@ export class ReceiptImportController {
|
||||
const userId = typeof req?.user?.id === 'number' ? req.user.id : undefined;
|
||||
return this.receiptImportService.parseReceipt(file, isPremium, userId);
|
||||
}
|
||||
|
||||
@Post('refresh-categories')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async refreshCategories() {
|
||||
await this.receiptImportService.loadCategories();
|
||||
return { message: 'Kategorier har uppdaterats.' };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user