refactor: properly rename connections-related tables; top-level namespaces

This commit is contained in:
2024-12-26 13:49:26 +01:00
parent a1950b7586
commit feb47b1f8e
24 changed files with 967 additions and 495 deletions

View File

@@ -1,30 +0,0 @@
namespace ConnectionsAPI.Database.Entities
{
public class CategoriesCard
{
/// <summary>
/// Primary key of the entity
/// </summary>
public int Id { get; set; }
/// <summary>
/// The contents of this card (the word)
/// </summary>
public string Content { get; set; } = string.Empty;
/// <summary>
/// The initial position of this card on the grid
/// </summary>
public int Position { get; set; }
/// <summary>
/// The ID of the associated Connections category
/// </summary>
public int CategoriesCategoryId { get; set; }
/// <summary>
/// The associated category instance
/// </summary>
public virtual CategoriesCategory? Category { get; set; }
}
}

View File

@@ -1,35 +0,0 @@
namespace ConnectionsAPI.Database.Entities
{
public class CategoriesCategory
{
/// <summary>
/// Primary key of the entity
/// </summary>
public int Id { get; set; }
/// <summary>
/// The name of the category in this Connections puzzle
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// The color of the category in this Connections puzzle; Also used for sorting
/// </summary>
public CategoriesColor Color { get; set; }
/// <summary>
/// The ID of the associated Connections puzzle
/// </summary>
public int CategoriesPuzzleId { get; set; }
/// <summary>
/// The associated puzzle instance
/// </summary>
public virtual CategoriesPuzzle? CategoriesPuzzle { get; set; }
/// <summary>
/// The cards associated with this category
/// </summary>
public ICollection<CategoriesCard> CategoriesPuzzleCards { get; set; } = [];
}
}

View File

@@ -1,10 +0,0 @@
namespace ConnectionsAPI.Database.Entities
{
public enum CategoriesColor
{
Yellow = 1,
Green = 2,
Blue = 3,
Purple = 4,
}
}

View File

@@ -1,47 +0,0 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace ConnectionsAPI.Database.Entities
{
public class CategoriesPuzzle
{
/// <summary>
/// Primary key of the entity
/// </summary>
public int Id { get; set; }
/// <summary>
/// When the entity was created (is the sync date)
/// </summary>
public DateTime CreatedDate { get; set; }
/// <summary>
/// When the puzzle was "printed" online
/// </summary>
public string PrintDate { get; set; } = string.Empty;
/// <summary>
/// The name of the editor for the puzzle
/// </summary>
public string EditorName { get; set; } = string.Empty;
/// <summary>
/// The actual count of the puzzle
/// </summary>
public int Index { get; set; }
/// <summary>
/// The MD5 hash for the source content used to sync this puzzle
/// </summary>
public string ContentMD5 { get; set; } = string.Empty;
/// <summary>
/// The categories associated with this puzzle
/// </summary>
public virtual ICollection<CategoriesCategory> Categories { get; set; } = [];
[NotMapped]
public string? PrevPrintDate { get; set; }
[NotMapped]
public string? NextPrintDate { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
namespace ConnectionsAPI.Database.Entities;
public class ConnectionsCard
{
/// <summary>
/// Primary key of the entity
/// </summary>
public int Id { get; set; }
/// <summary>
/// The contents of this card (the word)
/// </summary>
public string Content { get; set; } = string.Empty;
/// <summary>
/// The initial position of this card on the grid
/// </summary>
public int Position { get; set; }
/// <summary>
/// The ID of the associated Connections category
/// </summary>
public int ConnectionsCategoryId { get; set; }
/// <summary>
/// The associated category instance
/// </summary>
public virtual ConnectionsCategory? Category { get; set; }
}

View File

@@ -0,0 +1,34 @@
namespace ConnectionsAPI.Database.Entities;
public class ConnectionsCategory
{
/// <summary>
/// Primary key of the entity
/// </summary>
public int Id { get; set; }
/// <summary>
/// The name of the category in this Connections puzzle
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// The color of the category in this Connections puzzle; Also used for sorting
/// </summary>
public ConnectionsColor Color { get; set; }
/// <summary>
/// The ID of the associated Connections puzzle
/// </summary>
public int ConnectionsPuzzleId { get; set; }
/// <summary>
/// The associated puzzle instance
/// </summary>
public virtual ConnectionsPuzzle? ConnectionsPuzzle { get; set; }
/// <summary>
/// The cards associated with this category
/// </summary>
public ICollection<ConnectionsCard> Cards { get; set; } = [];
}

View File

@@ -0,0 +1,10 @@
namespace ConnectionsAPI.Database.Entities;
public enum ConnectionsColor
{
Yellow = 1,
Green = 2,
Blue = 3,
Purple = 4,
}

View File

@@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace ConnectionsAPI.Database.Entities;
public class ConnectionsPuzzle
{
/// <summary>
/// Primary key of the entity
/// </summary>
public int Id { get; set; }
/// <summary>
/// When the entity was created (is the sync date)
/// </summary>
public DateTime CreatedDate { get; set; }
/// <summary>
/// When the puzzle was "printed" online
/// </summary>
public string PrintDate { get; set; } = string.Empty;
/// <summary>
/// The name of the editor for the puzzle
/// </summary>
public string EditorName { get; set; } = string.Empty;
/// <summary>
/// The actual count of the puzzle
/// </summary>
public int Index { get; set; }
/// <summary>
/// The MD5 hash for the source content used to sync this puzzle
/// </summary>
public string ContentMD5 { get; set; } = string.Empty;
/// <summary>
/// The categories associated with this puzzle
/// </summary>
public virtual ICollection<ConnectionsCategory> Categories { get; set; } = [];
[NotMapped]
public string? PrevPrintDate { get; set; }
[NotMapped]
public string? NextPrintDate { get; set; }
}