Skip to content

Commit

Permalink
perf: notify account (#3515)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Jan 5, 2025
1 parent a90e9ad commit 8be59f3
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/global/support/user/team/type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export type TeamTmbItemType = {
teamName: string;
memberName: string;
avatar: string;
balance: number;
balance?: number;
tmbId: string;
teamDomain: string;
defaultTeam: boolean;
Expand Down
8 changes: 0 additions & 8 deletions packages/service/support/user/team/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,11 @@ export async function createDefaultTeam({
userId,
teamName = 'My Team',
avatar = '/icon/logo.svg',
balance,
session
}: {
userId: string;
teamName?: string;
avatar?: string;
balance?: number;
session: ClientSession;
}) {
// auth default team
Expand All @@ -103,7 +101,6 @@ export async function createDefaultTeam({
ownerId: userId,
name: teamName,
avatar,
balance,
createTime: new Date()
}
],
Expand Down Expand Up @@ -140,11 +137,6 @@ export async function createDefaultTeam({
return tmb;
} else {
console.log('default team exist', userId);
await MongoTeam.findByIdAndUpdate(tmb.teamId, {
$set: {
...(balance !== undefined && { balance })
}
});
}
}

Expand Down
5 changes: 1 addition & 4 deletions packages/service/support/user/team/teamSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ const TeamSchema = new Schema({
type: Date,
default: () => Date.now()
},
balance: {
type: Number,
default: 0
},
balance: Number,
teamDomain: {
type: String
},
Expand Down
3 changes: 1 addition & 2 deletions projects/app/src/pages/account/info/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import {
Link,
Progress,
Grid,
BoxProps,
FlexProps
BoxProps
} from '@chakra-ui/react';
import { useForm } from 'react-hook-form';
import { UserUpdateParams } from '@/types/user';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@ function OrgInfoModal({
);
}

export default dynamic(() => Promise.resolve(OrgInfoModal), { ssr: false });
export default OrgInfoModal;
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,4 @@ function OrgMemberManageModal({
);
}

export default dynamic(() => Promise.resolve(OrgMemberManageModal), { ssr: false });
export default OrgMemberManageModal;
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ function OrgMoveModal({
);
}

export default dynamic(() => Promise.resolve(OrgMoveModal), { ssr: false });
export default OrgMoveModal;
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ import { TeamContext } from '../context';
import { getOrgList } from '@/web/support/user/team/org/api';

import IconButton from './IconButton';
import OrgInfoModal, { defaultOrgForm, OrgFormType } from './OrgInfoModal';
import OrgMemberManageModal from './OrgMemberManageModal';
import type { defaultOrgForm, OrgFormType } from './OrgInfoModal';

import OrgMoveModal from './OrgMoveModal';
import dynamic from 'next/dynamic';
import MyBox from '@fastgpt/web/components/common/MyBox';
import Path from '@/components/common/folder/Path';
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({
icon,
text,
Expand Down Expand Up @@ -68,7 +70,7 @@ function ActionButton({
);
}

function MemberTable() {
function OrgTable() {
const { t } = useTranslation();
const { userInfo, isTeamAdmin } = useUserStore();

Expand Down Expand Up @@ -340,4 +342,4 @@ function MemberTable() {
);
}

export default dynamic(() => Promise.resolve(MemberTable), { ssr: false });
export default OrgTable;
3 changes: 1 addition & 2 deletions projects/app/src/pages/account/team/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ import dynamic from 'next/dynamic';
import TeamTagModal from '@/components/support/user/team/TeamTagModal';
import MemberTable from './components/MemberTable';

import OrgManage from './components/OrgManage/index';

const InviteModal = dynamic(() => import('./components/InviteModal'));
const PermissionManage = dynamic(() => import('./components/PermissionManage/index'));
const GroupManage = dynamic(() => import('./components/GroupManage/index'));
const GroupInfoModal = dynamic(() => import('./components/GroupManage/GroupInfoModal'));
const ManageGroupMemberModal = dynamic(() => import('./components/GroupManage/GroupManageMember'));
const OrgManage = dynamic(() => import('./components/OrgManage/index'));

export enum TeamTabEnum {
member = 'member',
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/service/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function initRootUser(retry = 3): Promise<any> {
rootId = _id;
}
// init root team
await createDefaultTeam({ userId: rootId, balance: 9999 * PRICE_SCALE, session });
await createDefaultTeam({ userId: rootId, session });
});

console.log(`root user init:`, {
Expand Down

0 comments on commit 8be59f3

Please sign in to comment.