Skip to content

Commit ec6cd04

Browse files
committed
RE1-T117 PR#394 adding feature toggle for chatbot twilio
1 parent 6440db9 commit ec6cd04

4 files changed

Lines changed: 433 additions & 14 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace Resgrid.Model
2+
{
3+
/// <summary>
4+
/// Well-known feature flag keys consumed by application code. Keys are matched case-insensitively by
5+
/// <see cref="Services.IFeatureToggleService"/>. When adding a key here, seed a matching flag row via a
6+
/// migration (see M0072) so the flag is immediately manageable from the admin UI/API.
7+
/// </summary>
8+
public static class FeatureFlagKeys
9+
{
10+
/// <summary>
11+
/// Routes inbound Twilio SMS through the new chatbot ingress pipeline. When off (globally or for a
12+
/// specific department) the original text-command handling in TwilioController is used instead.
13+
/// </summary>
14+
public const string ChatbotTwilioTextIntegration = "Chatbot.TwilioTextIntegration";
15+
}
16+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using FluentMigrator;
2+
3+
namespace Resgrid.Providers.Migrations.Migrations
4+
{
5+
[Migration(72)]
6+
public class M0072_AddingChatbotTwilioFeatureFlag : Migration
7+
{
8+
// Keep FlagKey in sync with Resgrid.Model.FeatureFlagKeys.ChatbotTwilioTextIntegration.
9+
private const string FlagKey = "Chatbot.TwilioTextIntegration";
10+
11+
public override void Up()
12+
{
13+
// Seeded OFF (IsEnabledGlobally = false). Inbound Twilio SMS keeps the original text-command
14+
// handling until this flag is enabled globally or via a per-department override. FlagType,
15+
// IsArchived, IsPermanent and CreatedOn fall back to their table defaults.
16+
Insert.IntoTable("FeatureFlags").Row(new
17+
{
18+
FlagKey = FlagKey,
19+
Name = "Chatbot Twilio Text Integration",
20+
Description = "When enabled, inbound Twilio SMS is processed by the new chatbot ingress pipeline. When off (globally or for a department) the original text-command handling is used.",
21+
Category = "Chatbot",
22+
IsEnabledGlobally = false
23+
});
24+
}
25+
26+
public override void Down()
27+
{
28+
Delete.FromTable("FeatureFlags").Row(new { FlagKey = FlagKey });
29+
}
30+
}
31+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using FluentMigrator;
2+
3+
namespace Resgrid.Providers.MigrationsPg.Migrations
4+
{
5+
[Migration(72)]
6+
public class M0072_AddingChatbotTwilioFeatureFlagPg : Migration
7+
{
8+
// Keep FlagKey in sync with Resgrid.Model.FeatureFlagKeys.ChatbotTwilioTextIntegration.
9+
private const string FlagKey = "Chatbot.TwilioTextIntegration";
10+
11+
public override void Up()
12+
{
13+
// Seeded OFF (isenabledglobally = false). Inbound Twilio SMS keeps the original text-command
14+
// handling until this flag is enabled globally or via a per-department override. flagtype,
15+
// isarchived, ispermanent and createdon fall back to their table defaults; the identity PK is
16+
// omitted so Postgres assigns it.
17+
Insert.IntoTable("FeatureFlags".ToLower()).Row(new
18+
{
19+
flagkey = FlagKey,
20+
name = "Chatbot Twilio Text Integration",
21+
description = "When enabled, inbound Twilio SMS is processed by the new chatbot ingress pipeline. When off (globally or for a department) the original text-command handling is used.",
22+
category = "Chatbot",
23+
isenabledglobally = false
24+
});
25+
}
26+
27+
public override void Down()
28+
{
29+
Delete.FromTable("FeatureFlags".ToLower()).Row(new { flagkey = FlagKey });
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)