Skip to content

Commit 7ad2e77

Browse files
authored
allow user to create slack connect channel (#2122)
1 parent cc10e1f commit 7ad2e77

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

backend/controllers/billing.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func BillingStatusApi(c *gin.Context) {
4040
"remaining_free_projects": remainingFreeProjects,
4141
"monitored_projects_count": monitoredProjectsCount,
4242
"billable_projects_count": billableProjectsCount,
43+
"slack_connect_channel": org.SlackConnectChannelName,
4344
"monitored_projects_limit": models.MaxFreePlanProjectsPerOrg,
4445
})
4546
}

backend/controllers/orgs.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func UpdateOrgSettingsApi(c *gin.Context) {
6868
DriftWebhookUrl *string `json:"drift_webhook_url,omitempty"`
6969
BillingPlan *string `json:"billing_plan,omitempty"`
7070
BillingStripeSubscriptionId *string `json:"billing_stripe_subscription_id,omitempty"`
71+
SlackChannelName *string `json:"slack_channel_name,omitempty"`
7172
}
7273
err = json.NewDecoder(c.Request.Body).Decode(&reqBody)
7374
if err != nil {
@@ -96,6 +97,10 @@ func UpdateOrgSettingsApi(c *gin.Context) {
9697
org.BillingStripeSubscriptionId = *reqBody.BillingStripeSubscriptionId
9798
}
9899

100+
if reqBody.SlackChannelName != nil {
101+
org.SlackConnectChannelName = reqBody.SlackChannelName
102+
}
103+
99104
err = models.DB.GormDB.Save(&org).Error
100105
if err != nil {
101106
slog.Error("Error saving organisation", "organisationId", organisationId, "source", organisationSource, "error", err)

backend/migrations/20250907140955.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Modify "organisations" table
2+
ALTER TABLE "public"."organisations" ADD COLUMN "slack_connect_channel_name" text NULL;

backend/migrations/atlas.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
h1:scehEjCp4nRGl7111drKpd0hZ+ePO0DSLGy75uRXYd4=
1+
h1:h0zwfrohIp8FOBzTzA5mWwqH+PZ72EWauHYkxXMH+u8=
22
20231227132525.sql h1:43xn7XC0GoJsCnXIMczGXWis9d504FAWi4F1gViTIcw=
33
20240115170600.sql h1:IW8fF/8vc40+eWqP/xDK+R4K9jHJ9QBSGO6rN9LtfSA=
44
20240116123649.sql h1:R1JlUIgxxF6Cyob9HdtMqiKmx/BfnsctTl5rvOqssQw=
@@ -63,3 +63,4 @@ h1:scehEjCp4nRGl7111drKpd0hZ+ePO0DSLGy75uRXYd4=
6363
20250725041417.sql h1:Dds6fqS415FD1jlsoVEahcEEm1px3EHV5435moL+Vp8=
6464
20250730002811.sql h1:VqNDMnhVinkBXlDJN4BCq5JzZr4NHVu6zuHEGP9dMvk=
6565
20250812035039.sql h1:OLRqsoO26JjdOABsc+QauTWV0kUuZKkx6EOPUVgpBpw=
66+
20250907140955.sql h1:LHINhHgrPwM/Sy1UeIS4Z3iUVp6kv3/UtiGZZ5/SE8k=

backend/models/orgs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type Organisation struct {
2626
DriftCronTab string `gorm:"default:'0 0 * * *'"`
2727
BillingPlan BillingPlan `gorm:"default:'free'"`
2828
BillingStripeSubscriptionId string
29+
SlackConnectChannelName *string
2930
}
3031

3132
type Repo struct {

0 commit comments

Comments
 (0)