Skip to content

Commit

Permalink
Erstellt-Datum an Entwurf? gekoppelt
Browse files Browse the repository at this point in the history
  • Loading branch information
schipplock committed Jan 5, 2024
1 parent 82d3d13 commit 1905a51
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ FROM base

COPY docker/entrypoint.sh /bin/entrypoint.sh
COPY docker/postgresql-42.7.1.jar $JBOSS_HOME/standalone/deployments/postgresql-driver.jar
COPY --from=build-war /src/target/tilstory-0.0.6.war $JBOSS_HOME/standalone/deployments/tilstory.war
COPY --from=build-war /src/target/tilstory-0.0.7.war $JBOSS_HOME/standalone/deployments/tilstory.war
COPY docker/standalone.xml $JBOSS_HOME/standalone/configuration/standalone.xml
COPY docker/application.keystore $JBOSS_HOME/standalone/configuration/application.keystore

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Meine Blogsoftware. TIL = Today I learned.
## Das Image bauen

```bash
docker build --network=host --force-rm -t ghcr.io/schipplock/tilstory:v0.0.6 .
docker build --network=host --force-rm -t ghcr.io/schipplock/tilstory:v0.0.7 .
```
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ services:
- flywaydb

tilstory-app:
image: ghcr.io/schipplock/tilstory:v0.0.6
image: ghcr.io/schipplock/tilstory:v0.0.7
container_name: tilstory-app
networks:
local-net:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
<groupId>de.schipplock.web</groupId>
<artifactId>tilstory</artifactId>
<packaging>war</packaging>
<version>0.0.6</version>
<version>0.0.7</version>
<name>TILstory</name>
<description>Today I learned - blogging tool</description>
<url>https://github.com/schipplock/tilstory</url>
Expand Down
1 change: 1 addition & 0 deletions sql-migrations/V3__drop-default-creationdate.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE public.posts ALTER COLUMN created DROP DEFAULT;
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public Post createPost(String subject, String body, boolean isDraft, Collection<
Post post = new Post(uuid, subject, body, isDraft);
post.setFileUploads(handleFileUploads(post, fileParts));
post.setFileUploads(deleteSelectedFilesForPost(post, fileNamesForDeletion));

if (!isDraft) {
post.setCreated(LocalDateTime.now());
}

return em.merge(post);
}

Expand All @@ -41,10 +46,17 @@ public Post updatePost(long postId, String subject, String body, boolean isDraft
post.setSubject(subject);
post.setBody(body);
post.setDraft(isDraft);
post.setUpdated(LocalDateTime.now());
post.setFileUploads(handleFileUploads(post, fileParts));
post.setFileUploads(deleteSelectedFilesForPost(post, fileNamesForDeletion));

if (!isDraft) {
post.setUpdated(LocalDateTime.now());
if (post.getCreated() == null) {
post.setCreated(LocalDateTime.now());
post.setUpdated(null);
}
}

return em.merge(post);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class Post {

private boolean draft;

private LocalDateTime created;

private LocalDateTime updated;

@OneToMany(cascade = CascadeType.ALL, mappedBy = "post", orphanRemoval = true)
Expand Down Expand Up @@ -87,6 +89,14 @@ public void setFileUploads(List<FileUpload> fileUploads) {
this.fileUploads = fileUploads;
}

public LocalDateTime getCreated() {
return created;
}

public void setCreated(LocalDateTime created) {
this.created = created;
}

public LocalDateTime getUpdated() {
return updated;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/includes/admin/header.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<h1># <a href="${pageContext.request.contextPath}/">${settings:name()}</a></h1>
<h2>Kurze Texte von ${settings:author()}</h2>
<h3>
<a href="https://github.com/schipplock/tilstory" target="_blank">TILStory 0.0.6</a> |
<a href="https://github.com/schipplock/tilstory" target="_blank">TILStory 0.0.7</a> |
<a href="${pageContext.request.contextPath}/rss.jsp">rss</a>
</h3>
</header>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/includes/header.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<h1># <a href="${pageContext.request.contextPath}/">${settings:name()}</a></h1>
<h2>Kurze Texte von ${settings:author()}</h2>
<h3>
<a href="https://github.com/schipplock/tilstory" target="_blank">TILStory 0.0.6</a> |
<a href="https://github.com/schipplock/tilstory" target="_blank">TILStory 0.0.7</a> |
<a href="${pageContext.request.contextPath}/rss.jsp">rss</a>
</h3>
</header>

0 comments on commit 1905a51

Please sign in to comment.