UNPKG

mcp-talent-server

Version:

Model Context Protocol server for talent management tools

91 lines 2.47 kB
import mongoose, { Schema } from "mongoose"; const DocumentSchema = new Schema({ documentId: { type: String, required: true, unique: true, index: true, }, userId: { type: String, required: false, index: true, }, fileName: { type: String, required: true, }, filePath: { type: String, required: true, }, fileType: { type: String, required: true, enum: ["pdf", "docx", "txt", "sheets", "docs", "slides"], }, sourceType: { type: String, required: true, enum: ["google_drive", "google_sheets", "google_docs", "upload"], }, content: { type: String, required: true, }, metadata: { size: { type: Number }, createdAt: { type: Date }, mimeType: { type: String }, driveFileId: { type: String }, originalUrl: { type: String }, imageAnalysis: { textContent: { type: String }, labels: [{ type: String }], description: { type: String }, dimensions: { width: { type: Number }, height: { type: Number }, }, }, }, keywords: [{ type: String }], chunks: [{ chunkId: { type: String, required: true }, content: { type: String, required: true }, vectorId: { type: String, optional: true }, startIndex: { type: Number, required: true }, endIndex: { type: Number, required: true }, }], embedding: { vectorIds: [{ type: String }], indexName: { type: String }, }, status: { type: String, required: true, enum: ["processing", "completed", "failed"], default: "processing", }, error: { type: String, optional: true, }, }, { timestamps: true, }); // Indexes for efficient queries DocumentSchema.index({ userId: 1, createdAt: -1 }); DocumentSchema.index({ keywords: 1 }); DocumentSchema.index({ status: 1 }); DocumentSchema.index({ fileType: 1 }); DocumentSchema.index({ sourceType: 1 }); // Text search index for keywords and content DocumentSchema.index({ fileName: "text", content: "text", keywords: "text" }); export const DocumentModel = mongoose.model("Document", DocumentSchema); export default DocumentModel; //# sourceMappingURL=document.model.js.map