ci(github): add linting and improve CI workflow
- Add ESLint configuration for backend TypeScript code - Include linting step in backend quality checks - Add linting step to GitHub Actions CI workflow - Enable configurable Prisma query logging via PRISMA_LOG_QUERIES environment variable - Update PrismaService to support dynamic log levels based on PRISMA_LOG_QUERIES - Replace BadRequestException with UnauthorizedException in receipt import security tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { BadRequestException } from '@nestjs/common';
|
||||
import { BadRequestException, UnauthorizedException } from '@nestjs/common';
|
||||
import { ReceiptImportController } from './receipt-import.controller';
|
||||
|
||||
describe('ReceiptImport controller security', () => {
|
||||
@@ -55,11 +55,11 @@ describe('ReceiptImport controller security', () => {
|
||||
expect(receiptImportServiceMock.upsertUnitMapping).toHaveBeenCalledWith(99, 1, 'g', 'kg');
|
||||
});
|
||||
|
||||
it('upsertUnitMapping nekar när användar-id saknas', async () => {
|
||||
await expect(
|
||||
controller.upsertUnitMapping({ productId: 1, originalUnit: 'g', preferredUnit: 'kg' } as any, { user: {} }),
|
||||
).rejects.toThrow(BadRequestException);
|
||||
});
|
||||
it('upsertUnitMapping nekar när användar-id saknas', async () => {
|
||||
await expect(
|
||||
controller.upsertUnitMapping({ productId: 1, originalUnit: 'g', preferredUnit: 'kg' } as any, { user: {} }),
|
||||
).rejects.toThrow(UnauthorizedException);
|
||||
});
|
||||
|
||||
it('saveReceipt nekar global alias för icke-admin', async () => {
|
||||
const dto = {
|
||||
|
||||
Reference in New Issue
Block a user