-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
155 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
begin transaction; | ||
|
||
-- set migration version | ||
update migration_version set version='20240321-2301'; | ||
|
||
-- News brauchen auch einen Teaser | ||
alter table news_revisions add teaser varchar(512); | ||
alter table news_revisions add teaser_lang varchar(12) default 'german'; | ||
|
||
commit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
src/main/java/de/holarse/backend/db/datasets/CurrentArticle.java
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/main/java/de/holarse/backend/db/datasets/CurrentNews.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 7 additions & 10 deletions
17
src/main/java/de/holarse/backend/db/repositories/NewsRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
package de.holarse.backend.db.repositories; | ||
|
||
import de.holarse.backend.db.News; | ||
import de.holarse.backend.db.NewsRevision; | ||
import de.holarse.backend.db.datasets.CurrentArticle; | ||
import de.holarse.backend.db.datasets.CurrentNews; | ||
import de.holarse.backend.view.FrontpageItemView; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
|
||
@Repository | ||
public interface NewsRepository extends JpaRepository<News, Integer>, NodeAwareRepository { | ||
|
||
@Query(value = "SELECT e.nodeId as nodeId, rev.id as revisionId, rev.title as title, sl.name as slug from News e " + | ||
"INNER JOIN e.newsRevision as rev " + | ||
"INNER JOIN NodeStatus ns on ns.nodeId = e.nodeId " + | ||
"INNER JOIN NodeSlug sl on sl.nodeId = e.nodeId " + | ||
"WHERE ns.published and not ns.deleted and sl.id = (SELECT max(_sl.id) FROM NodeSlug _sl where _sl.nodeId = e.nodeId)") | ||
List<CurrentNews> listCurrent(final Pageable pageable); | ||
@Query(value = "SELECT nr.nodeId, sl.name as slug, 'news' as nodeType, nr.title as title, nr.teaser FROM News n " | ||
+ "JOIN n.newsRevision nr " | ||
+ "JOIN n.nodeStatus as ns " | ||
+ "JOIN n.nodeSlugz as sl " | ||
+ "WHERE ns.published and NOT ns.deleted and sl.id = (SELECT max(_sl.id) FROM NodeSlug _sl where _sl.nodeId = n.nodeId)") | ||
List<FrontpageItemView> findFrontpageItems(final Pageable pageable); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/de/holarse/backend/view/FrontpageItemView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package de.holarse.backend.view; | ||
|
||
import de.holarse.backend.types.NodeType; | ||
|
||
public interface FrontpageItemView { | ||
|
||
Integer getNodeId(); | ||
String getSlug(); | ||
NodeType getNodeType(); | ||
|
||
String getTitle(); | ||
|
||
String getTeaser(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.