Added Data

This commit is contained in:
2026-01-07 19:56:17 -05:00
parent 6a1fbeb409
commit 9114382318
7 changed files with 283 additions and 5 deletions

15
Data/ArchiveStatus.cs Normal file
View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace SaltMiner.Data;
public partial class ArchiveStatus
{
public int ArchiveStatusId { get; set; }
public string FileName { get; set; } = null!;
public string? CommentId { get; set; }
public string? LinkId { get; set; }
}

41
Data/Comment.cs Normal file
View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
namespace SaltMiner.Data;
public partial class Comment
{
public string CommentId { get; set; } = null!;
public DateTime Created { get; set; }
public string LinkId { get; set; } = null!;
public string SubredditId { get; set; } = null!;
public string? ParentId { get; set; }
public int? Upvotes { get; set; }
public int? Downvotes { get; set; }
public int? Score { get; set; }
public string Author { get; set; } = null!;
public string? AuthorFlairCssclass { get; set; }
public string? AuthorFlairText { get; set; }
public string? ApprovedBy { get; set; }
public string? Body { get; set; }
public string? Distinguished { get; set; }
public int? Controversiality { get; set; }
public int? Gilded { get; set; }
public DateTime? RetrievedOn { get; set; }
}

53
Data/Link.cs Normal file
View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
namespace SaltMiner.Data;
public partial class Link
{
public string LinkId { get; set; } = null!;
public DateTime Created { get; set; }
public string SubredditId { get; set; } = null!;
public int? Upvotes { get; set; }
public int? Downvotes { get; set; }
public int? Score { get; set; }
public string Author { get; set; } = null!;
public string? AuthorFlairCssclass { get; set; }
public string? AuthorFlairText { get; set; }
public string? Domain { get; set; }
public bool? IsSelfPost { get; set; }
public string? LinkFlairCssclass { get; set; }
public string? LinkFlairText { get; set; }
public bool? Locked { get; set; }
public int? CommentCount { get; set; }
public string? SelfText { get; set; }
public string? Thumbnail { get; set; }
public string? Title { get; set; }
public string? Url { get; set; }
public DateTime? Edited { get; set; }
public string? Distinguished { get; set; }
public bool? Stickied { get; set; }
public DateTime? RetrievedOn { get; set; }
}

151
Data/RedditContext.cs Normal file
View File

