Interface InsightService
- All Known Implementing Classes:
InsightServiceMain
public interface InsightService
The
InsightService defines the business operations for the Insights section, providing
access to article data with locale-aware content resolution.-
Method Summary
Modifier and TypeMethodDescriptiongetArticleBySlug(String slug, Locale locale) Returns anArticleDTOidentified by its unique URL slug, with content resolved for the requested locale.getArticles(int page, org.springframework.data.domain.Pageable pageable, Locale locale) Returns anInsightPageDTOcontaining a paginated list of allarticles, ordered by published date descending.getArticlesByAthleteId(Long athleteId, org.springframework.data.domain.Pageable pageable, Locale locale) Returns anInsightPageDTOcontaining a paginated list ofarticlesauthored by the athlete with the given ID, with content resolved for the requested locale.getArticlesByEvent(Long eventId, org.springframework.data.domain.Pageable pageable, Locale locale) Returns anInsightPageDTOcontaining a paginated list ofarticlesassociated with the given event ID, with content resolved for the requested locale.getArticlesByIds(List<Long> ids, Locale locale) Returns a list ofarticlesfor the given IDs, preserving the order of the provided ID list.longgetArticlesCountByEvent(Long eventId) Returns the number ofarticlesrelated to the event with the given ID.
-
Method Details
-
getArticleBySlug
Returns anArticleDTOidentified by its unique URL slug, with content resolved for the requested locale.- Parameters:
slug- the unique URL slug of the articlelocale- the requested locale for content resolution- Returns:
- the
ArticleDTOwith locale-resolved content - Throws:
EnduranceTrioException- if no article with the given slug is found
-
getArticles
InsightPageDTO getArticles(int page, org.springframework.data.domain.Pageable pageable, Locale locale) Returns anInsightPageDTOcontaining a paginated list of allarticles, ordered by published date descending.- Parameters:
page- the 0-based page number, pre-clamped by the controllerpageable- the pagination information (page number, page size, etc.)locale- the requested locale for content resolution- Returns:
- an
InsightPageDTOwith the articles for the requested page and pagination metadata
-
getArticlesByIds
Returns a list ofarticlesfor the given IDs, preserving the order of the provided ID list. Articles that are not found or have no locale-resolved content are silently excluded.- Parameters:
ids- the list of article IDs to fetch, in the desired display orderlocale- the requested locale for content resolution- Returns:
- an ordered list of
articlesmatching the given IDs
-
getArticlesByAthleteId
InsightPageDTO getArticlesByAthleteId(Long athleteId, org.springframework.data.domain.Pageable pageable, Locale locale) Returns anInsightPageDTOcontaining a paginated list ofarticlesauthored by the athlete with the given ID, with content resolved for the requested locale.- Parameters:
athleteId- the ID of the athlete to filter articles bypageable- the pagination information (page number, page size, etc.)locale- the requested locale for content resolution- Returns:
- an
InsightPageDTOwith the articles authored by the given athlete and pagination metadata
-
getArticlesByEvent
InsightPageDTO getArticlesByEvent(Long eventId, org.springframework.data.domain.Pageable pageable, Locale locale) Returns anInsightPageDTOcontaining a paginated list ofarticlesassociated with the given event ID, with content resolved for the requested locale.- Parameters:
eventId- the ID of the event to filter articles bypageable- the pagination information (page number, page size, etc.)locale- the requested locale for content resolution- Returns:
- an
InsightPageDTOwith the articles linked to the given event and pagination metadata
-
getArticlesCountByEvent
Returns the number ofarticlesrelated to the event with the given ID.- Parameters:
eventId- the ID of the event to count articles for- Returns:
- the number of articles related to the given event (0 if none)
-