refactor: extract Models and Data into MoneyMap.Core shared library
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace MoneyMap.Models;
|
||||
|
||||
public class Card
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Issuer { get; set; } = string.Empty; // e.g., VISA, MC, Discover
|
||||
|
||||
[Required]
|
||||
[MaxLength(4)]
|
||||
public string Last4 { get; set; } = string.Empty; // "1234"
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Owner { get; set; } = string.Empty;
|
||||
|
||||
// Link to the account this card draws from/pays to
|
||||
[ForeignKey(nameof(Account))]
|
||||
public int? AccountId { get; set; }
|
||||
public Account? Account { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public string? Nickname { get; set; } // Optional friendly name
|
||||
|
||||
public ICollection<Transaction> Transactions { get; set; } = new List<Transaction>();
|
||||
|
||||
[NotMapped]
|
||||
public string DisplayLabel => string.IsNullOrEmpty(Nickname)
|
||||
? $"{Issuer} {Last4}"
|
||||
: $"{Nickname} ({Issuer} {Last4})";
|
||||
}
|
||||
Reference in New Issue
Block a user