Skip to content
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

충남대 BE_김민성_1주차 과제(1단계~3단계) #165

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5647f76
docs: 구현할 기능 목록 정리
castlekimdev Jun 28, 2024
8eb5891
feat: 상품 클래스 구현
castlekimdev Jun 28, 2024
fac0838
feat: 상품 관련 API 구현
castlekimdev Jun 28, 2024
aeccfc7
feat: 상품 추가 수정 삭제 DTO 구현
castlekimdev Jun 28, 2024
7811777
feat: 상품 관리 페이지 응답용 컨트롤러 구현
castlekimdev Jun 28, 2024
78357b1
feat: 어드민 상품 관리 화면 구현
castlekimdev Jun 28, 2024
022cb5c
feat: h2 데이터베이스 ddl 정의 및 연동
castlekimdev Jun 28, 2024
4bdcf35
feat: product repository 구현
castlekimdev Jun 28, 2024
54ea3aa
refactor: 더 직관적인 네이밍으로 변경 (`productRepository `)
castlekimdev Jun 30, 2024
315c4fa
refactor: `/products`로 공통화
castlekimdev Jun 30, 2024
32562c0
refactor: 도메인 객체 `record` 대신 `class`로 변경
castlekimdev Jun 30, 2024
37923e7
refactor: `Repository` 조회 함수 리턴값 Optional 하게 변경
castlekimdev Jun 30, 2024
a3f91e1
refactor: 불필요한 어노테이션 `@Autowired` 제거
castlekimdev Jun 30, 2024
7d500f5
feat: custom exception 정의 (`NoSuchElementException`)
castlekimdev Jun 30, 2024
98c367e
chore: Local DB 연동 정보 추가
castlekimdev Jun 30, 2024
713078f
refactor: util에 정의된 `NoSuchElementException` 사용하도록 변경
castlekimdev Jul 1, 2024
9e3d9e7
fix: `RequestMapping` 올바르게 사용하도록 수정
castlekimdev Jul 1, 2024
c0fc53a
refactor: 관습에 따라 setter 이름 변경
castlekimdev Jul 1, 2024
83c8325
refactor: controller가 domain service에 의존하도록 리팩토링
castlekimdev Jul 1, 2024
5ebd921
chore: data.sql, schema.sql 올바른 위치로 이동
castlekimdev Jul 1, 2024
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
82 changes: 76 additions & 6 deletions src/main/java/gift/domain/Product.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,80 @@
package gift.domain;

public record Product(
Long id,
String name,
Integer price,
String imageUrl
) {
import java.util.Objects;

public class Product {

private Long id;
private String name;
private Integer price;
private String imageUrl;

public Product(Long id, String name, Integer price, String imageUrl) {
this.id = id;
this.name = name;
this.price = price;
this.imageUrl = imageUrl;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

Choose a reason for hiding this comment

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

모든 setter 가 현재 코드에서 사용되지 않는 것 같은데, 사용하지 않는 setter는 닫아두는 것이 어떨까요~?


public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Integer getPrice() {
return price;
}

public void setPrice(Integer price) {
this.price = price;
}

public String getImageUrl() {
return imageUrl;
}

public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}

@Override
public String toString() {
return "Product{" +
"id=" + id +
", name='" + name + '\'' +
", price=" + price +
", imageUrl='" + imageUrl + '\'' +
'}';
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Product product = (Product) o;
return Objects.equals(id, product.id) &&
Objects.equals(name, product.name) &&
Objects.equals(price, product.price) &&
Objects.equals(imageUrl, product.imageUrl);
}

@Override
public int hashCode() {
return Objects.hash(id, name, price, imageUrl);
}
}