-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to person based database layout
Switch from saving the name of an order to saving the person that added the order Old orders are migrated and create one person per order.
- Loading branch information
Showing
12 changed files
with
543 additions
and
14 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
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
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,22 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace GroupOrder.Data; | ||
|
||
public class Person | ||
{ | ||
// The id is used to identify which person a given user can edit | ||
// therefore we will sign a cookie with the id | ||
public int Id { get; set; } | ||
|
||
// One person can only ever exist in exactly one Group | ||
[Required] | ||
public Group Group { get; set; } = null!; | ||
|
||
[Required] | ||
[StringLength(100, ErrorMessage = "Name can not exceed 100 characters.")] | ||
public string? Name { get; set; } | ||
|
||
// One Person can only ever have Orders from the correct group | ||
public ICollection<Order> Orders { get; } = new List<Order>(); | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.