[backend/api] Add url & uri properties to NoteBase
This commit is contained in:
parent
259a21b273
commit
8606df89c0
2 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
|||
using Iceshrimp.Backend.Core.Configuration;
|
||||
using Iceshrimp.Shared.Schemas;
|
||||
using Iceshrimp.Backend.Core.Database;
|
||||
using Iceshrimp.Backend.Core.Database.Tables;
|
||||
|
@ -5,10 +6,16 @@ using Iceshrimp.Backend.Core.Extensions;
|
|||
using Iceshrimp.Backend.Core.Helpers;
|
||||
using Iceshrimp.Backend.Core.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Iceshrimp.Backend.Controllers.Renderers;
|
||||
|
||||
public class NoteRenderer(UserRenderer userRenderer, DatabaseContext db, EmojiService emojiSvc)
|
||||
public class NoteRenderer(
|
||||
UserRenderer userRenderer,
|
||||
DatabaseContext db,
|
||||
EmojiService emojiSvc,
|
||||
IOptions<Config.InstanceSection> config
|
||||
)
|
||||
{
|
||||
public async Task<NoteResponse> RenderOne(
|
||||
Note note, User? user, Filter.FilterContext? filterContext = null, NoteRendererDto? data = null
|
||||
|
@ -74,6 +81,8 @@ public class NoteRenderer(UserRenderer userRenderer, DatabaseContext db, EmojiSe
|
|||
{
|
||||
Id = note.Id,
|
||||
CreatedAt = note.CreatedAt.ToStringIso8601Like(),
|
||||
Uri = note.Uri ?? note.GetPublicUri(config.Value),
|
||||
Url = note.Url ?? note.Uri ?? note.GetPublicUri(config.Value),
|
||||
Text = note.Text,
|
||||
Cw = note.Cw,
|
||||
Visibility = (NoteVisibility)note.Visibility,
|
||||
|
|
|
@ -32,6 +32,8 @@ public class NoteBase
|
|||
{
|
||||
public required string Id { get; set; }
|
||||
public required string CreatedAt { get; set; }
|
||||
public required string Uri { get; set; }
|
||||
public required string Url { get; set; }
|
||||
public required string? Text { get; set; }
|
||||
public required string? Cw { get; set; }
|
||||
public required NoteVisibility Visibility { get; set; }
|
||||
|
|
Loading…
Add table
Reference in a new issue