add shared

This commit is contained in:
Litlyx
2024-06-01 15:27:21 +02:00
parent 9caec3b92b
commit 75f0787c3b
23 changed files with 866 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { model, Schema } from 'mongoose';
export type TAiChatSchema = {
_id: Schema.Types.ObjectId,
project_id: Schema.Types.ObjectId,
messages: any[],
title: string,
created_at: Date,
updated_at: Date
}
const AiChatSchema = new Schema<TAiChatSchema>({
project_id: { type: Schema.Types.ObjectId, index: 1 },
messages: [{ _id: false, type: Schema.Types.Mixed }],
title: { type: String, required: true },
created_at: { type: Date, default: () => Date.now() },
updated_at: { type: Date, default: () => Date.now() },
});
export const AiChatModel = model<TAiChatSchema>('ai_chats', AiChatSchema);