@@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace SaltMiner.Data;
public partial class RedditContext : DbContext
{
public RedditContext()
{
}
public RedditContext(DbContextOptions<RedditContext> options)
: base(options)
{
}
public virtual DbSet<ArchiveStatus> ArchiveStatuses { get; set; }
public virtual DbSet<Comment> Comments { get; set; }
public virtual DbSet<Link> Links { get; set; }
public virtual DbSet<Subreddit> Subreddits { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseSqlServer("Server=elysium.chrispr.lan;Database=Reddit;User Id=reddit;Password=reddit;TrustServerCertificate=True");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ArchiveStatus>(entity =>
{
entity.ToTable("ArchiveStatus");
entity.Property(e => e.ArchiveStatusId).HasColumnName("ArchiveStatusID");
entity.Property(e => e.CommentId)
.HasMaxLength(256)
.IsUnicode(false)
.HasColumnName("CommentID");
entity.Property(e => e.FileName)
.HasMaxLength(256)
.IsUnicode(false);
entity.Property(e => e.LinkId)
.HasMaxLength(256)
.IsUnicode(false)
.HasColumnName("LinkID");
});
modelBuilder.Entity<Comment>(entity =>
{
entity.HasKey(e => new { e.CommentId, e.Created });
entity.HasIndex(e => e.LinkId, "IX_Comments_LinkID");
entity.Property(e => e.CommentId)
.HasMaxLength(64)
.IsUnicode(false)
.HasColumnName("CommentID");
entity.Property(e => e.Created).HasColumnType("datetime");
entity.Property(e => e.ApprovedBy).HasMaxLength(64);
entity.Property(e => e.Author).HasMaxLength(64);
entity.Property(e => e.AuthorFlairCssclass)
.HasMaxLength(1024)
.IsUnicode(false)
.HasColumnName("AuthorFlairCSSClass");
entity.Property(e => e.AuthorFlairText)
.HasMaxLength(1024)
.IsUnicode(false);
entity.Property(e => e.Distinguished)
.HasMaxLength(64)
.IsUnicode(false);
entity.Property(e => e.LinkId)
.HasMaxLength(64)
.IsUnicode(false)
.HasColumnName("LinkID");
entity.Property(e => e.ParentId)
.HasMaxLength(64)
.IsUnicode(false)
.HasColumnName("ParentID");
entity.Property(e => e.RetrievedOn).HasColumnType("datetime");
entity.Property(e => e.SubredditId)
.HasMaxLength(64)
.IsUnicode(false)
.HasColumnName("SubredditID");
});
modelBuilder.Entity<Link>(entity =>
{
entity.HasKey(e => new { e.LinkId, e.Created });
entity.Property(e => e.LinkId)
.HasMaxLength(64)
.IsUnicode(false)
.HasColumnName("LinkID");
entity.Property(e => e.Created).HasColumnType("datetime");
entity.Property(e => e.Author).HasMaxLength(64);
entity.Property(e => e.AuthorFlairCssclass)
.HasMaxLength(1024)
.IsUnicode(false)
.HasColumnName("AuthorFlairCSSClass");
entity.Property(e => e.AuthorFlairText)
.HasMaxLength(1024)
.IsUnicode(false);
entity.Property(e => e.Distinguished)
.HasMaxLength(64)
.IsUnicode(false);
entity.Property(e => e.Domain)
.HasMaxLength(1024)
.IsUnicode(false);
entity.Property(e => e.Edited).HasColumnType("datetime");
entity.Property(e => e.LinkFlairCssclass)
.HasMaxLength(1024)
.IsUnicode(false)
.HasColumnName("LinkFlairCSSClass");
entity.Property(e => e.LinkFlairText)
.HasMaxLength(1024)
.IsUnicode(false);
entity.Property(e => e.RetrievedOn).HasColumnType("datetime");
entity.Property(e => e.SubredditId)
.HasMaxLength(64)
.IsUnicode(false)
.HasColumnName("SubredditID");
entity.Property(e => e.Thumbnail)
.HasMaxLength(1024)
.IsUnicode(false);
entity.Property(e => e.Title)
.HasMaxLength(1024)
.IsUnicode(false);
entity.Property(e => e.Url)
.HasMaxLength(4096)
.IsUnicode(false)
.HasColumnName("URL");
});
modelBuilder.Entity<Subreddit>(entity =>
{
entity.Property(e => e.SubredditId)
.HasMaxLength(64)
.IsUnicode(false)
.HasColumnName("SubredditID");
entity.Property(e => e.Name)
.HasMaxLength(256)
.IsUnicode(false);
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

11
Data/Subreddit.cs Normal file
View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
namespace SaltMiner.Data;
public partial class Subreddit
{
public string SubredditId { get; set; } = null!;
public string Name { get; set; } = null!;
}

View File

@@ -1,5 +1,5 @@
using System; using System;
using OllamaSharp; //using OllamaSharp;
using System.Linq; using System.Linq;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
@@ -10,13 +10,14 @@ namespace SaltMiner
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
/*
var configurationBuilder = new ConfigurationBuilder(); var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.SetBasePath(System.IO.Directory.GetCurrentDirectory()); configurationBuilder.SetBasePath(System.IO.Directory.GetCurrentDirectory());
configurationBuilder.AddJsonFile(path: "appSettings.json", optional: false, reloadOnChange: true); configurationBuilder.AddJsonFile(path: "appSettings.json", optional: false, reloadOnChange: true);
var config = configurationBuilder.Build(); var config = configurationBuilder.Build();
*/
} }
} }
} }

View File

@@ -8,9 +8,15 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.11">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.1" /> <PrivateAssets>all</PrivateAssets>
<PackageReference Include="OllamaSharp" Version="5.4.12" /> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup> </ItemGroup>
</Project> </Project>