Skip to content

Commit

Permalink
Replace FlakeId and Ksuid with recently open sourced Tingle.Extension…
Browse files Browse the repository at this point in the history
…s.Primitives (#1027)
  • Loading branch information
mburumaxwell authored Mar 8, 2024
1 parent 2cc118b commit 925737c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion server/Tingle.Dependabot/AppSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Text.Json;
using Tingle.Dependabot.Models;
using Tingle.Dependabot.Workflow;
using Tingle.Extensions.Primitives;

namespace Tingle.Dependabot;

Expand Down Expand Up @@ -57,7 +58,7 @@ public static async Task SetupAsync(WebApplication app, CancellationToken cancel
{
project = new Models.Management.Project
{
Id = $"prj_{KSUID.Ksuid.Generate()}",
Id = $"prj_{Ksuid.Generate()}",
Created = DateTimeOffset.UtcNow,
Password = GeneratePassword(32),
Url = setup.Url.ToString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Tingle.Dependabot.Models.Management;
using Tingle.Dependabot.Workflow;
using Tingle.EventBus;
using Tingle.Extensions.Primitives;

namespace Tingle.Dependabot.Consumers;

Expand Down Expand Up @@ -74,7 +75,7 @@ public async Task ConsumeAsync(EventContext<TriggerUpdateJobsEvent> context, Can
{
// we use this to create azure resources which have name restrictions
// alphanumeric, starts with a letter, does not contain "--", up to 32 characters
Id = $"job-{FlakeId.Id.Create()}", // flake is 19 chars, total is 23 chars
Id = $"job-{SequenceNumber.Generate()}", // sequence number is 19 chars, total is 23 chars

Created = DateTimeOffset.UtcNow,
Status = UpdateJobStatus.Scheduled,
Expand Down
3 changes: 1 addition & 2 deletions server/Tingle.Dependabot/Tingle.Dependabot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
<PackageReference Include="Azure.Monitor.Query" Version="1.2.0" />
<PackageReference Include="Azure.ResourceManager.AppContainers" Version="1.1.1" />
<PackageReference Include="DistributedLock.FileSystem" Version="1.0.1" />
<PackageReference Include="FlakeId" Version="1.1.2" /> <!-- TODO: replace with Tingle.Extensions.Primitives -->
<PackageReference Include="Ksuid" Version="1.0.0" /> <!-- TODO: replace with Tingle.Extensions.Primitives -->
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.1" />
Expand All @@ -39,6 +37,7 @@
<PackageReference Include="Tingle.EventBus.Transports.Azure.ServiceBus" Version="0.21.1" />
<PackageReference Include="Tingle.EventBus.Transports.InMemory" Version="0.21.1" />
<PackageReference Include="Tingle.Extensions.DataAnnotations" Version="4.5.0" />
<PackageReference Include="Tingle.Extensions.Primitives" Version="4.6.0" />
<PackageReference Include="Tingle.Extensions.Serilog" Version="4.5.0" />
<PackageReference Include="Tingle.PeriodicTasks" Version="1.4.0" />
<PackageReference Include="YamlDotNet" Version="15.1.2" />
Expand Down
3 changes: 2 additions & 1 deletion server/Tingle.Dependabot/Workflow/Synchronizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Tingle.Dependabot.Models.Dependabot;
using Tingle.Dependabot.Models.Management;
using Tingle.EventBus;
using Tingle.Extensions.Primitives;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

Expand Down Expand Up @@ -181,7 +182,7 @@ internal async Task SynchronizeAsync(Project project,
{
repository = new Repository
{
Id = $"repo_{KSUID.Ksuid.Generate()}",
Id = $"repo_{Ksuid.Generate()}",
Created = DateTimeOffset.UtcNow,
ProjectId = project.Id,
ProviderId = providerInfo.Id,
Expand Down

0 comments on commit 925737c

Please sign in to comment.