Skip to content

Commit 1df12d4

Browse files
authored
Merge pull request #739 from sparrowapp-dev/development
feat: admin app release
2 parents 1b74c2e + d93c968 commit 1df12d4

File tree

5 files changed

+27
-20
lines changed

5 files changed

+27
-20
lines changed

src/modules/identity/repositories/user.repository.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ export class UserRepository {
6666
{ _id },
6767
{ projection: { password: 0, verificationCode: 0, refresh_tokens: 0 } },
6868
);
69+
6970
const userObj: DecodedUserObject = {
70-
_id: data._id,
71-
email: data.email,
72-
name: data.name,
71+
_id: data?._id,
72+
email: data?.email,
73+
name: data?.name,
7374
role: "",
74-
teams: data.teams,
75-
workspaces: data.workspaces,
75+
teams: data?.teams,
76+
workspaces: data?.workspaces,
7677
emailVerificationCodeTimeStamp: data?.emailVerificationCodeTimeStamp,
7778
lastActive: data?.lastActive,
7879
};

src/modules/user-admin/services/user-admin.enterprise-user.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ export class AdminUsersService {
104104
users: team.users,
105105
};
106106
});
107-
return { teams: updatedFilteredTeams, users: newestUniqueUsers };
107+
return {
108+
teams: updatedFilteredTeams,
109+
users: newestUniqueUsers.filter((user) => !!user.email),
110+
};
108111
}
109112
async getUserDetails(
110113
ownerId: string,

src/modules/user-admin/services/user-admin.hubs.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class AdminHubsService {
3939
role: matchedUser?.role,
4040
users: team.users,
4141
workspaces: team.workspaces,
42+
plan: team?.plan?.name
4243
};
4344
});
4445
}

src/modules/user-admin/services/user-admin.workspace.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ export class AdminWorkspaceService {
346346
)?.name,
347347
WorkspaceType: workspace?.workspaceType,
348348
hubName: hub?.name,
349+
plan: hub?.plan?.name,
349350
nonWorkspaceHubMembers,
350351
};
351352
return workspace_summary;

