fix: CQ module output (#445)

This commit is contained in:
Archer
2023-10-30 16:45:36 +08:00
committed by GitHub
parent 60ee160131
commit 661ee79943
7 changed files with 72 additions and 6 deletions

View File

@@ -7,3 +7,24 @@ export const InformTypeMap = {
label: '系统通知'
}
};
export enum TeamMemberRoleEnum {
owner = 'owner',
admin = 'admin',
member = 'member',
visitor = 'visitor'
}
export const TeamMemberRoleMap = {
[TeamMemberRoleEnum.owner]: {
label: 'user.team.role.owner'
},
[TeamMemberRoleEnum.admin]: {
label: 'user.team.role.admin'
},
[TeamMemberRoleEnum.member]: {
label: 'user.team.role.member'
},
[TeamMemberRoleEnum.visitor]: {
label: 'user.team.role.visitor'
}
};

View File

@@ -0,0 +1,21 @@
export type CreateTeamProps = {
ownerId: string;
name: string;
avatar?: string;
};
export type UpdateTeamProps = {
id: string;
name?: string;
avatar?: string;
};
export type updateTeamBalanceProps = {
id: string;
balance: number;
};
export type CreateTeamMemberProps = {
ownerId: string;
teamId: string;
userId: string;
name?: string;
};

View File

@@ -1,4 +1,4 @@
import { InformTypeEnum } from './constant';
import { InformTypeEnum, TeamMemberRoleEnum } from './constant';
export type UserModelSchema = {
_id: string;
@@ -30,3 +30,19 @@ export type UserInformSchema = {
content: string;
read: boolean;
};
export type TeamSchema = {
_id: string;
name: string;
ownerId: string;
avatar: string;
createTime: Date;
};
export type TeamMemberSchema = {
_id: string;
name: string;
teamId: string;
userId: string;
role: `${TeamMemberRoleEnum}`;
};

View File

@@ -4,6 +4,8 @@ import { hashStr } from '@fastgpt/global/common/string/tools';
import { PRICE_SCALE } from '@fastgpt/global/common/bill/constants';
import type { UserModelSchema } from '@fastgpt/global/support/user/type';
export const userCollectionName = 'users';
const UserSchema = new Schema({
username: {
// 可以是手机/邮箱,新的验证都只用手机
@@ -60,4 +62,5 @@ const UserSchema = new Schema({
}
});
export const MongoUser: Model<UserModelSchema> = models['user'] || model('user', UserSchema);
export const MongoUser: Model<UserModelSchema> =
models[userCollectionName] || model(userCollectionName, UserSchema);