-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fc2e53
commit 0ea8c96
Showing
13 changed files
with
486 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-ef": { | ||
"version": "7.0.3", | ||
"commands": [ | ||
"dotnet-ef" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Security.Cryptography; | ||
|
||
namespace RoadCaptain.App.Web | ||
{ | ||
internal class HashUtilities | ||
{ | ||
public static string HashAsHexString(string input) | ||
{ | ||
if (string.IsNullOrEmpty(input)) | ||
{ | ||
throw new ArgumentException("Input was empty", nameof(input)); | ||
} | ||
|
||
var serializedBytes = System.Text.Encoding.UTF8.GetBytes(input); | ||
var hashBytes = SHA256.HashData(serializedBytes); | ||
|
||
return Convert.ToHexString(hashBytes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
src/RoadCaptain.App.Web/Migrations/20231210130249_InitialSchema.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
src/RoadCaptain.App.Web/Migrations/20231210130249_InitialSchema.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace RoadCaptain.App.Web.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class InitialSchema : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Users", | ||
columns: table => new | ||
{ | ||
Id = table.Column<long>(type: "INTEGER", nullable: false) | ||
.Annotation("Sqlite:Autoincrement", true), | ||
Name = table.Column<string>(type: "TEXT", nullable: false), | ||
ZwiftSubject = table.Column<string>(type: "TEXT", nullable: false), | ||
ZwiftProfileId = table.Column<string>(type: "TEXT", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Users", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "Routes", | ||
columns: table => new | ||
{ | ||
Id = table.Column<long>(type: "INTEGER", nullable: false) | ||
.Annotation("Sqlite:Autoincrement", true), | ||
UserId = table.Column<long>(type: "INTEGER", nullable: false), | ||
Name = table.Column<string>(type: "TEXT", nullable: true), | ||
ZwiftRouteName = table.Column<string>(type: "TEXT", nullable: true), | ||
Distance = table.Column<decimal>(type: "TEXT", nullable: false), | ||
Ascent = table.Column<decimal>(type: "TEXT", nullable: false), | ||
Descent = table.Column<decimal>(type: "TEXT", nullable: false), | ||
IsLoop = table.Column<bool>(type: "INTEGER", nullable: false), | ||
Serialized = table.Column<string>(type: "TEXT", nullable: false), | ||
World = table.Column<string>(type: "TEXT", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Routes", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_Routes_Users_UserId", | ||
column: x => x.UserId, | ||
principalTable: "Users", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Cascade); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Routes_UserId", | ||
table: "Routes", | ||
column: "UserId"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Routes"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "Users"); | ||
} | ||
} | ||
} |
Oops, something went wrong.