Skip to content

Commit

Permalink
Merge pull request #1 from timia2109/epic/rewrite
Browse files Browse the repository at this point in the history
Epic/rewrite
  • Loading branch information
timia2109 authored Feb 15, 2024
2 parents 59e3502 + 46d12ea commit f990711
Show file tree
Hide file tree
Showing 60 changed files with 1,658 additions and 1,030 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ obj/
# End of https://www.toptal.com/developers/gitignore/api/dotnetcore

*.db*
appsettings.Local.json
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/DayFlags.Server/bin/Debug/net6.0/DayFlags.Server.dll",
"program": "${workspaceFolder}/DayFlags.Server/bin/Debug/net8.0/DayFlags.Server.dll",
"args": [],
"cwd": "${workspaceFolder}/DayFlags.Server",
"stopAtEntry": false,
Expand Down
3 changes: 2 additions & 1 deletion DayFlags.Core/DayFlags.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand All @@ -11,6 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="6.0.6" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
Expand Down
22 changes: 19 additions & 3 deletions DayFlags.Core/DayFlagsDb.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using DayFlags.Core.Models;
using Microsoft.EntityFrameworkCore;

namespace DayFlags;
namespace DayFlags.Core;

/// <summary>
/// Database Context
Expand All @@ -11,7 +11,23 @@ public class DayFlagsDb : DbContext

public DayFlagsDb(DbContextOptions options) : base(options) { }

public DbSet<DayEntry> DayEntries => Set<DayEntry>();
public DbSet<EntryType> EntryTypes => Set<EntryType>();
public DbSet<DayFlag> DayFlags => Set<DayFlag>();
public DbSet<FlagGroup> FlagGroups => Set<FlagGroup>();
public DbSet<FlagType> FlagTypes => Set<FlagType>();
public DbSet<Realm> Realms => Set<Realm>();

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);

modelBuilder.Entity<DayFlag>()
.HasIndex(e => e.Date);

modelBuilder.Entity<FlagGroup>()
.HasIndex(e => e.FlagGroupKey);

modelBuilder.Entity<FlagType>()
.HasIndex(e => e.FlagTypeKey);
}

}
16 changes: 0 additions & 16 deletions DayFlags.Core/EntryTypes/AEntryTypeProvider.cs

This file was deleted.

27 changes: 0 additions & 27 deletions DayFlags.Core/Enums/EntryTypeRequirement.cs

This file was deleted.

41 changes: 0 additions & 41 deletions DayFlags.Core/Exceptions/ARestException.cs

This file was deleted.

20 changes: 0 additions & 20 deletions DayFlags.Core/Exceptions/EntryTypeNotFoundException.cs

This file was deleted.

6 changes: 6 additions & 0 deletions DayFlags.Core/Exceptions/FlagGroupEntryExistException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace DayFlags.Core.Exceptions;

public class FlagGroupEntryExistException : Exception
{

}
52 changes: 0 additions & 52 deletions DayFlags.Core/MatchProvider/IMatchProvider.cs

This file was deleted.

65 changes: 0 additions & 65 deletions DayFlags.Core/Models/DayEntry.cs

This file was deleted.

38 changes: 38 additions & 0 deletions DayFlags.Core/Models/DayFlag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DayFlags.Core.Models;

/// <summary>
/// Represent a entry for a day
/// </summary>
public record DayFlag
{
[Key]
public Guid FlagId { get; init; } = Guid.NewGuid();

/// <summary>
/// Affected <see cref="FlagType"/>
/// </summary>
public required Guid FlagTypeId { get; init; }

/// <summary>
/// Relation to <see cref="FlagType"/>
/// </summary>
public FlagType? FlagType { get; set; }

/// <summary>
/// Affected Date
/// </summary>
public required DateOnly Date { get; init; }

/// <summary>
/// Creation Time
/// </summary>
public DateTime Created { get; init; } = DateTime.Now;

/// <summary>
/// Creator of entry
/// </summary>
public Guid? Creator { get; init; }
}
Loading

0 comments on commit f990711

Please sign in to comment.