src/modules/workspace/services/ai-assistant.service.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ export class AiAssistantService {
602602
console.error("OpenAI error:", error);
603603
Sentry.withScope((scope) => {
604604
scope.setTag("emailId", emailId);
605-
scope.setExtra("emailId", emailId);
605+
scope.setTag("errorType", "AI");
606606
Sentry.captureException(error.message);
607607
});
608608
client.send(
@@ -651,7 +651,7 @@ export class AiAssistantService {
651651
if (!this.deepseekClient) {
652652
Sentry.withScope((scope) => {
653653
scope.setTag("emailId", emailId);
654-
scope.setExtra("emailId", emailId);
654+
scope.setTag("errorType", "AI");
655655
Sentry.captureException("DeepSeek Initialization Failed.");
656656
});
657657
throw new InternalServerErrorException(
@@ -674,7 +674,7 @@ export class AiAssistantService {
674674
console.warn("Failed to parse conversation:", error);
675675
Sentry.withScope((scope) => {
676676
scope.setTag("emailId", emailId);
677-
scope.setExtra("emailId", emailId);
677+
scope.setTag("errorType", "AI");
678678
Sentry.captureException(error);
679679
});
680680
}
@@ -765,7 +765,7 @@ export class AiAssistantService {
765765
console.warn("Kafka logging failed", e);
766766
Sentry.withScope((scope) => {
767767
scope.setTag("emailId", emailId);
768-
scope.setExtra("emailId", emailId);
768+
scope.setTag("errorType", "AI");
769769
Sentry.captureException(e);
770770
});
771771
}
@@ -786,7 +786,7 @@ export class AiAssistantService {
786786
console.warn("Kafka logging failed", e);
787787
Sentry.withScope((scope) => {
788788
scope.setTag("emailId", emailId);
789-
scope.setExtra("emailId", emailId);
789+
scope.setTag("errorType", "AI");
790790
Sentry.captureException(e);
791791
});
792792
}
@@ -799,7 +799,7 @@ export class AiAssistantService {
799799
console.error("Invalid JSON in event data:", event.data, e);
800800
Sentry.withScope((scope) => {
801801
scope.setTag("emailId", emailId);
802-
scope.setExtra("emailId", emailId);
802+
scope.setTag("errorType", "AI");
803803
Sentry.captureException(e);
804804
});
805805
}
@@ -808,7 +808,7 @@ export class AiAssistantService {
808808
console.error("DeepSeek error:", error);
809809
Sentry.withScope((scope) => {
810810
scope.setTag("emailId", emailId);
811-
scope.setExtra("emailId", emailId);
811+
scope.setTag("errorType", "AI");
812812
Sentry.captureException(error);
813813
});
814814
client.send(
@@ -1119,7 +1119,7 @@ export class AiAssistantService {
11191119
const endTime = performance.now();
11201120
Sentry.withScope((scope) => {
11211121
scope.setTag("emailId", emailId);
1122-
scope.setExtra("emailId", emailId);
1122+
scope.setTag("errorType", "AI");
11231123
Sentry.captureException(error.message);
11241124
});
11251125
const timeTaken = Math.round(endTime - startTime);
@@ -1349,7 +1349,7 @@ export class AiAssistantService {
13491349
const endTime = performance.now();
13501350
Sentry.withScope((scope) => {
13511351
scope.setTag("emailId", emailId);
1352-
scope.setExtra("emailId", emailId);
1352+
scope.setTag("errorType", "AI");
13531353
Sentry.captureException(error.message);
13541354
});
13551355
const timeTaken = Math.round(endTime - startTime);
@@ -1540,7 +1540,7 @@ export class AiAssistantService {
15401540
const endTime = performance.now();
15411541
Sentry.withScope((scope) => {
15421542
scope.setTag("emailId", emailId);
1543-
scope.setExtra("emailId", emailId);
1543+
scope.setTag("errorType", "AI");
15441544
Sentry.captureException(error.message);
15451545
});
15461546
const timeTaken = Math.round(endTime - startTime);
@@ -1787,7 +1787,7 @@ export class AiAssistantService {
17871787
const endTime = performance.now();
17881788
Sentry.withScope((scope) => {
17891789
scope.setTag("emailId", emailId);
1790-
scope.setExtra("emailId", emailId);
1790+
scope.setTag("errorType", "AI");
17911791
Sentry.captureException(error.message);
17921792
});
17931793
const timeTaken = Math.round(endTime - startTime);
@@ -1830,7 +1830,7 @@ export class AiAssistantService {
18301830
} catch (err) {
18311831
Sentry.withScope((scope) => {
18321832
scope.setTag("emailId", parsedData.emailId);
1833-
scope.setExtra("emailId", parsedData.emailId);
1833+
scope.setTag("errorType", "AI");
18341834
Sentry.captureException(err);
18351835
});
18361836
client.send(
@@ -2042,7 +2042,8 @@ export class AiAssistantService {
20422042
}
20432043
} catch (error) {
20442044
console.error("Error in WebSocket loop:", error);
2045-
Sentry.withScope((scope) => {
2045+
Sentry.withScope((scope) => {
2046+
scope.setTag("errorType", "AI");
20462047
Sentry.captureException(error);
20472048
});
20482049
if (client.readyState === WebSocket.OPEN) {
@@ -2143,7 +2144,7 @@ export class AiAssistantService {
21432144
console.error("Error processing prompt generation:", error);
21442145
Sentry.withScope((scope) => {
21452146
scope.setTag("emailId", data.emailId);
2146-
scope.setExtra("emailId", data.emailId);
2147+
scope.setTag("errorType", "AI");
21472148
Sentry.captureException(error);
21482149
});
21492150
throw new BadRequestException(

0 commit comments

Comments
 (0)