unclear what this was, saving this so I can wipe the local version of this project
This commit is contained in:
@ -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<IActionResult> PostChannel([FromRoute] string channelid) {
|
||||
Console.WriteLine($"{DateTime.Now} == Channels POST -> {channelid}");
|
||||
|
@ -6,6 +6,7 @@ namespace YTManager
|
||||
{
|
||||
public DbSet<Models.Channel> Channels { get; set; }
|
||||
public DbSet<Models.Video> Videos { get; set; }
|
||||
public DbSet<Models.UserTag> Tags { get; set; }
|
||||
|
||||
public MediaDB(DbContextOptions<MediaDB> options) : base(options){ }
|
||||
|
||||
|
23
Models/UserTag.cs
Normal file
23
Models/UserTag.cs
Normal file
@ -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<Channel> Channels { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user