Skip to content

Slack integration#9

Open
bartekczyz wants to merge 8 commits intomasterfrom
slack-integration
Open

Slack integration#9
bartekczyz wants to merge 8 commits intomasterfrom
slack-integration

Conversation

@bartekczyz
Copy link
Contributor

No description provided.

@SimonB407
Copy link
Contributor

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

@@ -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.

bartekczyz and others added 4 commits September 28, 2019 01:13
Co-Authored-By: SimonB407 <51948193+SimonB407@users.noreply.github.com>
# Conflicts:
#	.env.dist
#	package.json
#	src/app.module.ts
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