Skip to content

Product reviews branch#14

Open
ladriana wants to merge 2 commits intomasterfrom
product-reviews-branch
Open

Product reviews branch#14
ladriana wants to merge 2 commits intomasterfrom
product-reviews-branch

Conversation

@ladriana
Copy link
Copy Markdown
Collaborator

reviews repository and Dto files created

Copy link
Copy Markdown
Owner

@adrianbucur83 adrianbucur83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the controller and views

Comment thread pom.xml
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have this in the project

Comment thread pom.xml
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have this

private LocalDateTime date;
private String userName;

public Review() {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use lomboks' @DaTa


@Data
public class ReviewDto {
private String reviewMsg;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these fields should be validated (maybe @NotNull or minimum size?)

import java.time.LocalDateTime;

@Data
public class ReviewUpdateDto {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validation

language=not set
numbers.separator=n

logging.level.root=info
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't commit this file :) git rm --cached

public interface ReviewsRepository extends JpaRepository<Review, Integer> {
List<Review> getAllByUser(String userName);

void deleteAllByUser(String userName);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleteAllByUser_name or something similar will work but you need to have the OneToOne/ OneToMany relation set up correctly

private LocalDate date;

private LocalDateTime date;
private String userName;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a User entrity and a relation like ManyToOne

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants