Revert "fix: resolve all ESLint errors in backend and frontend"
Build and Push Multi-Platform Images / build-and-push (push) Successful in 19s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 19s
This reverts commit 07dfd7e840.
This commit is contained in:
@@ -3,7 +3,6 @@ import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository, In } from 'typeorm';
|
||||
import { Client } from '../database/entities/client.entity';
|
||||
import { UserClient } from '../database/entities/user-client.entity';
|
||||
import type { AuthenticatedRequest } from '../auth/authenticated-request';
|
||||
|
||||
@Controller('api/clients')
|
||||
export class ClientsController {
|
||||
@@ -16,8 +15,8 @@ export class ClientsController {
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
async getMyClients(@Request() req: AuthenticatedRequest) {
|
||||
const userId = req.user!.userId;
|
||||
async getMyClients(@Request() req: any) {
|
||||
const userId = req.user.userId;
|
||||
const mappings = await this.userClientRepo.find({
|
||||
where: { UserId: userId },
|
||||
});
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
type InboxSource,
|
||||
type StoredQrCode,
|
||||
} from '../database/entities/inbox-document.entity';
|
||||
import { getErrorMessage, getErrorCode } from '../common/error.util';
|
||||
import { PageCacheService } from '../barcode/page-cache.service';
|
||||
|
||||
interface LegacyScanRow {
|
||||
@@ -42,10 +41,10 @@ export class InboxMigrationService implements OnApplicationBootstrap {
|
||||
withFileTypes: true,
|
||||
});
|
||||
subdirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);
|
||||
} catch (err: unknown) {
|
||||
if (getErrorCode(err) !== 'ENOENT') {
|
||||
} catch (err: any) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
this.logger.warn(
|
||||
`Migration: ${this.legacyRoot} nicht lesbar: ${getErrorMessage(err)}`,
|
||||
`Migration: ${this.legacyRoot} nicht lesbar: ${err.message}`,
|
||||
);
|
||||
}
|
||||
return;
|
||||
@@ -57,10 +56,8 @@ export class InboxMigrationService implements OnApplicationBootstrap {
|
||||
let files: string[];
|
||||
try {
|
||||
files = await fs.readdir(dir);
|
||||
} catch (err: unknown) {
|
||||
this.logger.warn(
|
||||
`Migration: ${dir} nicht lesbar: ${getErrorMessage(err)}`,
|
||||
);
|
||||
} catch (err: any) {
|
||||
this.logger.warn(`Migration: ${dir} nicht lesbar: ${err.message}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -70,9 +67,9 @@ export class InboxMigrationService implements OnApplicationBootstrap {
|
||||
try {
|
||||
await this.migrateFile(src, subdir, name);
|
||||
migrated += 1;
|
||||
} catch (err: unknown) {
|
||||
} catch (err: any) {
|
||||
this.logger.error(
|
||||
`Migration fehlgeschlagen (${src}): ${getErrorMessage(err)}`,
|
||||
`Migration fehlgeschlagen (${src}): ${err.message}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -119,8 +116,8 @@ export class InboxMigrationService implements OnApplicationBootstrap {
|
||||
try {
|
||||
await fs.rename(src, dest);
|
||||
return;
|
||||
} catch (err: unknown) {
|
||||
if (getErrorCode(err) !== 'EXDEV') throw err;
|
||||
} catch (err: any) {
|
||||
if (err.code !== 'EXDEV') throw err;
|
||||
}
|
||||
await fs.copyFile(src, dest);
|
||||
try {
|
||||
|
||||
@@ -21,8 +21,6 @@ import { BarcodeScannerService } from '../barcode/barcode-scanner.service';
|
||||
import { UserSettingsService } from '../user-settings/user-settings.service';
|
||||
import { RequirePermissions } from '../auth/permissions.decorator';
|
||||
import { Permission } from '../auth/permissions.enum';
|
||||
import type { AuthenticatedRequest } from '../auth/authenticated-request';
|
||||
import type { InboxSource } from '../database/entities/inbox-document.entity';
|
||||
|
||||
@Controller('api/inbox')
|
||||
@RequirePermissions(Permission.VIEW_SCANNER)
|
||||
@@ -35,7 +33,7 @@ export class InboxController {
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
async list(@Request() req: AuthenticatedRequest) {
|
||||
async list(@Request() req: any) {
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
return this.inboxService.listFiles(preferredUsername);
|
||||
@@ -49,7 +47,7 @@ export class InboxController {
|
||||
@Get(':id/preview')
|
||||
async preview(
|
||||
@Param('id') id: string,
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const preferredUsername: string | null =
|
||||
@@ -71,7 +69,7 @@ export class InboxController {
|
||||
async pageThumbnail(
|
||||
@Param('id') id: string,
|
||||
@Param('page', ParseIntPipe) page: number,
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const preferredUsername: string | null =
|
||||
@@ -90,10 +88,7 @@ export class InboxController {
|
||||
|
||||
@Delete(':id')
|
||||
@HttpCode(204)
|
||||
async remove(
|
||||
@Param('id') id: string,
|
||||
@Request() req: AuthenticatedRequest,
|
||||
): Promise<void> {
|
||||
async remove(@Param('id') id: string, @Request() req: any): Promise<void> {
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
await this.inboxService.deleteDocument(id, preferredUsername);
|
||||
@@ -104,7 +99,7 @@ export class InboxController {
|
||||
async removePage(
|
||||
@Param('id') id: string,
|
||||
@Param('page', ParseIntPipe) page: number,
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
@@ -116,7 +111,7 @@ export class InboxController {
|
||||
async toggleManualSplit(
|
||||
@Param('id') id: string,
|
||||
@Param('page', ParseIntPipe) page: number,
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
@@ -127,7 +122,7 @@ export class InboxController {
|
||||
@HttpCode(204)
|
||||
async resetEdits(
|
||||
@Param('id') id: string,
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
@@ -137,7 +132,7 @@ export class InboxController {
|
||||
@Post(':id/postprocess')
|
||||
async postprocess(
|
||||
@Param('id') id: string,
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
@Body()
|
||||
body: {
|
||||
sectionOffset?: number;
|
||||
@@ -163,7 +158,7 @@ export class InboxController {
|
||||
@Param('id') id: string,
|
||||
@Param('page', ParseIntPipe) page: number,
|
||||
@Body() body: { rotation?: number },
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const rotation = Number(body?.rotation);
|
||||
if (!Number.isFinite(rotation)) {
|
||||
@@ -183,7 +178,7 @@ export class InboxController {
|
||||
async pagePreview(
|
||||
@Param('id') id: string,
|
||||
@Param('page', ParseIntPipe) page: number,
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const preferredUsername: string | null =
|
||||
@@ -205,7 +200,7 @@ export class InboxController {
|
||||
@Param('id') id: string,
|
||||
@Param('page', ParseIntPipe) page: number,
|
||||
@Body() body: { x: number; y: number; w: number; h: number },
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
): Promise<{ found: string[] }> {
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
@@ -224,8 +219,8 @@ export class InboxController {
|
||||
@HttpCode(204)
|
||||
async updateSource(
|
||||
@Param('id') id: string,
|
||||
@Body() body: { source: InboxSource },
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Body() body: { source: any },
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
@@ -236,7 +231,7 @@ export class InboxController {
|
||||
async downloadSegment(
|
||||
@Param('id') id: string,
|
||||
@Body() body: { pages: number[] },
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const preferredUsername: string | null =
|
||||
@@ -268,13 +263,13 @@ export class InboxController {
|
||||
segments: { pages: number[]; filename: string }[];
|
||||
sender?: string;
|
||||
},
|
||||
@Request() req: AuthenticatedRequest,
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
const smtpOverride =
|
||||
body.sender === 'user'
|
||||
? await this.userSettingsService.getSmtpConfig(req.user!.userId)
|
||||
? await this.userSettingsService.getSmtpConfig(req.user.userId)
|
||||
: null;
|
||||
await this.inboxService.sendAsEmail(id, preferredUsername, {
|
||||
...body,
|
||||
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
} from '../database/entities/inbox-document.entity';
|
||||
import { MailService } from '../postprocessing/mail.service';
|
||||
import { buildSegmentBuffer } from '../inbox-postprocessor/edit-applier';
|
||||
import { getErrorMessage } from '../common/error.util';
|
||||
|
||||
export interface InboxFile {
|
||||
id: string;
|
||||
@@ -100,9 +99,9 @@ export class InboxService {
|
||||
try {
|
||||
const stat = await fs.stat(pdfPath);
|
||||
if (!stat.isFile()) throw new Error('not a file');
|
||||
} catch (err: unknown) {
|
||||
} catch (err: any) {
|
||||
this.logger.warn(
|
||||
`Datei fehlt trotz DB-Eintrag (${doc.Id}): ${getErrorMessage(err)}`,
|
||||
`Datei fehlt trotz DB-Eintrag (${doc.Id}): ${err.message}`,
|
||||
);
|
||||
throw new NotFoundException('Dokument nicht gefunden');
|
||||
}
|
||||
@@ -219,9 +218,9 @@ export class InboxService {
|
||||
await this.documentRepo.delete(doc.Id);
|
||||
try {
|
||||
await fs.rm(dir, { recursive: true, force: true });
|
||||
} catch (err: unknown) {
|
||||
} catch (err: any) {
|
||||
this.logger.warn(
|
||||
`Dokument-Ordner konnte nicht gelöscht werden (${dir}): ${getErrorMessage(err)}`,
|
||||
`Dokument-Ordner konnte nicht gelöscht werden (${dir}): ${err.message}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user