Skip to content

Commit

Permalink
mapping spacial article name - terms and policy
Browse files Browse the repository at this point in the history
  • Loading branch information
VillSource committed Mar 2, 2024
1 parent 0058bdb commit 05ecb2d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ protected override async Task<IResponseWrapper<ResponseType>> Execute(GetArticel
var col = res.Collections.Select(article => new GetArticelsQueryDto()
{
Id = Base64UrlEncoder.Encode(article.ID.ToByteArray()),
AuthorId = article.AuthorId,
AuthorId = article.AuthorId == "AAAAAAAAAECAAAAAAAAAAA"
? "TermsAndPolicy"
: article.AuthorId == "EREREREREUGREREREREREQ"
? "SupportedProgrammingLanguages"
: article.AuthorId,
Title = article.Title,
CoverImage = article.Cover,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Application.Common.Interfaces;
using Application.Common.Interfaces;
using Application.Common.models;
using Application.Common.Repositories;
using MediatR;
Expand All @@ -25,7 +25,12 @@ public GetArticleQueryHandler(IPostRepository repo)
public async Task<GetArticleQueryResponseType> Handle(
GetArticleQuery request, CancellationToken cancellationToken)
{
var result = _repo.FindById(request.ArticleId, request.sub);
var result = _repo.FindById(
request.ArticleId == "TermsAndPolicy"
? "AAAAAAAAAECAAAAAAAAAAA"
: request.ArticleId == "SupportedProgrammingLanguages"
? "EREREREREUGREREREREREQ"
: request.ArticleId, request.sub);

if (result.Exception is not null) return ResponseWrapper
.Error<GetArticleQueryResponse>(result.Exception, "Not Found.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ protected async override Task<IResponseWrapper<ResponseType>> Execute(GetTopArti
{
var a = _articlesNameRepository.Top(request.n)
.Select(i => new KeyValuePair<string, string>
(Base64UrlEncoder.Encode(i.Key.ToByteArray()), i.Value));
(Base64UrlEncoder.Encode(i.Key.ToByteArray()), i.Value))
.Select(i => new KeyValuePair<string, string>(
i.Key == "AAAAAAAAAECAAAAAAAAAAA"
? "TermsAndPolicy"
: i.Key == "EREREREREUGREREREREREQ"
? "SupportedProgrammingLanguages"
: i.Key, i.Value));
return Ok(a.ToList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ protected override async Task<IResponseWrapper<ResponseType>> Execute(SerchArtic
// maping model
var col = res.Collections.Select(article => new SerchArticelsQueryDto()
{
Id = Base64UrlEncoder.Encode(article.ID.ToByteArray()),
Id = Base64UrlEncoder.Encode(article.ID.ToByteArray()) == "AAAAAAAAAECAAAAAAAAAAA"
? "TermsAndPolicy"
: Base64UrlEncoder.Encode(article.ID.ToByteArray()) == "EREREREREUGREREREREREQ"
? "SupportedProgrammingLanguages"
: Base64UrlEncoder.Encode(article.ID.ToByteArray()),
AuthorId = article.AuthorId,
Title = article.Title,
Expand Down

0 comments on commit 05ecb2d

Please sign in to comment.