Class NewsResolver
java.lang.Object
transmatter.platform.administration.news.resolver.NewsResolver
- All Implemented Interfaces:
graphql.kickstart.tools.GraphQLMutationResolver,graphql.kickstart.tools.GraphQLQueryResolver,graphql.kickstart.tools.GraphQLResolver<Void>
@Component
public class NewsResolver
extends Object
implements graphql.kickstart.tools.GraphQLQueryResolver, graphql.kickstart.tools.GraphQLMutationResolver
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) NewsServiceAn instance of NewsService used for calling method form NewsService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) NewsdeleteContent(String id) This method used to delete news by given specific id(package private) org.springframework.data.domain.Page<News>getAllContents(PageFilter filter) This method used to get all news from news database in pagination format by passing page filter as parameter(package private) org.springframework.data.domain.Page<News>getAllEmptyAltNews(PageFilter filter) this method used to get all news that had empty image alternate text in pagination format(package private) NewsgetContent(String id) This methods used to get specific news by given news id(package private) org.springframework.data.domain.Page<News>getNewsBySource(String source, PageFilter filter) this method used to get all news that match news source in pagination format(package private) org.springframework.data.domain.Page<News>searchNews(String title, PageFilter filter) this method used to get all news that contain query (title) and return it in pagination format(package private) NewsupdateImageContent(String id, List<Image> imageText) this method used to update images alternate text in specific news by given id
-
Field Details
-
newsService
An instance of NewsService used for calling method form NewsService
-
-
Constructor Details
-
NewsResolver
public NewsResolver()
-
-
Method Details
-
getContent
This methods used to get specific news by given news id- Parameters:
id- id of existed news in news database- Returns:
- specific news content
-
getAllContents
This method used to get all news from news database in pagination format by passing page filter as parameter- Parameters:
filter- a page filter that have attribute page number (page) and amount of element in a page (size)- Returns:
- list of news in pagination format
-
deleteContent
This method used to delete news by given specific id- Parameters:
id- id of specific news that aim to be delete- Returns:
- the news that deleted by this method
-
getAllEmptyAltNews
this method used to get all news that had empty image alternate text in pagination format- Parameters:
filter- a page filter that have attribute page number (page) and amount of element in a page (size)- Returns:
- list of news that had empty image alternate text in pagination format
-
updateImageContent
this method used to update images alternate text in specific news by given id- Parameters:
id- id of specific news that aim to be updatedimageText- list of image alternate text- Returns:
- the news that updated by this method
-
getNewsBySource
@Transactional org.springframework.data.domain.Page<News> getNewsBySource(String source, PageFilter filter) this method used to get all news that match news source in pagination format- Parameters:
source- source of news e.g. Thairath, Sanook, Dek-Dfilter- a page filter that have attribute page number (page) and amount of element in a page (size)- Returns:
- list of news that match by source in pagination format
-
searchNews
this method used to get all news that contain query (title) and return it in pagination format- Parameters:
title- query for news searchingfilter- a page filter that have attribute page number (page) and amount of element in a page (size)- Returns:
- list of news that contain a title in pagination format
-