diff options
| author | JPVenson <github@jpb.software> | 2025-02-20 09:55:02 +0000 |
|---|---|---|
| committer | JPVenson <github@jpb.software> | 2025-02-20 09:55:02 +0000 |
| commit | 44dfe554a894561d3878c8f204d989e4d5a72d72 (patch) | |
| tree | 50e68688e42e62933b0f956ec780984792a74857 /src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Chapter.cs | |
| parent | f07e1f4aaee9b61b07d1389107973ead146c639b (diff) | |
Moved Database projects under /src
removed old pgsql references
Diffstat (limited to 'src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Chapter.cs')
| -rw-r--r-- | src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Chapter.cs | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Chapter.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Chapter.cs new file mode 100644 index 000000000..f068338f9 --- /dev/null +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Chapter.cs @@ -0,0 +1,80 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Jellyfin.Data.Interfaces; + +namespace Jellyfin.Data.Entities.Libraries +{ + /// <summary> + /// An entity representing a chapter. + /// </summary> + public class Chapter : IHasConcurrencyToken + { + /// <summary> + /// Initializes a new instance of the <see cref="Chapter"/> class. + /// </summary> + /// <param name="language">ISO-639-3 3-character language codes.</param> + /// <param name="startTime">The start time for this chapter.</param> + public Chapter(string language, long startTime) + { + ArgumentException.ThrowIfNullOrEmpty(language); + + Language = language; + StartTime = startTime; + } + + /// <summary> + /// Gets the id. + /// </summary> + /// <remarks> + /// Identity, Indexed, Required. + /// </remarks> + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; private set; } + + /// <summary> + /// Gets or sets the name. + /// </summary> + /// <remarks> + /// Max length = 1024. + /// </remarks> + [MaxLength(1024)] + [StringLength(1024)] + public string? Name { get; set; } + + /// <summary> + /// Gets or sets the language. + /// </summary> + /// <remarks> + /// Required, Min length = 3, Max length = 3 + /// ISO-639-3 3-character language codes. + /// </remarks> + [MinLength(3)] + [MaxLength(3)] + [StringLength(3)] + public string Language { get; set; } + + /// <summary> + /// Gets or sets the start time. + /// </summary> + /// <remarks> + /// Required. + /// </remarks> + public long StartTime { get; set; } + + /// <summary> + /// Gets or sets the end time. + /// </summary> + public long? EndTime { get; set; } + + /// <inheritdoc /> + [ConcurrencyCheck] + public uint RowVersion { get; private set; } + + /// <inheritdoc /> + public void OnSavingChanges() + { + RowVersion++; + } + } +} |
