forked from makersacademy/acebook-java-template
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #30 from neily2nd/main
Delete post works, comments show, but delete comment and edit comment are still being worked on.
- Loading branch information
Showing
9 changed files
with
175 additions
and
107 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ CREATE TABLE likes ( | |
FOREIGN KEY (user_id) REFERENCES users(id), | ||
FOREIGN KEY (post_id) REFERENCES posts(id) | ||
); | ||
|
10 changes: 10 additions & 0 deletions
10
src/main/resources/db/migration/V12__create_comments_table.sql
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 @@ | ||
DROP TABLE IF EXISTS comments; | ||
CREATE TABLE comments ( | ||
id bigserial PRIMARY KEY, | ||
content TEXT NOT NULL, | ||
post_id BIGINT NOT NULL, | ||
user_id BIGINT NOT NULL, | ||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
FOREIGN KEY (post_id) REFERENCES posts(id), | ||
FOREIGN KEY (user_id) REFERENCES users(id) | ||
); |
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
32 changes: 32 additions & 0 deletions
32
src/test/java/com/makersacademy/acebook/model/CommentTest.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,32 @@ | ||
package com.makersacademy.acebook.model; | ||
|
||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
public class CommentTest { | ||
|
||
|
||
|
||
|
||
@Test | ||
public void testCommentCreation() { | ||
Post post = new Post(); | ||
User user = new User(); | ||
Comment comment = new Comment(); | ||
comment.setContent("Test content"); | ||
comment.setPost(post); | ||
comment.setUser(user); | ||
|
||
assertNotNull(comment); | ||
assertEquals("Test content", comment.getContent()); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
Oops, something went wrong.