mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-20 19:24:29 +00:00
19 lines
396 B
TypeScript
19 lines
396 B
TypeScript
import { MongoOpenApi } from './schema';
|
|
|
|
export async function updateApiKeyUsedTime(id: string) {
|
|
await MongoOpenApi.findByIdAndUpdate(id, {
|
|
lastUsedTime: new Date()
|
|
});
|
|
}
|
|
|
|
export async function updateApiKeyUsage({ apikey, usage }: { apikey: string; usage: number }) {
|
|
await MongoOpenApi.findOneAndUpdate(
|
|
{ apiKey: apikey },
|
|
{
|
|
$inc: {
|
|
usage
|
|
}
|
|
}
|
|
);
|
|
}
|