DTO was updated to reflect author changes

This commit is contained in:
James Tombleson 2023-08-04 23:05:26 -07:00
parent 0d751cc571
commit 2aa14548aa
3 changed files with 16 additions and 11 deletions

View File

@ -19,8 +19,9 @@ public class ArticleDetailsDto
public string? AuthorImage { get; set; } public string? AuthorImage { get; set; }
public SourceDto? Source { get; set; } public SourceDto? Source { get; set; }
public AuthorEntity? Author { get; set; }
public static ArticleDetailsDto Convert(ArticlesEntity article, SourceEntity source) public static ArticleDetailsDto Convert(ArticlesEntity article, SourceEntity source, AuthorEntity? author)
{ {
return new ArticleDetailsDto return new ArticleDetailsDto
{ {
@ -34,9 +35,8 @@ public class ArticleDetailsDto
VideoWidth = article.VideoWidth, VideoWidth = article.VideoWidth,
Thumbnail = article.Thumbnail, Thumbnail = article.Thumbnail,
Description = article.Description, Description = article.Description,
AuthorName = article.AuthorName, Source = SourceDto.Convert(source),
AuthorImage = article.AuthorImage,
Source = SourceDto.Convert(source)
}; };
} }
} }

View File

@ -7,6 +7,7 @@ public class ArticleDto
{ {
public Guid ID { get; set; } public Guid ID { get; set; }
public Guid SourceID { get; set; } public Guid SourceID { get; set; }
public Guid AuthorId { get; set; }
public string[]? Tags { get; set; } public string[]? Tags { get; set; }
public string? Title { get; set; } public string? Title { get; set; }
public string? Url { get; set; } public string? Url { get; set; }
@ -16,8 +17,6 @@ public class ArticleDto
public int VideoWidth { get; set; } public int VideoWidth { get; set; }
public string? Thumbnail { get; set; } public string? Thumbnail { get; set; }
public string? Description { get; set; } public string? Description { get; set; }
public string? AuthorName { get; set; }
public string? AuthorImage { get; set; }
public static ArticleDto Convert(ArticlesModel article) public static ArticleDto Convert(ArticlesModel article)
{ {
return new ArticleDto return new ArticleDto
@ -33,8 +32,6 @@ public class ArticleDto
VideoWidth = article.VideoWidth, VideoWidth = article.VideoWidth,
Thumbnail = article.Thumbnail, Thumbnail = article.Thumbnail,
Description = article.Description, Description = article.Description,
AuthorName = article.AuthorName,
AuthorImage = article.AuthorImage,
}; };
} }
@ -44,6 +41,7 @@ public class ArticleDto
{ {
ID = article.Id, ID = article.Id,
SourceID = article.SourceId, SourceID = article.SourceId,
AuthorId = article.AuthorId,
Tags = article.Tags.Split(','), Tags = article.Tags.Split(','),
Title = article.Title, Title = article.Title,
Url = article.Url, Url = article.Url,
@ -52,9 +50,7 @@ public class ArticleDto
VideoHeight = article.VideoHeight, VideoHeight = article.VideoHeight,
VideoWidth = article.VideoWidth, VideoWidth = article.VideoWidth,
Thumbnail = article.Thumbnail, Thumbnail = article.Thumbnail,
Description = article.Description, Description = article.Description
AuthorName = article.AuthorName,
AuthorImage = article.AuthorImage,
}; };
} }
} }

View File

@ -0,0 +1,9 @@
namespace Newsbot.Collector.Domain.Dto;
public class AuthorDto
{
public Guid Id { get; set; }
public Guid SourceId { get; set; }
public string? Name { get; set; }
public string? Image { get; set; }
}