Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slack integration #9

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Slack integration #9

wants to merge 8 commits into from

Conversation

bartekczyz
Copy link
Contributor

No description provided.

@SimonB407
Copy link
Contributor

Run yarn lint because I can bet that there are some errors :)

src/config/slack.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,4 @@
export default {
apiToken: process.env.SLACK_API_TOKEN,
channel: process.env.SLACK_NOTIFICATIONS_CHANNEL,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
channel: process.env.SLACK_NOTIFICATIONS_CHANNEL,
channel: process.env.SLACK_NOTIFICATIONS_CHANNEL || '',

) {
}

@Post('/slack/to-users')
Copy link
Contributor

Choose a reason for hiding this comment

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

Post by default returns 201 Created. I am not sure that this should do this.
Maybe 204 is better?

}

@Post('/slack/to-channel')
public async sendNotificationToChannel(@Query('date') date: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Post by default returns 201 Created. I am not sure that this should do this.
Maybe 204 is better?

providers: [NotificationsService, SlackService],
})
export class NotificationsModule {
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be moved to the same line, but it's nothing special :)

@Post('/slack/to-channel')
public async sendNotificationToChannel(@Query('date') date: string) {
const lastWorkingDate = new Date(date); // todo get last working date
const users: UserWorklogResult[] = await this.aggregatorService.aggregate(lastWorkingDate);
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think, should we move worklogs aggregation to NotificationService? I think it's service work.

.map(result => [`:pisiorek: ${result.firstName} ${result.lastName}`])
.join('\n')}`;

return this.slackService.sendToChannel(message, 'worklog-monitor-int');
Copy link
Contributor

Choose a reason for hiding this comment

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

Hardcoded channel.

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