diff --git a/Data/ArchiveStatus.cs b/Data/ArchiveStatus.cs new file mode 100644 index 0000000..d710894 --- /dev/null +++ b/Data/ArchiveStatus.cs @@ -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; } +} diff --git a/Data/Comment.cs b/Data/Comment.cs new file mode 100644 index 0000000..dc44cc3 --- /dev/null +++ b/Data/Comment.cs @@ -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; } +} diff --git a/Data/Link.cs b/Data/Link.cs new file mode 100644 index 0000000..d8e06ea --- /dev/null +++ b/Data/Link.cs @@ -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; } +} diff --git a/Data/RedditContext.cs b/Data/RedditContext.cs new file mode 100644 index 0000000..d3f7830 --- /dev/null +++ b/Data/RedditContext.cs @@ -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 options) + : base(options) + { + } + + public virtual DbSet ArchiveStatuses { get; set; } + + public virtual DbSet Comments { get; set; } + + public virtual DbSet Links { get; set; } + + public virtual DbSet 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(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(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(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(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); +} diff --git a/Data/Subreddit.cs b/Data/Subreddit.cs new file mode 100644 index 0000000..1e5c015 --- /dev/null +++ b/Data/Subreddit.cs @@ -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!; +} diff --git a/Program.cs b/Program.cs index db6bc5c..2872cba 100644 --- a/Program.cs +++ b/Program.cs @@ -1,5 +1,5 @@ using System; -using OllamaSharp; +//using OllamaSharp; using System.Linq; using Microsoft.Extensions.Configuration; @@ -10,13 +10,14 @@ namespace SaltMiner { static void Main(string[] args) { + /* var configurationBuilder = new ConfigurationBuilder(); configurationBuilder.SetBasePath(System.IO.Directory.GetCurrentDirectory()); configurationBuilder.AddJsonFile(path: "appSettings.json", optional: false, reloadOnChange: true); var config = configurationBuilder.Build(); - + */ } } } \ No newline at end of file diff --git a/SaltMiner.csproj b/SaltMiner.csproj index 669869b..4f30583 100644 --- a/SaltMiner.csproj +++ b/SaltMiner.csproj @@ -8,9 +8,15 @@ - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +