Skip to content

Conversation

vas3a
Copy link
Collaborator

@vas3a vas3a commented Oct 10, 2025

image

@vas3a vas3a requested a review from kkartunov October 10, 2025 05:34
private readonly prisma: PrismaService,
private readonly scheduler: QueueSchedulerService,
private readonly giteaService: GiteaService,
private readonly eventBusService: EventBusService,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The EventBusService is added as a dependency but there is no indication in this diff how it is used. Ensure that it is utilized appropriately in the class to justify its inclusion.

await this.sendWorkflowRunCompletedNotification(aiWorkflowRun);
} catch (e) {
this.logger.log(
`Failed to send workflowRun compelted notification for aiWorkflowRun ${aiWorkflowRun.id}. Got error ${e.message ?? e}!`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the log message: 'compelted' should be 'completed'.


if (!submission) {
this.logger.log(
`Failed to send workflowRun compelted notification for aiWorkflowRun ${aiWorkflowRun.id}. Submission ${aiWorkflowRun.submissionId} is missing!`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the log message: 'compelted' should be 'completed'.


if (!challenge) {
this.logger.log(
`Failed to send workflowRun compelted notification for aiWorkflowRun ${aiWorkflowRun.id}. Challenge ${submission.challengeId} couldn't be fetched!`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the log message: 'compelted' should be 'completed'.


if (!user) {
this.logger.log(
`Failed to send workflowRun compelted notification for aiWorkflowRun ${aiWorkflowRun.id}. User ${submission.memberId} couldn't be fetched!`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the log message: 'compelted' should be 'completed'.

recipients: [user.email],
data: {
userName:
[user.firstName, user.lastName].filter(Boolean).join(' ') ??

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of filter(Boolean).join(' ') ?? user.handle is incorrect. The nullish coalescing operator ?? will not be reached because join(' ') will always return a string. Consider using a conditional check to handle cases where both firstName and lastName are undefined.

'd-7d14d986ba0a4317b449164b73939910',
},
ui: {
reviewUIUrl:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming reviewUIUrl to reviewUiUrl to maintain consistent camelCase naming convention.

recipients: [user.email],
data: {
userName:
[user.firstName, user.lastName].filter(Boolean).join(' ') ||

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the nullish coalescing operator (??) instead of the logical OR operator (||) for better handling of null or undefined values. The nullish coalescing operator will only fall back to user.handle if the result of the join operation is null or undefined, whereas the logical OR operator will also fall back if the result is an empty string.

Copy link
Contributor

@kkartunov kkartunov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the implementation to use M2M calls for data querying to respective APIs. There are respective methods already implemented in code base for that - use those. If something is missing, create it as M2M based solution.

return;
}

const [user] = await this.membersPrisma.$queryRaw<

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming membersPrisma to something more descriptive if it represents a specific database connection or context. This will improve code readability and maintainability.

@vas3a
Copy link
Collaborator Author

vas3a commented Oct 15, 2025

@kkartunov ok to merge this?

Copy link
Contributor

@kkartunov kkartunov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@vas3a vas3a merged commit 15210c2 into develop Oct 16, 2025
1 check passed
@vas3a vas3a deleted the PM-2222_send-airun-completed-notification branch October 16, 2025 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants