feat: 数据集管理

This commit is contained in:
archer
2023-03-25 22:13:15 +08:00
parent 0cee404c7f
commit 02cee35a45
20 changed files with 285 additions and 86 deletions

View File

@@ -1,4 +1,5 @@
import { Schema, model, models } from 'mongoose';
import { Schema, model, models, Model } from 'mongoose';
import { AuthCodeSchema as AuthCodeType } from '@/types/mongoSchema';
const AuthCodeSchema = new Schema({
email: {
@@ -21,4 +22,5 @@ const AuthCodeSchema = new Schema({
}
});
export const AuthCode = models['auth_code'] || model('auth_code', AuthCodeSchema);
export const AuthCode: Model<AuthCodeType> =
models['auth_code'] || model('auth_code', AuthCodeSchema);

View File

@@ -1,5 +1,6 @@
import { Schema, model, models } from 'mongoose';
import { Schema, model, models, Model } from 'mongoose';
import { modelList } from '@/constants/model';
import { BillSchema as BillType } from '@/types/mongoSchema';
const BillSchema = new Schema({
userId: {
@@ -42,4 +43,4 @@ const BillSchema = new Schema({
}
});
export const Bill = models['bill'] || model('bill', BillSchema);
export const Bill: Model<BillType> = models['bill'] || model('bill', BillSchema);

View File

@@ -1,4 +1,5 @@
import { Schema, model, models } from 'mongoose';
import { Schema, model, models, Model } from 'mongoose';
import { ChatSchema as ChatType } from '@/types/mongoSchema';
const ChatSchema = new Schema({
userId: {
@@ -47,4 +48,4 @@ const ChatSchema = new Schema({
}
});
export const Chat = models['chat'] || model('chat', ChatSchema);
export const Chat: Model<ChatType> = models['chat'] || model('chat', ChatSchema);

View File

@@ -1,4 +1,5 @@
import { Schema, model, models } from 'mongoose';
import { Schema, model, models, Model } from 'mongoose';
import { DataItemSchema as Datatype } from '@/types/mongoSchema';
const DataSchema = new Schema({
userId: {
@@ -20,4 +21,4 @@ const DataSchema = new Schema({
}
});
export const Data = models['data'] || model('data', DataSchema);
export const Data: Model<Datatype> = models['data'] || model('data', DataSchema);

View File

@@ -1,4 +1,5 @@
import { Schema, model, models } from 'mongoose';
import type { DataItemSchema as DataItemType } from '@/types/mongoSchema';
import { Schema, model, models, Model } from 'mongoose';
const DataItemSchema = new Schema({
userId: {
@@ -45,4 +46,5 @@ const DataItemSchema = new Schema({
}
});
export const DataItem = models['dataItem'] || model('dataItem', DataItemSchema);
export const DataItem: Model<DataItemType> =
models['dataItem'] || model('dataItem', DataItemSchema);

View File

@@ -1,5 +1,5 @@
import { Schema, model, models } from 'mongoose';
import { Schema, model, models, Model as MongoModel } from 'mongoose';
import { ModelSchema as ModelType } from '@/types/mongoSchema';
const ModelSchema = new Schema({
userId: {
type: Schema.Types.ObjectId,
@@ -95,4 +95,4 @@ const ModelSchema = new Schema({
}
});
export const Model = models['model'] || model('model', ModelSchema);
export const Model: MongoModel<ModelType> = models['model'] || model('model', ModelSchema);

View File

@@ -1,5 +1,5 @@
import { Schema, model, models } from 'mongoose';
import { Schema, model, models, Model } from 'mongoose';
import { PaySchema as PayType } from '@/types/mongoSchema';
const PaySchema = new Schema({
userId: {
type: Schema.Types.ObjectId,
@@ -26,4 +26,4 @@ const PaySchema = new Schema({
}
});
export const Pay = models['pay'] || model('pay', PaySchema);
export const Pay: Model<PayType> = models['pay'] || model('pay', PaySchema);

View File

@@ -1,5 +1,5 @@
import { Schema, model, models } from 'mongoose';
import { Schema, model, models, Model } from 'mongoose';
import { TrainingSchema as TrainingType } from '@/types/mongoSchema';
const TrainingSChema = new Schema({
serviceName: {
// 模型厂商名
@@ -25,4 +25,5 @@ const TrainingSChema = new Schema({
}
});
export const Training = models['training'] || model('training', TrainingSChema);
export const Training: Model<TrainingType> =
models['training'] || model('training', TrainingSChema);

View File

@@ -1,7 +1,7 @@
import { Schema, model, models } from 'mongoose';
import { Schema, model, models, Model } from 'mongoose';
import { hashPassword } from '@/service/utils/tools';
import { PRICE_SCALE } from '@/constants/common';
import { UserModelSchema } from '@/types/mongoSchema';
const UserSchema = new Schema({
email: {
type: String,
@@ -38,4 +38,4 @@ const UserSchema = new Schema({
}
});
export const User = models['user'] || model('user', UserSchema);
export const User: Model<UserModelSchema> = models['user'] || model('user', UserSchema);