Files
mmorales.photo/back/DataModels/Photo.cs
2025-08-25 18:52:59 +02:00

66 lines
2.3 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Transactional.Abstractions.Interfaces;
namespace back.DataModels;
[Table("Photos")]
public partial class Photo : IEntity<Photo>
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; } = null!;
[Required, MaxLength(100), MinLength(1)]
public string Title { get; set; } = null!;
[MaxLength(500)]
public string? Description { get; set; }
public string? Extension { get; set; }
public string? LowResUrl { get; set; }
public string? MidResUrl { get; set; }
public string? HighResUrl { get; set; }
public string? CreatedAt { get; set; }
public string? UpdatedAt { get; set; }
public string CreatedBy { get; set; } = null!;
public string? UpdatedBy { get; set; }
public string? EventId { get; set; }
public string? RankingId { get; set; }
public int? IsFavorite { get; set; }
public int? IsPublic { get; set; }
public int? IsArchived { get; set; }
public virtual Person CreatedByNavigation { get; set; } = null!;
public virtual Event? Event { get; set; }
public virtual ICollection<Gallery> Galleries { get; set; } = [];
public virtual ICollection<Person> People { get; set; } = [];
public virtual ICollection<Tag> Tags { get; set; } = [];
public virtual ICollection<User> Users { get; set; } = [];
public override int GetHashCode() => HashCode.Combine(Id, Title);
public override bool Equals(object? obj)
=> obj is Photo otherEvent && Equals(otherEvent);
public bool Equals(Photo? other)
{
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return
Id == other.Id || GetHashCode() == other.GetHashCode();
}
public bool IsNull => this is null;
public object Clone() => (Photo)MemberwiseClone();
public int CompareTo(object? obj)
{
if (obj is null) return 1;
if (obj is not Photo other) throw new ArgumentException("Object is not a Person");
return CompareTo(other);
}
public int CompareTo(Photo? other)
{
if (other is null) return 1;
if (ReferenceEquals(this, other)) return 0;
return string.Compare(Id, other.Id, StringComparison.OrdinalIgnoreCase);
}
}