feat(receipt-import): add refresh categories endpoint and UI integration

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Nils-Johan Gynther
2026-05-03 10:48:06 +02:00
parent 6503d29801
commit b2eb870ec7
7 changed files with 79 additions and 16 deletions
@@ -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.' };
}
}