mirror of
https://github.com/labring/FastGPT.git
synced 2026-04-05 01:05:10 +08:00
myapps
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Model, Kb } from '../schema.js';
|
||||
import { App, Kb } from '../schema.js';
|
||||
import { auth } from './system.js';
|
||||
|
||||
export const useAppRoute = (app) => {
|
||||
@@ -17,7 +17,7 @@ export const useAppRoute = (app) => {
|
||||
...(id && { _id: id })
|
||||
};
|
||||
|
||||
const modelsRaw = await Model.find(where)
|
||||
const modelsRaw = await App.find(where)
|
||||
.skip(start)
|
||||
.limit(end - start)
|
||||
.sort({ [sort]: order, 'share.isShare': -1, 'share.collection': -1 });
|
||||
@@ -50,7 +50,7 @@ export const useAppRoute = (app) => {
|
||||
|
||||
models.push(orderedModel);
|
||||
}
|
||||
const totalCount = await Model.countDocuments(where);
|
||||
const totalCount = await App.countDocuments(where);
|
||||
res.header('Access-Control-Expose-Headers', 'X-Total-Count');
|
||||
res.header('X-Total-Count', totalCount);
|
||||
res.json(models);
|
||||
@@ -70,7 +70,7 @@ export const useAppRoute = (app) => {
|
||||
intro
|
||||
} = req.body;
|
||||
|
||||
await Model.findByIdAndUpdate(_id, {
|
||||
await App.findByIdAndUpdate(_id, {
|
||||
$set: {
|
||||
intro: intro,
|
||||
'share.topNum': Number(topNum),
|
||||
|
||||
@@ -56,7 +56,7 @@ const kbSchema = new mongoose.Schema({
|
||||
__v: Number
|
||||
});
|
||||
|
||||
const modelSchema = new mongoose.Schema({
|
||||
const appSchema = new mongoose.Schema({
|
||||
userId: mongoose.Schema.Types.ObjectId,
|
||||
name: String,
|
||||
avatar: String,
|
||||
@@ -104,7 +104,7 @@ const SystemSchema = new mongoose.Schema({
|
||||
}
|
||||
});
|
||||
|
||||
export const Model = mongoose.models['model'] || mongoose.model('model', modelSchema);
|
||||
export const App = mongoose.models['model'] || mongoose.model('model', appSchema);
|
||||
export const Kb = mongoose.models['kb'] || mongoose.model('kb', kbSchema);
|
||||
export const User = mongoose.models['user'] || mongoose.model('user', userSchema);
|
||||
export const Pay = mongoose.models['pay'] || mongoose.model('pay', paySchema);
|
||||
|
||||
Reference in New Issue
Block a user