generated from cepdnaclk/eYY-XXX-project-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from wethmiranasinghe/main
Adding cover images to News and Events
- Loading branch information
Showing
10 changed files
with
473 additions
and
327 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
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
31 changes: 31 additions & 0 deletions
31
back-end/src/main/java/com/example/demo/news/NewsAndEventsResponse.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,31 @@ | ||
package com.example.demo.news; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.Base64; | ||
|
||
@Getter | ||
@Setter | ||
public class NewsAndEventsResponse { | ||
|
||
private Long newsID; | ||
private String newsTitle; | ||
private String newsDescription; | ||
private String newsUrl; | ||
private String newsAuthor; | ||
private String newsDate; | ||
private String newsCoverImage; // Base64 encoded image | ||
|
||
public NewsAndEventsResponse(NewsAndEvents newsAndEvents) { | ||
this.newsID = newsAndEvents.getNewsID(); | ||
this.newsTitle = newsAndEvents.getNewsTitle(); | ||
this.newsDescription = newsAndEvents.getNewsDescription(); | ||
this.newsUrl = newsAndEvents.getNewsUrl(); | ||
this.newsAuthor = newsAndEvents.getNewsAuthor(); | ||
this.newsDate = newsAndEvents.getNewsDate().toString(); | ||
|
||
// Convert image byte array to Base64 encoded string | ||
this.newsCoverImage = Base64.getEncoder().encodeToString(newsAndEvents.getNewsCoverImage()); | ||
} | ||
} |
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.