Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Feat/test final #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: Dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .idea/libraries/Maven__junit_junit_4_13_2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_hamcrest_hamcrest_core_2_2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion demo.iml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.52" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.52" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.52" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.9" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.9" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.9" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.26" level="project" />
Expand Down Expand Up @@ -99,5 +98,7 @@
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.9" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:2.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.9" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.6" level="project" />
</component>
</module>
32 changes: 32 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,38 @@
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>


</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public ResponseEntity<BlogPost> create(@RequestBody BlogPost blogPost){
return new ResponseEntity<>(service.create(blogPost), HttpStatus.CREATED);
}


@PutMapping(value = "/update/{id}")
public ResponseEntity<BlogPost> update(@PathVariable Long id, @RequestBody BlogPost blogPost){
return new ResponseEntity<>(service.update(id, blogPost), HttpStatus.OK);
Expand Down
43 changes: 0 additions & 43 deletions src/main/java/com/example/demo/controller/RecipeController.java

This file was deleted.

9 changes: 4 additions & 5 deletions src/main/java/com/example/demo/models/BlogPost.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public class BlogPost {
@Column(name = "content")
private String content;

@OneToOne(cascade = CascadeType.ALL)
private Recipe recipe;
private String recipe;

@ManyToOne
@JsonBackReference
Expand All @@ -45,7 +44,7 @@ public class BlogPost {
public BlogPost() {
}

public BlogPost(Long id, String title, String imageUrl, String content, Recipe recipe, User user, List<Tag> tags) {
public BlogPost(Long id, String title, String imageUrl, String content, String recipe, User user, List<Tag> tags) {
this.id = id;
this.title = title;
this.imageUrl = imageUrl;
Expand Down Expand Up @@ -87,11 +86,11 @@ public void setContent(String content) {
this.content = content;
}

public Recipe getRecipe() {
public String getRecipe() {
return recipe;
}

public void setRecipe(Recipe recipe) {
public void setRecipe(String recipe) {
this.recipe = recipe;
}

Expand Down
69 changes: 0 additions & 69 deletions src/main/java/com/example/demo/models/Recipe.java

This file was deleted.

10 changes: 0 additions & 10 deletions src/main/java/com/example/demo/repository/RecipeRepository.java

This file was deleted.

2 changes: 0 additions & 2 deletions src/main/java/com/example/demo/repository/TagRepository.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.example.demo.repository;

import com.example.demo.models.BlogPost;
import com.example.demo.models.Recipe;
import com.example.demo.models.Tag;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
Expand Down
47 changes: 0 additions & 47 deletions src/main/java/com/example/demo/service/RecipeService.java

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# MySQL Configuration
spring.datasource.url=jdbc:mysql://localhost:3306/blogdatabase

spring.datasource.username=jen
spring.datasource.password=zipcode0
spring.datasource.username=carl
spring.datasource.password=carlpass

spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
Loading