Feat: App folder and permission (#1726)

* app folder

* feat: app foldere

* fix: run app param error

* perf: select app ux

* perf: folder rerender

* fix: ts

* fix: parentId

* fix: permission

* perf: loading ux

* perf: per select ux

* perf: clb context

* perf: query extension tip

* fix: ts

* perf: app detail per

* perf: default per
This commit is contained in:
Archer
2024-06-11 10:16:24 +08:00
committed by GitHub
parent b20d075d35
commit bc6864c3dc
89 changed files with 2495 additions and 695 deletions

View File

@@ -1,4 +1,4 @@
import { AppTypeMap } from '@fastgpt/global/core/app/constants';
import { AppTypeEnum, AppTypeMap } from '@fastgpt/global/core/app/constants';
import { connectionMongo, type Model } from '../../common/mongo';
const { Schema, model, models } = connectionMongo;
import type { AppSchema as AppType } from '@fastgpt/global/core/app/type.d';
@@ -7,7 +7,7 @@ import {
TeamCollectionName,
TeamMemberCollectionName
} from '@fastgpt/global/support/user/team/constant';
import { AppDefaultPermission } from '@fastgpt/global/support/permission/app/constant';
import { AppDefaultPermissionVal } from '@fastgpt/global/support/permission/app/constant';
export const AppCollectionName = 'apps';
@@ -22,6 +22,11 @@ export const chatConfigType = {
};
const AppSchema = new Schema({
parentId: {
type: Schema.Types.ObjectId,
ref: AppCollectionName,
default: null
},
teamId: {
type: Schema.Types.ObjectId,
ref: TeamCollectionName,
@@ -38,8 +43,8 @@ const AppSchema = new Schema({
},
type: {
type: String,
default: 'advanced',
enum: Object.keys(AppTypeMap)
default: AppTypeEnum.advanced,
enum: Object.values(AppTypeEnum)
},
version: {
type: String,
@@ -104,13 +109,13 @@ const AppSchema = new Schema({
// the default permission of a app
defaultPermission: {
type: Number,
default: AppDefaultPermission
default: AppDefaultPermissionVal
}
});
try {
AppSchema.index({ updateTime: -1 });
AppSchema.index({ teamId: 1 });
AppSchema.index({ teamId: 1, type: 1 });
AppSchema.index({ scheduledTriggerConfig: 1, intervalNextTime: -1 });
} catch (error) {
console.log(error);