Files
mmorales.photo/back/DataModels/Event.cs
2025-08-24 14:18:20 +02:00

45 lines
1.5 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Transactional.Abstractions;
namespace back.DataModels;
[Table("Events")]
public partial class Event : ISoftDeletable, IEquatable<Event>
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; } = null!;
[Required, MaxLength(50)]
public string Title { get; set; } = null!;
[MaxLength(500)]
public string? Description { get; set; }
public string? Date { get; set; }
public string? Location { get; set; }
public string CreatedAt { get; set; } = null!;
public string UpdatedAt { get; set; } = null!;
public string? CreatedBy { get; set; }
public string? UpdatedBy { get; set; }
public int IsDeleted { get; set; }
public string? DeletedAt { get; set; }
public virtual ICollection<Gallery> Galleries { get; set; } = [];
public virtual ICollection<Photo> Photos { get; set; } = [];
public virtual ICollection<Tag> Tags { get; set; } = [];
public override int GetHashCode()
=> HashCode.Combine(Id, Title, Date, Location);
public override bool Equals(object? obj)
=> obj is Event otherEvent && Equals(otherEvent);
public bool Equals(Event? other)
{
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return
Id == other.Id
|| (Title == other.Title && Date == other.Date && Location == other.Location)
|| GetHashCode() == other.GetHashCode();
}
}