Open RegiKein opened 11 months ago
As a user I want to read latest news of TAKT club So that to know about last updates of club life
TaktTusur.Media.Domain.News
Article
long Id
string Title
string Text
string TitlePictureUrl
DateTime CreatedAt
DateTime ModifiedAt
ExternalArticleLink? ExternalArticleLink
ExternalArticleLink
Article Article
ExternalSource ExternalSource
string? OriginalUrl
DateTime AccessDate
TaktTusur.Media.Domain.ExternalSource
ExternalSource
string URL
bool IsEnabled
SourceType SourceType
SourceType
SourceType.Undefined = 0
SourceType.VkGroup = 1
TaktTusur.Media.Infrastructure.MediaDatabase
MediaDatabaseContext
DbSet<Article> Articles
DbSet<ExternalArticleLink> ExternalArticleLinks
DbSet<ExternalSource> ExternalSources
OnModelCreating(...)
class ArticleEntityTypeConfiguration: IEntityTypeConfiguration<Article>
class ExternalArticleLinkEntityTypeConfiguration: IEntityTypeConfiguration<ExternalArticleLink>
class ExternalSourceEntityTypeConfiguration : IEntityTypeConfiguration<ExternalSource>
Configure
ConnectionString
docker-compose
NewsRepository
NewsReadService
TaktTusur.Media.BackgroundCrawler
appsettings.json
NewsCrawling
string ApiKey
UpdateIntervalInMinutes
NewsCrawlingDeepth
appconfig.json
Id
classDiagram class INewsRepository{ + GetAll() IQueryable~Article~ + GetById(id) ~Article~ } class NewsRepository class INewsReadService{ + GetPage(skip, take) PageModel~ShortArticleModel~ } class NewsReadService class PageModel~T~{ + Items List~T~ + TotalCount int + Skipped int } class ShortArticleModel class NewsController NewsRepository --|> INewsRepository INewsReadService --> PageModel INewsReadService --> ShortArticleModel INewsReadService ..> INewsRepository NewsReadService --|> INewsReadService NewsController ..> INewsReadService
We don't have to make any authorisation for this
Can be started after #6
API for latest news
As a user I want to read latest news of TAKT club So that to know about last updates of club life
Acceptance criteria
Stage one: Models
TaktTusur.Media.Domain.News
namespace containsArticle
class, it has:long Id
- unique identifier of articlestring Title
- the headline of articlestring Text
- article textstring TitlePictureUrl
- the URL of title picture, which will be shown after the titleDateTime CreatedAt
- date of creationDateTime ModifiedAt
- date of latest modificationExternalArticleLink? ExternalArticleLink
- if this article was imported from another source - the link to that, can be nullTaktTusur.Media.Domain.News
namespace containsExternalArticleLink
class, it has:Article Article
- the article, which was importedExternalSource ExternalSource
- external source(vk group, table, instagram etc.)string? OriginalUrl
- URL to original article(post at VK group), can be nullDateTime AccessDate
- date and time of access to the original url/original articleTaktTusur.Media.Domain.ExternalSource
namespace containsExternalSource
class, it has:long Id
- unique identifier of sourcestring Title
- name of sourcestring URL
- URL to accessbool IsEnabled
- enabled or disabledSourceType SourceType
- the type of external source(VK group, instagram etc.)TaktTusur.Media.Domain.ExternalSource
namespace containsSourceType
enum, it can be:SourceType.Undefined = 0
- undefined source typeSourceType.VkGroup = 1
- VK.com groupStage two: Database
TaktTusur.Media.Infrastructure.MediaDatabase
containsMediaDatabaseContext
DbSet<Article> Articles
DbSet<ExternalArticleLink> ExternalArticleLinks
DbSet<ExternalSource> ExternalSources
OnModelCreating(...)
method inMediaDatabaseContext
should execute Entity Type Configurations:class ArticleEntityTypeConfiguration: IEntityTypeConfiguration<Article>
- Article model mapping to SQLclass ExternalArticleLinkEntityTypeConfiguration: IEntityTypeConfiguration<ExternalArticleLink>
- ExternalArticleLink model mapping to SQLclass ExternalSourceEntityTypeConfiguration : IEntityTypeConfiguration<ExternalSource>
- ExternalSource model mapping to SQLConfigure
method, which describes the mapping from C# class to SQL following this rules EF Core | Microsoft LearnStage three: PgSQL
ConnectionString
propertydocker-compose
file, to make testing easierStage four: Services
NewsRepository
should provide access to Articles in DB using MediaDatabaseContextNewsReadService
provides a page model:NewsReadService
Stage five: Crawling
TaktTusur.Media.BackgroundCrawler
project is responsible for crawling and adding latest news from VK Group to the DBappsettings.json
ofTaktTusur.Media.BackgroundCrawler
hasNewsCrawling
section, which is arrayNewsCrawling
contains:long Id
- identifier of external sourcestring Title
- title of external sourcestring URL
- URL of external sourcebool IsEnabled
- external source should be parsed or noSourceType SourceType
- the source type of source(see p.4 of stage one)string ApiKey
- the API key to access to the sourceappsettings.json
ofTaktTusur.Media.BackgroundCrawler
hasUpdateIntervalInMinutes
parameter:appsettings.json
ofTaktTusur.Media.BackgroundCrawler
hasNewsCrawlingDeepth
parameter:appconfig.json
with DB:ExternalSource
object byId
in DBappsettings.json
appsettings.json
UpdateIntervalInMinutes
) updates for each source should be requested:NewsCrawlingDeepth
variable)TaktTusur.Media.BackgroundCrawler
->NewsCrawling
directoryTechnical details
Out of scope
We don't have to make any authorisation for this