perf: notify account (#3515)
This commit is contained in:
2
packages/global/support/user/team/type.d.ts
vendored
2
packages/global/support/user/team/type.d.ts
vendored
@@ -59,7 +59,7 @@ export type TeamTmbItemType = {
|
|||||||
teamName: string;
|
teamName: string;
|
||||||
memberName: string;
|
memberName: string;
|
||||||
avatar: string;
|
avatar: string;
|
||||||
balance: number;
|
balance?: number;
|
||||||
tmbId: string;
|
tmbId: string;
|
||||||
teamDomain: string;
|
teamDomain: string;
|
||||||
defaultTeam: boolean;
|
defaultTeam: boolean;
|
||||||
|
|||||||
@@ -80,13 +80,11 @@ export async function createDefaultTeam({
|
|||||||
userId,
|
userId,
|
||||||
teamName = 'My Team',
|
teamName = 'My Team',
|
||||||
avatar = '/icon/logo.svg',
|
avatar = '/icon/logo.svg',
|
||||||
balance,
|
|
||||||
session
|
session
|
||||||
}: {
|
}: {
|
||||||
userId: string;
|
userId: string;
|
||||||
teamName?: string;
|
teamName?: string;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
balance?: number;
|
|
||||||
session: ClientSession;
|
session: ClientSession;
|
||||||
}) {
|
}) {
|
||||||
// auth default team
|
// auth default team
|
||||||
@@ -103,7 +101,6 @@ export async function createDefaultTeam({
|
|||||||
ownerId: userId,
|
ownerId: userId,
|
||||||
name: teamName,
|
name: teamName,
|
||||||
avatar,
|
avatar,
|
||||||
balance,
|
|
||||||
createTime: new Date()
|
createTime: new Date()
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -140,11 +137,6 @@ export async function createDefaultTeam({
|
|||||||
return tmb;
|
return tmb;
|
||||||
} else {
|
} else {
|
||||||
console.log('default team exist', userId);
|
console.log('default team exist', userId);
|
||||||
await MongoTeam.findByIdAndUpdate(tmb.teamId, {
|
|
||||||
$set: {
|
|
||||||
...(balance !== undefined && { balance })
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ const TeamSchema = new Schema({
|
|||||||
type: Date,
|
type: Date,
|
||||||
default: () => Date.now()
|
default: () => Date.now()
|
||||||
},
|
},
|
||||||
balance: {
|
balance: Number,
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
teamDomain: {
|
teamDomain: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import {
|
|||||||
Link,
|
Link,
|
||||||
Progress,
|
Progress,
|
||||||
Grid,
|
Grid,
|
||||||
BoxProps,
|
BoxProps
|
||||||
FlexProps
|
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { UserUpdateParams } from '@/types/user';
|
import { UserUpdateParams } from '@/types/user';
|
||||||
|
|||||||
@@ -159,4 +159,4 @@ function OrgInfoModal({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default dynamic(() => Promise.resolve(OrgInfoModal), { ssr: false });
|
export default OrgInfoModal;
|
||||||
|
|||||||
@@ -194,4 +194,4 @@ function OrgMemberManageModal({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default dynamic(() => Promise.resolve(OrgMemberManageModal), { ssr: false });
|
export default OrgMemberManageModal;
|
||||||
|
|||||||
@@ -71,4 +71,4 @@ function OrgMoveModal({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default dynamic(() => Promise.resolve(OrgMoveModal), { ssr: false });
|
export default OrgMoveModal;
|
||||||
|
|||||||
@@ -30,15 +30,17 @@ import { TeamContext } from '../context';
|
|||||||
import { getOrgList } from '@/web/support/user/team/org/api';
|
import { getOrgList } from '@/web/support/user/team/org/api';
|
||||||
|
|
||||||
import IconButton from './IconButton';
|
import IconButton from './IconButton';
|
||||||
import OrgInfoModal, { defaultOrgForm, OrgFormType } from './OrgInfoModal';
|
import type { defaultOrgForm, OrgFormType } from './OrgInfoModal';
|
||||||
import OrgMemberManageModal from './OrgMemberManageModal';
|
|
||||||
|
|
||||||
import OrgMoveModal from './OrgMoveModal';
|
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||||
import Path from '@/components/common/folder/Path';
|
import Path from '@/components/common/folder/Path';
|
||||||
import { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
|
import { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
|
||||||
|
|
||||||
|
const OrgInfoModal = dynamic(() => import('./OrgInfoModal'));
|
||||||
|
const OrgMemberManageModal = dynamic(() => import('./OrgMemberManageModal'));
|
||||||
|
const OrgMoveModal = dynamic(() => import('./OrgMoveModal'));
|
||||||
|
|
||||||
function ActionButton({
|
function ActionButton({
|
||||||
icon,
|
icon,
|
||||||
text,
|
text,
|
||||||
@@ -68,7 +70,7 @@ function ActionButton({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function MemberTable() {
|
function OrgTable() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { userInfo, isTeamAdmin } = useUserStore();
|
const { userInfo, isTeamAdmin } = useUserStore();
|
||||||
|
|
||||||
@@ -340,4 +342,4 @@ function MemberTable() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default dynamic(() => Promise.resolve(MemberTable), { ssr: false });
|
export default OrgTable;
|
||||||
|
|||||||
@@ -22,13 +22,12 @@ import dynamic from 'next/dynamic';
|
|||||||
import TeamTagModal from '@/components/support/user/team/TeamTagModal';
|
import TeamTagModal from '@/components/support/user/team/TeamTagModal';
|
||||||
import MemberTable from './components/MemberTable';
|
import MemberTable from './components/MemberTable';
|
||||||
|
|
||||||
import OrgManage from './components/OrgManage/index';
|
|
||||||
|
|
||||||
const InviteModal = dynamic(() => import('./components/InviteModal'));
|
const InviteModal = dynamic(() => import('./components/InviteModal'));
|
||||||
const PermissionManage = dynamic(() => import('./components/PermissionManage/index'));
|
const PermissionManage = dynamic(() => import('./components/PermissionManage/index'));
|
||||||
const GroupManage = dynamic(() => import('./components/GroupManage/index'));
|
const GroupManage = dynamic(() => import('./components/GroupManage/index'));
|
||||||
const GroupInfoModal = dynamic(() => import('./components/GroupManage/GroupInfoModal'));
|
const GroupInfoModal = dynamic(() => import('./components/GroupManage/GroupInfoModal'));
|
||||||
const ManageGroupMemberModal = dynamic(() => import('./components/GroupManage/GroupManageMember'));
|
const ManageGroupMemberModal = dynamic(() => import('./components/GroupManage/GroupManageMember'));
|
||||||
|
const OrgManage = dynamic(() => import('./components/OrgManage/index'));
|
||||||
|
|
||||||
export enum TeamTabEnum {
|
export enum TeamTabEnum {
|
||||||
member = 'member',
|
member = 'member',
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export async function initRootUser(retry = 3): Promise<any> {
|
|||||||
rootId = _id;
|
rootId = _id;
|
||||||
}
|
}
|
||||||
// init root team
|
// init root team
|
||||||
await createDefaultTeam({ userId: rootId, balance: 9999 * PRICE_SCALE, session });
|
await createDefaultTeam({ userId: rootId, session });
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`root user init:`, {
|
console.log(`root user init:`, {
|
||||||
|
|||||||
Reference in New Issue
Block a user