Files
FastGPT/projects/app/src/pages/api/support/outLink/delete.ts
Finley Ge 747bb303ec chore: upgrade mongoose to v8.10.x for security (#3868)
* chore: upgrade mongoose to v8.10.x for security

* chore: remove duplicate code

* fix: ts error
2025-02-26 18:32:19 +08:00

24 lines
867 B
TypeScript

import { MongoOutLink } from '@fastgpt/service/support/outLink/schema';
import { authOutLinkCrud } from '@fastgpt/service/support/permission/publish/authLink';
import { OwnerPermissionVal } from '@fastgpt/global/support/permission/constant';
import type { ApiRequestProps } from '@fastgpt/service/type/next';
import { NextAPI } from '@/service/middleware/entry';
export type OutLinkDeleteQuery = {
id: string;
};
export type OutLinkDeleteBody = {};
export type OutLinkDeleteResponse = {};
/* delete a shareChat by shareChatId */
async function handler(
req: ApiRequestProps<OutLinkDeleteBody, OutLinkDeleteQuery>
): Promise<OutLinkDeleteResponse> {
const { id } = req.query;
await authOutLinkCrud({ req, outLinkId: id, authToken: true, per: OwnerPermissionVal });
await MongoOutLink.findByIdAndDelete(id);
return {};
}
export default NextAPI(handler);