Skip to content

Commit 2a6e075

Browse files
lvchknlvchkn
authored andcommitted
Fix duplication issues
1 parent 4f81a65 commit 2a6e075

5 files changed

Lines changed: 5 additions & 8 deletions

File tree

Application/Stories/StoriesService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ public async Task AddAsync(StoryDto storyDto)
2222
var story = storyDto.ToStory();
2323

2424
var textToAnalyze = $"{story.Title} {story.Text}";
25-
var tagDtos = await _tagsService.GetTagsForTextAsync(textToAnalyze);
26-
var tags = tagDtos.Select(dto => dto.ToTag()).ToList();
25+
var tags = await _tagsService.GetTagsForTextAsync(textToAnalyze);
2726

2827
if (tags.Count != 0)
2928
{

Application/Tags/ITagsService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using Application.Paging;
2+
using Domain.Entities;
23

34
namespace Application.Tags;
45

56
public interface ITagsService
67
{
78
Task<List<TagDto>> GetAllAsync();
89
Task<PagedTagsDto> GetPagedAsync(int pageNumber, int pageSize);
9-
Task<List<TagDto>> GetTagsForTextAsync(string text);
10+
Task<List<Tag>> GetTagsForTextAsync(string text);
1011
Task SeedAsync();
1112
}

Application/Tags/TagsSeeder.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ private static TagCategory CreateCloudPlatforms()
8585
new TagName("AWS", "Amazon Web Services"),
8686
new TagName("Azure", "Microsoft Azure"),
8787
new TagName("GCP", "Google Cloud Platform", "Google Cloud"),
88-
new TagName("Cloudflare"),
8988
new TagName("Digital Ocean", "DigitalOcean"),
90-
new TagName("Vercel"),
9189
new TagName("Netlify"),
9290
new TagName("Heroku"),
9391
new TagName("Linode"),

Application/Tags/TagsService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task<List<TagDto>> GetAllAsync()
2323
return tags.Select(t => t.ToTagDto()).ToList();
2424
}
2525

26-
public async Task<List<TagDto>> GetTagsForTextAsync(string text)
26+
public async Task<List<Tag>> GetTagsForTextAsync(string text)
2727
{
2828
if (string.IsNullOrWhiteSpace(text))
2929
{
@@ -51,7 +51,7 @@ public async Task<List<TagDto>> GetTagsForTextAsync(string text)
5151
}
5252
}
5353

54-
return matchedTags.Select(tag => tag.ToTagDto()).ToList();
54+
return matchedTags.ToList();
5555
}
5656

5757
private static bool IsWordMatch(string text, string keyword)

Infrastructure/Db/Repositories/TagsRepository.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public async Task<PagedTags> GetPagedAsync(int skip, int take)
2929
public async Task<List<Tag>> GetAllAsync()
3030
{
3131
var tags = await _dbContext.Tags
32-
.AsNoTracking()
3332
.Include(t => t.Aliases)
3433
.ToListAsync();
3534

0 commit comments

Comments
 (0)