Files
FastGPT/packages/service/support/user/team/teamSchema.ts
Archer 56f6e69bc7 System inform (#2263)
* feat: Bind Notification Pipe (#2229)

* chore: account page add bind notification modal

* feat: timerlock schema and type

* feat(fe): bind notification method modal

* chore: fe adjust

* feat: clean useless code

* fix: cron lock

* chore: adjust the code

* chore: rename api

* chore: remove unused code

* chore: fe adjust

* perf: bind inform ux

* fix: time ts

* chore: notification (#2251)

* perf: send message code

* perf: sub schema index

* fix: timezone plugin

* fix: format

---------

Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
2024-08-05 00:29:14 +08:00

69 lines
1.4 KiB
TypeScript

import { connectionMongo, getMongoModel } from '../../../common/mongo';
const { Schema } = connectionMongo;
import { TeamSchema as TeamType } from '@fastgpt/global/support/user/team/type.d';
import { userCollectionName } from '../../user/schema';
import { TeamCollectionName } from '@fastgpt/global/support/user/team/constant';
import { TeamDefaultPermissionVal } from '@fastgpt/global/support/permission/user/constant';
const TeamSchema = new Schema({
name: {
type: String,
required: true
},
ownerId: {
type: Schema.Types.ObjectId,
ref: userCollectionName
},
defaultPermission: {
type: Number,
default: TeamDefaultPermissionVal
},
avatar: {
type: String,
default: '/icon/logo.svg'
},
createTime: {
type: Date,
default: () => Date.now()
},
balance: {
type: Number,
default: 0
},
teamDomain: {
type: String
},
limit: {
lastExportDatasetTime: {
type: Date
},
lastWebsiteSyncTime: {
type: Date
}
},
lafAccount: {
token: {
type: String
},
appid: {
type: String
},
pat: {
type: String
}
},
notificationAccount: {
type: String,
required: false
}
});
try {
TeamSchema.index({ name: 1 });
TeamSchema.index({ ownerId: 1 });
} catch (error) {
console.log(error);
}
export const MongoTeam = getMongoModel<TeamType>(TeamCollectionName, TeamSchema);