diff --git a/Controllers/Channels.cs b/Controllers/Channels.cs index ac8f802..7e1eb53 100644 --- a/Controllers/Channels.cs +++ b/Controllers/Channels.cs @@ -31,7 +31,7 @@ namespace YTManager.Controllers { private readonly MediaDB db; // Maximum number of channels to return per query. - private readonly int max_per_query = 10; + private readonly int max_per_query = 250; // Constructor to fetch the db context. public ChannelsController(MediaDB context) => db = context; @@ -45,6 +45,7 @@ namespace YTManager.Controllers { // Get all the relevant channels. var chanels = await db.Channels .Include(c => c.Videos) + .Include(c => c.UserTags) .OrderByDescending(i => i.AddedtoDB) .Take(max_per_query) .ToListAsync(); @@ -58,6 +59,7 @@ namespace YTManager.Controllers { return Ok(converted); } + // Adds a new channel. [HttpPost("{channelid}")] public async Task PostChannel([FromRoute] string channelid) { Console.WriteLine($"{DateTime.Now} == Channels POST -> {channelid}"); diff --git a/MediaDB.cs b/MediaDB.cs index 8af8844..b7f491d 100644 --- a/MediaDB.cs +++ b/MediaDB.cs @@ -6,6 +6,7 @@ namespace YTManager { public DbSet Channels { get; set; } public DbSet Videos { get; set; } + public DbSet Tags { get; set; } public MediaDB(DbContextOptions options) : base(options){ } diff --git a/Models/UserTag.cs b/Models/UserTag.cs new file mode 100644 index 0000000..056044d --- /dev/null +++ b/Models/UserTag.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace YTManager.Models { + public class UserTag { + // Uniquie ID for this media type + [Key] + public long PrimaryKey { get; set; } + + // Title of the media + [Required] + public string Title { get; set; } + + // Short description of the media + [Required] + public string Description { get; set; } + + // Channels which this tag represents. + [Required] + public List Channels { get; set; } + } +}