🎫 회원 가입
POST /api/members/register HTTP/1.1
Content-Type: application/json
host: localhost:8080
{
"email": "admin@email.com",
"password": "password"
}HTTP/1.1 201 Created
Content-Type: application/json
{
"token": ""
}🔑 로그인
POST /api/members/login HTTP/1.1
Content-Type: application/json
host: localhost:8080
{
"email": "abc@gmail.com",
"password": "123qwe"
}HTTP/1.1 200 OK
Content-Type: application/json
{
"token": ""
}🔎 상품 조회 (전체 상품)
GET /api/products HTTP/1.1HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": 1,
"name": "아이스 카페 아메리카노 T",
"price": 4500,
"imageUrl": "https://st.kakaocdn.net/product/api/product/20231010111814_9a667f9eccc943648797925498bdd8a3.jpg"
},
{
"id": 2,
"name": "(ICE)아메리카노",
"price": 2000,
"imageUrl": "https://img1.kakaocdn.net/thumb/C320x320@2x.fwebp.q82/?fname=https%3A%2F%2Fst.kakaocdn.net%2Fproduct%2Fgift%2Fproduct%2F20220622112804_d176787353ab48c690936557eefad11c.jpg"
}
]🔎 상품 조회 (특정 상품)
GET /api/products/{productId} HTTP/1.1HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "아이스 카페 아메리카노 T",
"price": 4500,
"imageUrl": "https://st.kakaocdn.net/product/api/product/20231010111814_9a667f9eccc943648797925498bdd8a3.jpg"
}➕ 상품 추가
POST /api/products HTTP/1.1
Content-Type: application/json
{
"name": "(ICE)아메리카노",
"price": 2000,
"imageUrl": "https://img1.kakaocdn.net/thumb/C320x320@2x.fwebp.q82/?fname=https%3A%2F%2Fst.kakaocdn.net%2Fproduct%2Fgift%2Fproduct%2F20220622112804_d176787353ab48c690936557eefad11c.jpg"
}HTTP/1.1 201 Created
Content-Type: application/json
{
"id": 1,
"name": "(ICE)아케리카노",
"price": 2000,
"imageUrl": "https://img1.kakaocdn.net/thumb/C320x320@2x.fwebp.q82/?fname=https%3A%2F%2Fst.kakaocdn.net%2Fproduct%2Fgift%2Fproduct%2F20220622112804_d176787353ab48c690936557eefad11c.jpg"
}✏️ 상품 수정
PUT /api/products/{productId} HTTP/1.1
Content-Type: application/json
{
"name": "[EVENT](ICE)아메리카노",
"price": 1600,
"imageUrl": "https://img1.kakaocdn.net/thumb/C320x320@2x.fwebp.q82/?fname=https%3A%2F%2Fst.kakaocdn.net%2Fproduct%2Fgift%2Fproduct%2F20250515110714_9664acdff2b84e4e806c4d7d55dd8de0.jpg"
}HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "[EVENT](ICE)아메리카노",
"price": 1600,
"imageUrl": "https://img1.kakaocdn.net/thumb/C320x320@2x.fwebp.q82/?fname=https%3A%2F%2Fst.kakaocdn.net%2Fproduct%2Fgift%2Fproduct%2F20250515110714_9664acdff2b84e4e806c4d7d55dd8de0.jpg"
}🔎 옵션 조회
GET /api/products/{productId}/options HTTP/1.1HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": 1,
"name": "기본 옵션",
"quantity": 1
},
{
"id": 2,
"name": "옵션 2",
"quantity": 2
}
]➕ 옵션 추가
POST /api/products/{productId}/options HTTP/1.1
Content-Type: application/json
{
"name": "옵션 1",
"quantity": 1
}HTTP/1.1 201 Created
Content-Type: application/json
{
"id": 1,
"name": "옵션 1",
"quantity": 1
}✏️ 옵션 수정
PUT /api/products/{productId}/options/{optionId} HTTP/1.1
Content-Type: application/json
{
"name": "수정된 옵션",
"quantity": 3
}HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "수정된 옵션",
"quantity": 3
}❌ 옵션 삭제
DELETE /api/products/{productId}/options/{optionId} HTTP/1.1HTTP/1.1 204 No Content🔎 위시 리스트 보기
- Header: Authorization: Bearer {JWT}
GET /api/wishes?page=0&size=5&sort=createdDate,desc HTTP/1.1
Host: localhost:8080HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": 1,
"product": {
"id": 10,
"name": "테스트 상품 1",
"price": 15000,
"imageUrl": "http://example.com/image.jpg"
}
},
{
"id": 2,
"product": {
"id": 12,
"name": "테스트 상품 2",
"price": 20000,
"imageUrl": "http://example.com/image2.jpg"
}
}
]➕ 위시 리스트 추가
- Header: Authorization: Bearer {JWT}
POST /api/wishes HTTP/1.1
Content-Type: application/json
host: localhost:8080
{
"productId": 1
}{
"id": 1,
"product": {
"id": 10,
"name": "테스트 상품 1",
"price": 15000,
"imageUrl": "[http://example.com/image.jpg](http://example.com/image.jpg)"
}
}❌ 위시 삭제
- Header: Authorization: Bearer {JWT}
DELETE /api/wishes/{wishId} HTTP/1.1
host: localhost:8080
HTTP/1.1 204 No Content🔎 완료한 주문 보기
- Header: Authorization: Bearer {JWT}
GET /api/orders?page=0&size=5&sort=orderDateTime,desc HTTP/1.1
Host: localhost:8080HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": 1,
"optionId": 1,
"quantity": 2,
"orderDateTime": "2025-07-29T12:00:00",
"message": "생일 축하해!"
},
{
"id": 2,
"optionId": 2,
"quantity": 1,
"orderDateTime": "2025-07-30T14:30:00",
"message": "추가 주문"
}
]➕ 주문 생성
- Header: Authorization: Bearer {JWT}
POST /api/orders HTTP/1.1
Content-Type: application/json
host: localhost:8080
{
"optionId": 1,
"quantity": 2,
"message": "생일 축하해!"
}{
"id": 1,
"optionId": 1,
"quantity": 2,
"orderDateTime": "2025-07-29T12:00:00",
"message": "생일 축하해!"
}✅ 로그인 및 회원가입
[GET] http://localhost:8080/members/login
→ 로그인 화면으로 이동합니다.
[GET] http://localhost:8080/members/register
→ 회원가입 화면으로 이동합니다.
🔎 상품 조회
|
오래된순
|
|
|
가격 내림차순
|
|
[GET] http://localhost:8080/members/products
→ 등록된 모든 상품을 목록으로 확인할 수 있는 화면입니다.
[GET] http://localhost:8080/members/products/{productId}
→ 선택한 상품의 상세 정보를 확인할 수 있는 화면입니다.
❌ 위시 삭제
[DELETE] http://localhost:8080/members/wishes/{wishId}
→ HTML <form>에서 _method=delete로 전송됩니다.
→ 실제 HTTP 메서드는 POST이며,
→ MemberFrontController에서 @DeleteMapping으로 처리합니다.
🔎 상품 조회
[GET] http://localhost:8080/admin/products
→ 등록된 모든 상품을 목록으로 확인할 수 있는 화면입니다.
[GET] http://localhost:8080/admin/products/{productId}
→ 선택한 상품의 상세 정보를 확인 및 옵션 수정을 할 수 있는 화면입니다.
➕ 상품 추가
[GET] http://localhost:8080/admin/products/new
→ 새 상품을 입력하는 폼으로 이동합니다.
[POST] http://localhost:8080/admin/products
→ 폼에서 입력된 내용을 서버에 전송해 새 상품을 추가합니다.
✏️ 상품 수정
[GET] http://localhost:8080/admin/products/edit/{productId}
→ 선택한 상품의 정보를 수정할 수 있는 화면입니다.
[PUT] http://localhost:8080/admin/products/{productId}
→ HTML <form>에서 _method=put로 전송되는 요청입니다.
→ 실제 HTTP 메서드는 POST이며,
→ AdminController에서 @PutMapping으로 처리합니다.
❌ 상품 삭제
[DELETE] http://localhost:8080/admin/products/{productId}
→ HTML <form>에서 _method=delete로 전송됩니다.
→ 실제 HTTP 메서드는 POST이며,
→ AdminController에서 @DeleteMapping으로 처리합니다.
📌 DB 초기화
Hibernate:
drop table if exists member
Hibernate:
drop table if exists option
Hibernate:
drop table if exists orders
Hibernate:
drop table if exists product
Hibernate:
drop table if exists token
Hibernate:
drop table if exists wish
Hibernate:
create table member (
id bigint not null auto_increment,
email varchar(255) not null,
password varchar(255) not null,
role enum ('ADMIN','USER') not null,
primary key (id)
) engine=InnoDB
Hibernate:
create table option (
quantity integer not null,
id bigint not null auto_increment,
product_id bigint not null,
name varchar(50) not null,
primary key (id)
) engine=InnoDB
Hibernate:
create table orders (
quantity integer not null,
id bigint not null auto_increment,
member_id bigint not null,
option_id bigint not null,
order_date_time datetime(6) not null,
message TEXT,
primary key (id)
) engine=InnoDB
Hibernate:
create table product (
id bigint not null auto_increment,
price bigint not null,
image_url varchar(255) not null,
name varchar(255) not null,
primary key (id)
) engine=InnoDB
Hibernate:
create table token (
id bigint not null auto_increment,
member_id bigint not null,
access_token varchar(512) not null,
provider varchar(255) not null,
primary key (id)
) engine=InnoDB
Hibernate:
create table wish (
created_date datetime(6) not null,
id bigint not null auto_increment,
member_id bigint not null,
product_id bigint not null,
primary key (id)
) engine=InnoDB
Hibernate:
alter table member
add constraint UKmbmcqelty0fbrvxp1q58dn57t unique (email)
Hibernate:
alter table option
add constraint UKe78vjnqbmknqwm7d6k2blhhnj unique (product_id, name)
Hibernate:
alter table wish
add constraint UKimrh37c61jscdegh9fi3jbpix unique (member_id, product_id)
Hibernate:
alter table option
add constraint FK5t6etuqa4wl7lyn0ysxnts7q4
foreign key (product_id)
references product (id)
Hibernate:
alter table orders
add constraint FKpktxwhj3x9m4gth5ff6bkqgeb
foreign key (member_id)
references member (id)
Hibernate:
alter table orders
add constraint FK4nmdwvy9x1gghgpsnj8mlm974
foreign key (option_id)
references option (id)
Hibernate:
alter table token
add constraint FK8a0sdl451qcw4ishfaxpdog0p
foreign key (member_id)
references member (id)
Hibernate:
alter table wish
add constraint FK70nrc4a6uvljrtemsn80eq1gd
foreign key (member_id)
references member (id)
Hibernate:
alter table wish
add constraint FKh3bvkvkslnehbxqma1x2eynqb
foreign key (product_id)
references product (id)🔍 유효성 검사
- 필수 입력
- 이메일 형식
- 필수 입력
- 필수 입력
- 최소 1자, 최대 15자
- (), [], +, -, &, /, _ 외의 특수 문자를 사용할 수 없음
- RequiresApprovalWords 어노테이션을 사용하여 특정 단어가 포함되지 않도록 검사
- 0원 이상
- 필수 입력
- 필수 입력
- 최소 1자, 최대 50자
- (), [], +, -, &, /, _ 외의 특수 문자를 사용할 수 없음
- 중복된 옵션 이름은 허용하지 않음 (같은 상품 내에서)
- 필수 입력
- 1개 이상 1억 개 미만
🚨 예외 처리
- MemberNotFoundException
- 멤버가 존재하지 않을 경우 (조회 시)
- ProductNotFoundException
- 상품이 존재하지 않을 경우 (조회, 수정, 삭제 시)
- WishNotFoundException
- 위시가 존재하지 않을 경우 (삭제 시)
- OptionNotFoundException
- 옵션이 존재하지 않을 경우 (수정, 삭제 시)
- EmailDuplicateException
- 중복된 이메일로 회원가입 할 때
- WishDuplicateException
- 중복된 위시를 추가할 때
- OptionNameDuplicateException
- 옵션 이름이 중복될 때 (같은 상품 내에서)
- InvalidOptionQuantityException
- 옵션 수량이 1개 이상 1억 개 미만이 아닐 때
- 인증되지 않은 사용자 (로그인하지 않은 경우)
- 인증 토큰이 유효하지 않은 경우 (예: 만료된 토큰)
- LoginFailedException
- 로그인 실패 시 (잘못된 이메일 또는 비밀번호)
- 인증된 사용자 (로그인한 경우) 권한이 없는 요청
- 일반 사용자가 관리자 권한이 필요한 행위 요청
- 상품을 생성할 때 제약조건에 맞지 않을 경우
- 해당 상품에 속한 옵션이 아닐 때 수정 및 삭제하는 경우
- 옵션이 1개 뿐인 상품의 옵션을 삭제하는 경우
E2E 테스트
- AuthE2ETest
- 관리자/일반 사용자 로그인, 페이지 접근 권한 등 인증/인가 테스트
- PaginationE2ETest
- 관리자/사용자 상품 목록, 위시리스트의 페이지네이션 및 정렬 기능 테스트
- OrderE2ETest
- 상품 주문 성공 테스트
Domain 테스트
- OptionTest
- 옵션 삭제 테스트
Repository 테스트
- MemberRepositoryTest
- 회원 정보 저장 및 이메일 중복 조회
- ProductRepositoryTest
- 상품 CRUD 기능 테스트
- WishRepositoryTest
- 위시리스트 저장, 조회 및 중복 저장 방지 테스트
Service 테스트
- MemberServiceTest
- 회원가입, 로그인 성공/실패(이메일 중복, 비밀번호 불일치) 케이스 테스트
- ProductServiceTest
- 상품 생성, 조회, 수정, 삭제 기능 테스트
- WishServiceTest
- 위시리스트 추가, 삭제 및 예외(중복, 권한 없음) 처리 테스트
- OrderServiceTest
- 상품 주문 성공 및 실패(재고 부족, 존재하지 않는 회원) 테스트
- KakaoServiceTest
- 카카오 로그인 성공 테스트
- KakaoMessageTemplateGeneratorTest
- 카카오 메시지 템플릿 생성 테스트







