mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-09 14:48:47 +08:00
22 lines
674 B
TypeScript
22 lines
674 B
TypeScript
import { Request, Response } from "express";
|
|
import Searcher from "../services/Searcher";
|
|
import { sendSuccess, sendError } from "../utils/response";
|
|
|
|
export const resourceController = {
|
|
async search(req: Request, res: Response): Promise<void> {
|
|
try {
|
|
const { keyword, channelId = "", lastMessageId = "" } = req.query; // Remove `: string` from here
|
|
const result = await Searcher.searchAll(
|
|
keyword as string,
|
|
channelId as string,
|
|
lastMessageId as string
|
|
);
|
|
sendSuccess(res, result);
|
|
} catch (error) {
|
|
sendError(res, {
|
|
message: (error as Error).message || "搜索资源失败",
|
|
});
|
|
}
|
|
},
|
|
};
|