Refactor the backend

This commit is contained in:
jiangrui
2025-03-11 00:06:10 +08:00
parent a78ea7e5bd
commit 615149c83f
22 changed files with 338 additions and 84 deletions

View File

@@ -3,7 +3,6 @@ import { injectable, inject } from "inversify";
import { TYPES } from "../core/types";
import { QuarkService } from "../services/QuarkService";
import { BaseController } from "./BaseController";
import { sendSuccess } from "../utils/response";
@injectable()
export class QuarkController extends BaseController {
@@ -15,11 +14,7 @@ export class QuarkController extends BaseController {
await this.handleRequest(req, res, async () => {
const { shareCode, receiveCode } = req.query;
await this.quarkService.setCookie(req);
const result = await this.quarkService.getShareInfo(
shareCode as string,
receiveCode as string
);
sendSuccess(res, result);
return await this.quarkService.getShareInfo(shareCode as string, receiveCode as string);
});
}
@@ -27,16 +22,14 @@ export class QuarkController extends BaseController {
await this.handleRequest(req, res, async () => {
const { parentCid } = req.query;
await this.quarkService.setCookie(req);
const result = await this.quarkService.getFolderList(parentCid as string);
sendSuccess(res, result);
return await this.quarkService.getFolderList(parentCid as string);
});
}
async saveFile(req: Request, res: Response): Promise<void> {
await this.handleRequest(req, res, async () => {
await this.quarkService.setCookie(req);
const result = await this.quarkService.saveSharedFile(req.body);
sendSuccess(res, result);
return await this.quarkService.saveSharedFile(req.body);
});
}
}