Fixed something... It's 4:30 Idk...
This commit is contained in:
parent
a3d818a80a
commit
ce19f164dc
|
|
@ -18,7 +18,6 @@ public class Init : Migration
|
|||
.WithColumn("ModifiedAt").AsDateTime()
|
||||
.WithColumn("Signature").AsString().Nullable()
|
||||
.WithColumn("FullWidth").AsBoolean()
|
||||
.WithColumn("Deleted").AsBoolean()
|
||||
.WithColumn("Visible").AsBoolean();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ public static class DependencyInjection
|
|||
ModifiedAt = DateTime.UtcNow,
|
||||
SourceLocation = "welcome.md",
|
||||
ShowDetails = false,
|
||||
Deleted = false,
|
||||
Visible = false
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,6 +12,5 @@ public sealed class BlogMeta
|
|||
public DateTime ModifiedAt { get; init; }
|
||||
public string? Signature { get; init; }
|
||||
public bool FullWidth { get; init; } = false;
|
||||
public bool Deleted { get; init; } = false;
|
||||
public bool Visible { get; init; } = false;
|
||||
}
|
||||
|
|
@ -22,7 +22,6 @@ public sealed class BlogMetaRepository(SqliteConnectionFactory connectionFactory
|
|||
const string sql = """
|
||||
select * from Blogs
|
||||
where (slug = @slug or id = cast(@slug as integer))
|
||||
and deleted = 0
|
||||
and CreatedAt <= datetime('now')
|
||||
""";
|
||||
|
||||
|
|
@ -38,7 +37,6 @@ public sealed class BlogMetaRepository(SqliteConnectionFactory connectionFactory
|
|||
const string sql = """
|
||||
select * from Blogs
|
||||
where id = @id
|
||||
and deleted = 0
|
||||
""";
|
||||
|
||||
return await connection.QueryFirstOrDefaultAsync<BlogMeta>(sql, new { id });
|
||||
|
|
@ -47,8 +45,7 @@ public sealed class BlogMetaRepository(SqliteConnectionFactory connectionFactory
|
|||
public async Task<bool> Delete(int id)
|
||||
{
|
||||
const string sql = """
|
||||
update Blogs
|
||||
set Deleted = 1
|
||||
delete from Blogs
|
||||
where id = @id
|
||||
""";
|
||||
|
||||
|
|
@ -62,8 +59,8 @@ public sealed class BlogMetaRepository(SqliteConnectionFactory connectionFactory
|
|||
using var connection = connectionFactory.Create();
|
||||
|
||||
const string sql = """
|
||||
insert into Blogs (Title, SourceLocation, Slug, ShowDetails, ImageUrl, CreatedAt, ModifiedAt, Signature, FullWidth, Deleted, Visible)
|
||||
values (@Title, @SourceLocation, @Slug, @ShowDetails, @ImageUrl, @CreatedAt, @ModifiedAt, @Signature, @FullWidth, @Deleted, @Visible)
|
||||
insert into Blogs (Title, SourceLocation, Slug, ShowDetails, ImageUrl, CreatedAt, ModifiedAt, Signature, FullWidth, Visible)
|
||||
values (@Title, @SourceLocation, @Slug, @ShowDetails, @ImageUrl, @CreatedAt, @ModifiedAt, @Signature, @FullWidth, @Visible)
|
||||
returning *
|
||||
""";
|
||||
try
|
||||
|
|
@ -85,7 +82,7 @@ public sealed class BlogMetaRepository(SqliteConnectionFactory connectionFactory
|
|||
|
||||
const string sql = """
|
||||
update Blogs
|
||||
set Title = @Title, SourceLocation = @SourceLocation, Slug = @Slug, ShowDetails = @ShowDetails, ImageUrl = @ImageUrl, CreatedAt = @CreatedAt, ModifiedAt = @ModifiedAt, Signature = @Signature, FullWidth = @FullWidth, Deleted = @Deleted, Visible = @Visible
|
||||
set Title = @Title, SourceLocation = @SourceLocation, Slug = @Slug, ShowDetails = @ShowDetails, ImageUrl = @ImageUrl, CreatedAt = @CreatedAt, ModifiedAt = @ModifiedAt, Signature = @Signature, FullWidth = @FullWidth, Visible = @Visible
|
||||
where id = @Id
|
||||
returning *
|
||||
""";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
@using Ganss.Xss
|
||||
@using Markdig;
|
||||
@using Markdig.Extensions.AutoIdentifiers
|
||||
@using Pek.Markdig.HighlightJs
|
||||
@model FastBlog.Core.Models.Blogs.Blog
|
||||
|
||||
|
|
@ -9,10 +10,14 @@
|
|||
.UseSmartyPants()
|
||||
.UseEmojiAndSmiley()
|
||||
.UseAlertBlocks()
|
||||
.UseAdvancedExtensions()
|
||||
.UseHighlightJs();
|
||||
.UseAdvancedExtensions();
|
||||
|
||||
pipelineBuilder.Extensions.Remove(pipelineBuilder.Extensions.Find<AutoIdentifierExtension>()!);
|
||||
pipelineBuilder.UseAutoIdentifiers(AutoIdentifierOptions.GitHub);
|
||||
pipelineBuilder.UseHighlightJs();
|
||||
var sanitizer = new HtmlSanitizer();
|
||||
sanitizer.AllowedAttributes.Add("class");
|
||||
sanitizer.AllowedAttributes.Add("id");
|
||||
var pipeline = pipelineBuilder.Build();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue