- Removed auto-invoked syncIndexes() blocks from all 11 model files (api-client, api-client-log, csrf-token, drone-monitor, drone-registration, email-log, email-verification, ide-session, user, web-token, web-visit) — no longer needed - Fixed drone-session.test.ts by mocking ChatSession.updateOne(), VectorStoreService.ingestTurn(), and MessageQueue to prevent real DB connections during tests - Removed unused mongoose Types import from drone-session test - All 129 tests now pass across all packages
38 lines
934 B
TypeScript
38 lines
934 B
TypeScript
// src/models/api-client-log.ts
|
|
// Copyright (C) 2026 Robert Colbert <rob.colbert@openplatform.us>
|
|
// All Rights Reserved
|
|
|
|
import { Schema, model } from "mongoose";
|
|
|
|
import { IApiClient } from "./api-client.js";
|
|
import { GadgetId } from "@gadget/api";
|
|
import { nanoid } from "nanoid";
|
|
|
|
export interface IApiClientLog {
|
|
_id: GadgetId;
|
|
client: IApiClient | GadgetId;
|
|
createdAt: Date;
|
|
method: string;
|
|
url: string;
|
|
}
|
|
export const ApiClientLogSchema = new Schema<IApiClientLog>({
|
|
_id: { type: String, default: () => nanoid() },
|
|
client: { type: String, required: true, index: 1, ref: "ApiClient" },
|
|
createdAt: {
|
|
type: Date,
|
|
default: Date.now,
|
|
required: true,
|
|
index: -1,
|
|
expires: "30d",
|
|
},
|
|
method: { type: String, required: true },
|
|
url: { type: String, required: true },
|
|
});
|
|
|
|
export const ApiClientLog = model<IApiClientLog>(
|
|
"ApiClientLog",
|
|
ApiClientLogSchema,
|
|
);
|
|
export default ApiClientLog;
|
|
|