perf: share link

This commit is contained in:
archer
2023-07-28 09:38:50 +08:00
parent 36b234c4fd
commit f65a72821b
22 changed files with 171 additions and 40 deletions

View File

@@ -1,7 +1,8 @@
import { Schema, model, models, Model } from 'mongoose';
import { ShareChatSchema as ShareChatSchemaType } from '@/types/mongoSchema';
import { OutLinkSchema as SchmaType } from '@/types/mongoSchema';
import { OutLinkTypeEnum } from '@/constants/chat';
const ShareChatSchema = new Schema({
const OutLinkSchema = new Schema({
shareId: {
type: String,
required: true
@@ -16,6 +17,10 @@ const ShareChatSchema = new Schema({
ref: 'model',
required: true
},
type: {
type: String,
default: OutLinkTypeEnum.share
},
name: {
type: String,
required: true
@@ -29,5 +34,4 @@ const ShareChatSchema = new Schema({
}
});
export const ShareChat: Model<ShareChatSchemaType> =
models['shareChat'] || model('shareChat', ShareChatSchema);
export const OutLink: Model<SchmaType> = models['outlinks'] || model('outlinks', OutLinkSchema);