ImageInfo.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. namespace Jellyfin.Data.Entities
  5. {
  6. /// <summary>
  7. /// An entity representing an image.
  8. /// </summary>
  9. public class ImageInfo
  10. {
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="ImageInfo"/> class.
  13. /// </summary>
  14. /// <param name="path">The path.</param>
  15. public ImageInfo(string path)
  16. {
  17. Path = path;
  18. LastModified = DateTime.UtcNow;
  19. }
  20. /// <summary>
  21. /// Initializes a new instance of the <see cref="ImageInfo"/> class.
  22. /// </summary>
  23. /// <remarks>
  24. /// Default constructor. Protected due to required properties, but present because EF needs it.
  25. /// </remarks>
  26. protected ImageInfo()
  27. {
  28. }
  29. /// <summary>
  30. /// Gets or sets the id.
  31. /// </summary>
  32. /// <remarks>
  33. /// Identity, Indexed, Required.
  34. /// </remarks>
  35. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  36. public int Id { get; protected set; }
  37. /// <summary>
  38. /// Gets or sets the user id.
  39. /// </summary>
  40. public Guid? UserId { get; protected set; }
  41. /// <summary>
  42. /// Gets or sets the path of the image.
  43. /// </summary>
  44. /// <remarks>
  45. /// Required.
  46. /// </remarks>
  47. [Required]
  48. [MaxLength(512)]
  49. [StringLength(512)]
  50. public string Path { get; set; }
  51. /// <summary>
  52. /// Gets or sets the date last modified.
  53. /// </summary>
  54. /// <remarks>
  55. /// Required.
  56. /// </remarks>
  57. public DateTime LastModified { get; set; }
  58. }
  59. }