refactor: clean up unused variables in routes/ssh.ts
- Remove unused imports (NextFunction, jwt) - Remove 6 unused variables (result, updateResult, name x3) - All 8 no-unused-vars errors fixed
This commit is contained in:
@@ -9,8 +9,7 @@ import {
|
|||||||
fileManagerShortcuts,
|
fileManagerShortcuts,
|
||||||
} from "../db/schema.js";
|
} from "../db/schema.js";
|
||||||
import { eq, and, desc, isNotNull, or } from "drizzle-orm";
|
import { eq, and, desc, isNotNull, or } from "drizzle-orm";
|
||||||
import type { Request, Response, NextFunction } from "express";
|
import type { Request, Response } from "express";
|
||||||
import jwt from "jsonwebtoken";
|
|
||||||
import multer from "multer";
|
import multer from "multer";
|
||||||
import { sshLogger } from "../../utils/logger.js";
|
import { sshLogger } from "../../utils/logger.js";
|
||||||
import { SimpleDBOps } from "../../utils/simple-db-ops.js";
|
import { SimpleDBOps } from "../../utils/simple-db-ops.js";
|
||||||
@@ -816,7 +815,7 @@ router.delete(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = await db
|
await db
|
||||||
.delete(sshData)
|
.delete(sshData)
|
||||||
.where(and(eq(sshData.id, numericHostId), eq(sshData.userId, userId)));
|
.where(and(eq(sshData.id, numericHostId), eq(sshData.userId, userId)));
|
||||||
|
|
||||||
@@ -943,7 +942,7 @@ router.delete(
|
|||||||
authenticateJWT,
|
authenticateJWT,
|
||||||
async (req: Request, res: Response) => {
|
async (req: Request, res: Response) => {
|
||||||
const userId = (req as any).userId;
|
const userId = (req as any).userId;
|
||||||
const { hostId, path, name } = req.body;
|
const { hostId, path } = req.body;
|
||||||
|
|
||||||
if (!isNonEmptyString(userId) || !hostId || !path) {
|
if (!isNonEmptyString(userId) || !hostId || !path) {
|
||||||
sshLogger.warn("Invalid data for recent file deletion");
|
sshLogger.warn("Invalid data for recent file deletion");
|
||||||
@@ -1063,7 +1062,7 @@ router.delete(
|
|||||||
authenticateJWT,
|
authenticateJWT,
|
||||||
async (req: Request, res: Response) => {
|
async (req: Request, res: Response) => {
|
||||||
const userId = (req as any).userId;
|
const userId = (req as any).userId;
|
||||||
const { hostId, path, name } = req.body;
|
const { hostId, path } = req.body;
|
||||||
|
|
||||||
if (!isNonEmptyString(userId) || !hostId || !path) {
|
if (!isNonEmptyString(userId) || !hostId || !path) {
|
||||||
sshLogger.warn("Invalid data for pinned file deletion");
|
sshLogger.warn("Invalid data for pinned file deletion");
|
||||||
@@ -1183,7 +1182,7 @@ router.delete(
|
|||||||
authenticateJWT,
|
authenticateJWT,
|
||||||
async (req: Request, res: Response) => {
|
async (req: Request, res: Response) => {
|
||||||
const userId = (req as any).userId;
|
const userId = (req as any).userId;
|
||||||
const { hostId, path, name } = req.body;
|
const { hostId, path } = req.body;
|
||||||
|
|
||||||
if (!isNonEmptyString(userId) || !hostId || !path) {
|
if (!isNonEmptyString(userId) || !hostId || !path) {
|
||||||
sshLogger.warn("Invalid data for shortcut deletion");
|
sshLogger.warn("Invalid data for shortcut deletion");
|
||||||
@@ -1558,7 +1557,7 @@ router.post(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateResult = await db
|
await db
|
||||||
.update(sshData)
|
.update(sshData)
|
||||||
.set({
|
.set({
|
||||||
autostartPassword: decryptedConfig.password || null,
|
autostartPassword: decryptedConfig.password || null,
|
||||||
@@ -1615,7 +1614,7 @@ router.delete(
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await db
|
await db
|
||||||
.update(sshData)
|
.update(sshData)
|
||||||
.set({
|
.set({
|
||||||
autostartPassword: null,
|
autostartPassword: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user