Files
mmorales.photo/back/DataModels/PhotoModel.cs
2025-08-15 20:03:07 +02:00

74 lines
2.2 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace back.DataModels;
[Table("Photos")]
public class PhotoModel
{
public PhotoModel() { }
[Key]
public string Id { get; set; }
[Required, MaxLength(100), MinLength(1)]
public string Title { get; set; }
[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 DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
public string CreatedBy { get; set; }
public string UpdatedBy { get; set; }
[ForeignKey("EventId")]
public EventModel? Event { get; set; } = null;
[ForeignKey("TagId")]
public List<TagModel> Tags { get; set; } = [];
[ForeignKey("RankingId")]
public RankingModel Ranking { get; set; } = new RankingModel(0);
public bool IsFavorite { get; set; } = false;
public bool IsPublic { get; set; } = true;
public bool IsArchived { get; set; } = false;
[ForeignKey("PersonId")]
public List<PersonModel>? Persons { get; set; }
public PhotoModel(
string id,
string title,
string description,
string lowResUrl,
string midResUrl,
string highResUrl,
DateTime createdAt,
DateTime updatedAt,
string createdBy,
string updatedBy,
EventModel? @event = null,
List<TagModel>? tags = null,
RankingModel? ranking = null,
bool isFavorite = false,
bool isPublic = true,
bool isArchived = false,
List<PersonModel>? persons = null)
{
Id = id;
Title = title;
Description = description;
LowResUrl = lowResUrl;
MidResUrl = midResUrl;
HighResUrl = highResUrl;
CreatedAt = createdAt;
UpdatedAt = updatedAt;
CreatedBy = createdBy;
UpdatedBy = updatedBy;
Event = @event ?? Event;
Tags = tags ?? Tags;
Ranking = ranking ?? Ranking;
IsFavorite = isFavorite;
IsPublic = isPublic;
IsArchived = isArchived;
Persons = persons ?? Persons;
}
}