45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Transactional.Abstractions;
|
|
|
|
namespace back.DataModels;
|
|
|
|
[Table("Galleries")]
|
|
public partial class Gallery: IEquatable<Gallery>, ISoftDeletable
|
|
{
|
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public string Id { get; set; } = null!;
|
|
[MaxLength(100)]
|
|
public string? Title { get; set; }
|
|
[MaxLength(500)]
|
|
public string? Description { get; set; }
|
|
public string? CreatedAt { get; set; }
|
|
public string? UpdatedAt { get; set; }
|
|
public string CreatedBy { get; set; } = null!;
|
|
public int? IsPublic { get; set; }
|
|
public int? IsArchived { get; set; }
|
|
public int? IsFavorite { get; set; }
|
|
public int IsDeleted { get; set; }
|
|
public string? DeletedAt { get; set; }
|
|
public string? EventId { get; set; }
|
|
public virtual User CreatedByNavigation { get; set; } = null!;
|
|
public virtual Event? Event { get; set; }
|
|
public virtual ICollection<Photo> Photos { get; set; } = [];
|
|
public virtual ICollection<Tag> Tags { get; set; } = [];
|
|
public virtual ICollection<User> Users { get; set; } = [];
|
|
|
|
public Gallery() { }
|
|
|
|
public override int GetHashCode() => HashCode.Combine(Id, Title);
|
|
|
|
public override bool Equals(object? obj) => obj is Gallery otherEvent && Equals(otherEvent);
|
|
|
|
public bool Equals(Gallery? other)
|
|
{
|
|
if (other is null) return false;
|
|
if (ReferenceEquals(this, other)) return true;
|
|
return
|
|
Id == other.Id || GetHashCode() == other.GetHashCode();
|
|
}
|
|
}
|