Skip to content

Commit 50e0d5f

Browse files
authored
Merge branch 'main' into v-next
2 parents 3ff0fcd + 55caf56 commit 50e0d5f

13 files changed

Lines changed: 29 additions & 12 deletions

doc/how-to-migrate-data.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# How to migrate your data
22

3+
34
The easiest way to migrate your data between account or from an ealier version of AzUrlShortener is to use the **Azure Storage Explorer** to export the data as a CSV files and use the TinyBlazorAdmin to import the files .
45

6+
57
Azure Storage Explorer is a free tool to manage your Azure cloud storage resources (aka your short URLs) from your desktop. It’s a cross-platform and can be downloaded [here](https://azure.microsoft.com/en-us/products/storage/storage-explorer/).
68

79
In the resources deployed to Azure there will be 2 storage accounts. One for the redirect service (azfunc-light) and one acting as the data store. That last one is the one you want to use for the data migration. The name of that storage account should start wirh `urldata`.
@@ -10,4 +12,5 @@ You need to expot to CSV the following tables:
1012
- UrlsDetails: This table contains the details of the short URLs, including the original URL, the short URL, schedules, etc.
1113
- ClickStats: This table contains the clicks informations.
1214

15+
1316
To import the data use the Import button in the Settings page.

src/Api/ShortenerEnpoints.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public static void MapShortenerEnpoints(this IEndpointRouteBuilder app)
4242
.WithDisplayName("Url Click Statistics By Day");
4343

4444
endpoints.MapPost("/UrlDataImport", UrlDataImport)
45-
.WithDescription("Import Urls from a CSV file")
46-
.WithDisplayName("Url Data Import");
45+
.WithDescription("Import Urls from a CSV file")
46+
.WithDisplayName("Url Data Import");
4747

48-
endpoints.MapPost("/UrlClickStatsImport", UrlClickStatsImport)
49-
.WithDescription("Import Click Statistics from a CSV file")
50-
.WithDisplayName("Url Click Statistics Import");
48+
endpoints.MapPost("/UrlClickStatsImport", UrlClickStatsImport)
49+
.WithDescription("Import Click Statistics from a CSV file")
50+
.WithDisplayName("Url Click Statistics Import");
5151

5252
}
5353

src/AppHost/appsettings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
"Parameters":{
1010
"CustomDomain": "https://c5m.ca",
1111
"DefaultRedirectUrl": "https://azure.com"
12+
1213
}
1314
}

src/AzUrlShortener.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
23
Microsoft Visual Studio Solution File, Format Version 12.00
34
# Visual Studio Version 17
45
VisualStudioVersion = 17.0.31903.59

src/Core/Cloud5mins.ShortenerTools.Core.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<PackageReference Include="Aspire.Azure.Data.Tables" Version="9.1.0" />
99
<PackageReference Include="cronos" Version="0.9.0" />
1010
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.3" />
11+
1112
<PackageReference Include="CsvHelper" Version="33.0.1" />
13+
1214
</ItemGroup>
1315
</Project>

src/Core/Domain/ShortUrlEntity.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Azure;
66
using Azure.Data.Tables;
77

8+
89
namespace Cloud5mins.ShortenerTools.Core.Domain
910
{
1011
public class ShortUrlEntity : ITableEntity
@@ -63,9 +64,11 @@ public List<Schedule> Schedules
6364
public string RowKey { get; set; }
6465
public DateTimeOffset? Timestamp { get; set; }
6566
public ETag ETag { get; set; }
67+
6668
public string CreatedDate { get; set; }
6769

6870

71+
6972
public ShortUrlEntity() { }
7073

7174
public ShortUrlEntity(string longUrl, string endUrl)
@@ -100,6 +103,7 @@ private void Initialize(string longUrl, string endUrl, string title, Schedule[]
100103
}
101104
}
102105

106+
103107
// public static ShortUrlEntity GetEntity(string longUrl, string endUrl, string title, Schedule[] schedules)
104108
// {
105109
// return new ShortUrlEntity
@@ -112,6 +116,7 @@ private void Initialize(string longUrl, string endUrl, string title, Schedule[]
112116
// };
113117
// }
114118

119+
115120
private string GetActiveUrl()
116121
{
117122
if (Schedules != null)

src/Core/Messages/ShortUrlRequest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Cloud5mins.ShortenerTools.Core.Domain;
22
using System.ComponentModel;
3+
34
using System.ComponentModel.DataAnnotations;
45

56
namespace Cloud5mins.ShortenerTools.Core.Messages

src/Core/Service/AzStrorageTablesService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Azure.Data.Tables;
33
using Cloud5mins.ShortenerTools.Core.Domain;
44
using System.Globalization;
5+
56
using System.Text.Json;
67

78
namespace Cloud5mins.ShortenerTools.Core.Service;
@@ -153,6 +154,7 @@ public async Task<ShortUrlEntity> ArchiveShortUrlEntity(ShortUrlEntity urlEntity
153154
}
154155

155156

157+
156158
public async Task<List<ClickStatsEntity>> GetAllStatsByVanity(string vanity, string startDate, string endDate)
157159
{
158160
var tblStats = GetStatsTable();
@@ -196,6 +198,7 @@ public async Task SaveClickStatsEntity(ClickStatsEntity newStats)
196198
var result = await GetStatsTable().UpsertEntityAsync(newStats);
197199
}
198200

201+
199202
public async Task ImportUrlDataAsync(UrlDetails urlData)
200203
{
201204
try

src/Core/Service/Utility.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
using Cloud5mins.ShortenerTools.Core.Domain;
23
using Cloud5mins.ShortenerTools.Core.Service;
34
using System.Security.Cryptography;

src/TinyBlazorAdmin/Components/Pages/Settings.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
@using Microsoft.FluentUI.AspNetCore.Components.Extensions
44
@using Cloud5mins.ShortenerTools.TinyBlazorAdmin.Components.Shared
5+
56
@inject ILogger<Settings> Logger
67

78
@rendermode InteractiveServer
@@ -31,6 +32,7 @@
3132
</FluentStack>
3233
</div>
3334

35+
3436
<div style="padding-top:30px;">
3537
<ImportData />
3638
</div>

0 commit comments

Comments
 (0)