Skip to content

Commit

Permalink
fix: app version require tmbId
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Dec 27, 2024
1 parent 8d3655a commit 46cc1fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions projects/app/src/pages/api/admin/initv485.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ async function initHttp(teamId?: string): Promise<any> {
await MongoAppVersion.create(
[
{
tmbId: plugin.tmbId,
appId: newPluginId,
nodes: item.modules,
edges: item.edges
Expand Down Expand Up @@ -166,6 +167,7 @@ async function initPlugin(teamId?: string): Promise<any> {
await MongoAppVersion.create(
[
{
tmbId: plugin.tmbId,
appId: newPluginId,
nodes: plugin.modules,
edges: plugin.edges
Expand Down
10 changes: 6 additions & 4 deletions projects/app/src/pages/api/core/app/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ async function handler(req: ApiRequestProps<CreateAppBody>) {

// 上限校验
await checkTeamAppLimit(teamId);
const tmb = await MongoTeamMember.findById({ _id: tmbId });
const user = await MongoUser.findById({ _id: tmb?.userId });
const tmb = await MongoTeamMember.findById({ _id: tmbId }, 'userId').populate<{
user: { avatar: string; username: string };
}>('user', 'avatar username');

// 创建app
const appId = await onCreateApp({
Expand All @@ -59,8 +60,8 @@ async function handler(req: ApiRequestProps<CreateAppBody>) {
chatConfig,
teamId,
tmbId,
userAvatar: user?.avatar,
username: user?.username
userAvatar: tmb?.user?.avatar,
username: tmb?.user?.username
});

pushTrack.createApp({
Expand Down Expand Up @@ -132,6 +133,7 @@ export const onCreateApp = async ({
await MongoAppVersion.create(
[
{
tmbId,
appId,
nodes: modules,
edges,
Expand Down

0 comments on commit 46cc1fe

Please sign in to comment.