Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

961 B
Raw Blame
import { Schema } from 'mongoose';
import type { ISkillSyncCredentialDocument } from '~/types/skillSync';

const skillSyncCredentialSchema: Schema<ISkillSyncCredentialDocument> = new Schema(
  {
    provider: {
      type: String,
      enum: ['github'],
      required: true,
      index: true,
    },
    credentialKey: {
      type: String,
      required: true,
      maxlength: 64,
      match: /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/,
      index: true,
    },
    encryptedToken: {
      type: String,
      required: true,
      select: false,
    },
    tokenHash: {
      type: String,
      required: true,
      select: false,
    },
    createdBy: {
      type: Schema.Types.ObjectId,
      ref: 'User',
    },
    updatedBy: {
      type: Schema.Types.ObjectId,
      ref: 'User',
    },
  },
  {
    timestamps: true,
  },
);

skillSyncCredentialSchema.index({ provider: 1, credentialKey: 1 }, { unique: true });

export default skillSyncCredentialSchema;