chore: apply ESLint auto-fix across entire backend
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s
Reformats code style (line breaks, indentation, type annotations) without changing logic. Also includes minor feature additions bundled in the same lint run (stats service, user-settings groups, agrarmonitor polling improvements). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,8 @@ export class InboxController {
|
||||
|
||||
@Get()
|
||||
async list(@Request() req: any) {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
return this.inboxService.listFiles(preferredUsername);
|
||||
}
|
||||
|
||||
@@ -49,11 +50,18 @@ export class InboxController {
|
||||
@Request() req: any,
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const { doc, pdfPath } = await this.inboxService.resolveDocument(id, preferredUsername);
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
const { doc, pdfPath } = await this.inboxService.resolveDocument(
|
||||
id,
|
||||
preferredUsername,
|
||||
);
|
||||
|
||||
res.setHeader('Content-Type', 'application/pdf');
|
||||
res.setHeader('Content-Disposition', `inline; filename="${doc.OriginalName}"`);
|
||||
res.setHeader(
|
||||
'Content-Disposition',
|
||||
`inline; filename="${doc.OriginalName}"`,
|
||||
);
|
||||
return new StreamableFile(createReadStream(pdfPath));
|
||||
}
|
||||
|
||||
@@ -64,8 +72,14 @@ export class InboxController {
|
||||
@Request() req: any,
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const filePath = await this.inboxService.resolvePageImage(id, page, 'thumbnail', preferredUsername);
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
const filePath = await this.inboxService.resolvePageImage(
|
||||
id,
|
||||
page,
|
||||
'thumbnail',
|
||||
preferredUsername,
|
||||
);
|
||||
|
||||
res.setHeader('Content-Type', 'image/png');
|
||||
res.setHeader('Cache-Control', 'private, max-age=3600');
|
||||
@@ -75,7 +89,8 @@ export class InboxController {
|
||||
@Delete(':id')
|
||||
@HttpCode(204)
|
||||
async remove(@Param('id') id: string, @Request() req: any): Promise<void> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
await this.inboxService.deleteDocument(id, preferredUsername);
|
||||
}
|
||||
|
||||
@@ -86,7 +101,8 @@ export class InboxController {
|
||||
@Param('page', ParseIntPipe) page: number,
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
await this.inboxService.deletePage(id, page, preferredUsername);
|
||||
}
|
||||
|
||||
@@ -97,14 +113,19 @@ export class InboxController {
|
||||
@Param('page', ParseIntPipe) page: number,
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
await this.inboxService.toggleManualSplit(id, page, preferredUsername);
|
||||
}
|
||||
|
||||
@Post(':id/reset-edits')
|
||||
@HttpCode(204)
|
||||
async resetEdits(@Param('id') id: string, @Request() req: any): Promise<void> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
async resetEdits(
|
||||
@Param('id') id: string,
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
await this.inboxService.resetEdits(id, preferredUsername);
|
||||
}
|
||||
|
||||
@@ -112,9 +133,15 @@ export class InboxController {
|
||||
async postprocess(
|
||||
@Param('id') id: string,
|
||||
@Request() req: any,
|
||||
@Body() body: { sectionOffset?: number; processOnlyOne?: boolean; replaceDuplicate?: boolean },
|
||||
@Body()
|
||||
body: {
|
||||
sectionOffset?: number;
|
||||
processOnlyOne?: boolean;
|
||||
replaceDuplicate?: boolean;
|
||||
},
|
||||
) {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
const { results, totalSections } = await this.postprocessor.runForDocument(
|
||||
id,
|
||||
preferredUsername,
|
||||
@@ -137,8 +164,14 @@ export class InboxController {
|
||||
if (!Number.isFinite(rotation)) {
|
||||
throw new BadRequestException('rotation muss eine Zahl sein');
|
||||
}
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
await this.inboxService.setPageRotation(id, page, rotation, preferredUsername);
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
await this.inboxService.setPageRotation(
|
||||
id,
|
||||
page,
|
||||
rotation,
|
||||
preferredUsername,
|
||||
);
|
||||
}
|
||||
|
||||
@Get(':id/pages/:page/preview')
|
||||
@@ -148,8 +181,14 @@ export class InboxController {
|
||||
@Request() req: any,
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const filePath = await this.inboxService.resolvePageImage(id, page, 'preview', preferredUsername);
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
const filePath = await this.inboxService.resolvePageImage(
|
||||
id,
|
||||
page,
|
||||
'preview',
|
||||
preferredUsername,
|
||||
);
|
||||
|
||||
res.setHeader('Content-Type', 'image/png');
|
||||
res.setHeader('Cache-Control', 'private, max-age=3600');
|
||||
@@ -163,8 +202,17 @@ export class InboxController {
|
||||
@Body() body: { x: number; y: number; w: number; h: number },
|
||||
@Request() req: any,
|
||||
): Promise<{ found: string[] }> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
return this.inboxService.scanRegion(id, page, body.x, body.y, body.w, body.h, preferredUsername);
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
return this.inboxService.scanRegion(
|
||||
id,
|
||||
page,
|
||||
body.x,
|
||||
body.y,
|
||||
body.w,
|
||||
body.h,
|
||||
preferredUsername,
|
||||
);
|
||||
}
|
||||
|
||||
@Post(':id/source')
|
||||
@@ -174,7 +222,8 @@ export class InboxController {
|
||||
@Body() body: { source: any },
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
await this.inboxService.updateSource(id, body.source, preferredUsername);
|
||||
}
|
||||
|
||||
@@ -185,11 +234,19 @@ export class InboxController {
|
||||
@Request() req: any,
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
const { buffer, filename } = await this.inboxService.getSegmentPdfBuffer(id, preferredUsername, body.pages ?? []);
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
const { buffer, filename } = await this.inboxService.getSegmentPdfBuffer(
|
||||
id,
|
||||
preferredUsername,
|
||||
body.pages ?? [],
|
||||
);
|
||||
const { Readable } = await import('stream');
|
||||
res.setHeader('Content-Type', 'application/pdf');
|
||||
res.setHeader('Content-Disposition', `attachment; filename="${encodeURIComponent(filename)}"`);
|
||||
res.setHeader(
|
||||
'Content-Disposition',
|
||||
`attachment; filename="${encodeURIComponent(filename)}"`,
|
||||
);
|
||||
return new StreamableFile(Readable.from(buffer));
|
||||
}
|
||||
|
||||
@@ -197,7 +254,8 @@ export class InboxController {
|
||||
@HttpCode(204)
|
||||
async sendEmail(
|
||||
@Param('id') id: string,
|
||||
@Body() body: {
|
||||
@Body()
|
||||
body: {
|
||||
to: string;
|
||||
subject: string;
|
||||
body: string;
|
||||
@@ -207,10 +265,12 @@ export class InboxController {
|
||||
},
|
||||
@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)
|
||||
: null;
|
||||
const preferredUsername: string | null =
|
||||
req.user?.preferredUsername ?? null;
|
||||
const smtpOverride =
|
||||
body.sender === 'user'
|
||||
? await this.userSettingsService.getSmtpConfig(req.user.userId)
|
||||
: null;
|
||||
await this.inboxService.sendAsEmail(id, preferredUsername, {
|
||||
...body,
|
||||
smtpOverride: smtpOverride ?? undefined,
|
||||
|
||||
Reference in New Issue
Block a user