-
Notifications
You must be signed in to change notification settings - Fork 113
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_김영인 6주차 과제(1단계) #143
Open
Youngini
wants to merge
28
commits into
kakao-tech-campus-2nd-step2:youngini
Choose a base branch
from
Youngini:step1
base: youngini
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
199525a
feat: setup the project
Youngini cd6fec9
feat : merge the project
Youngini 6748dfc
docs(README.md) : API 명세서 수정 사항 점검 리스트
Youngini 62b5448
feat(Member) : 일반 회원가입 로직 확인
Youngini 0096f76
feat(Member) : 일반 로그인 로직 확인
Youngini c3fb376
feat(Product) : 제품 옵션 조회
Youngini 597895b
feat(Product) : 특정 제품의 옵션 조회
Youngini 6363d39
feat(Product) : 특정 카테고리별 상품 목록 조회
Youngini 2e76903
feat(Category) : 모든 카테고리 조회
Youngini 5d6dbed
feat(wish) : 위시 리스트에 추가
Youngini 0ef82ad
feat(wish) : 위시 리스트에서 삭제
Youngini f5152fb
feat(wish) : 위시 리스트 목록 반환
Youngini 5825161
feat(Order) : 주문 생성
Youngini 2e270c5
refactor : 실행 시 발생하는 오류 수정
Youngini 974ee7a
feat(WebConfig) : Swagger 사용 시 발생하는 HttpMediaTypeNotAcceptableExcepti…
Youngini 55fa3ac
refactor(JoinResponse) : 회원가입 시, 응답 용어 수정
Youngini f835073
refactor(Order) : 주문생성시, Request와 Response 용어 api 명세서와 일치시킴
Youngini 5fd2840
refactor(Category) :카테고리 목록의, Request와 Response 용어 api 명세서와 일치시킴
Youngini 71432fd
refactor(Product) : Product API의, Request와 Response 용어 api 명세서와 일치시킴
Youngini 38e745e
refactor(Order) : Order API의, Request와 Response 용어 api 명세서와 일치시킴
Youngini 51f5d20
refactor(wish) : wish API의, Request와 Response 용어 api 명세서와 일치시킴
Youngini 3d71aa0
refactor(Member) : 생성자 만듦
Youngini 471460d
refactor(Member) : Json 인식 못하는 문제 해결
Youngini bff484a
refactor(JwtConfig) : token 생성 오류 해결
Youngini e61f013
fwat(JwtConfig) : token으로 email 추출
Youngini 3dea571
feat(Entity) : 생성자 만듦
Youngini f2d5530
build(application.properties) : 디비 실행되도 생성이아니라 업데이트가 되도록 수정
Youngini ca67821
refactor(Controller) : Pageable 객체 인수를 size, page로 변경
Youngini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,6 @@ out/ | |
|
||
### Mac OS ### | ||
.DS_Store | ||
|
||
### secret-key 설정 | ||
src/main/resources/application-secret.properties |
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 |
---|---|---|
@@ -1 +1,24 @@ | ||
# spring-gift-point | ||
# spring-gift-point | ||
|
||
# 0단계 | ||
|
||
## API 명세서 | ||
https://impossible-repair-22e.notion.site/57ec013f9424421eb2317b11a2b9a29c?v=f3fe7340ebae425bbfa70db78123a663 | ||
|
||
# 1단계 | ||
|
||
## 구현할 기능 목록 | ||
- [ ] 작성한 API 문서를 기반으로 팀 내에서 지금까지 만든 API를 검토하고 통일하여 변경 사항을 반영 | ||
- [x] 일반 회원가입 | ||
- [x] 일반 로그인 | ||
- [x] 모든 상품 조회 | ||
- [x] 특정 제품의 옵션 조회 | ||
- [x] 특정 카테고리별 상품 목록조회 | ||
- [x] 모든 카테고리 조회 | ||
- [x] 위시리스트에 추가 | ||
- [x] 위시리스트에서 삭제 | ||
- [x] 로그인한 회원의 위시리스트 조회 | ||
- [x] 주문 생성 | ||
|
||
팀 내에서 일관된 기준을 정하여 API 명세를 결정한다. | ||
때로는 클라이언트의 편의를 위해 API 명세를 결정하는 것이 좋다. |
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
Binary file not shown.
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,152 @@ | ||
2024-08-01 04:48:27.040702+09:00 jdbc[13]: exception | ||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "IMAGEURL" not found; SQL statement: | ||
-- Product 테이블에 더미 데이터 삽입 | ||
INSERT INTO product (name, price, imageUrl, category_id) VALUES | ||
('Smartphone', 699, 'http://example.com/smartphone.jpg', 1), | ||
('Laptop', 999, 'http://example.com/laptop.jpg', 1), | ||
('T-Shirt', 19, 'http://example.com/tshirt.jpg', 2), | ||
('Coffee Maker', 49, 'http://example.com/coffeemaker.jpg', 3) [42122-224] | ||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:514) | ||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) | ||
at org.h2.message.DbException.get(DbException.java:223) | ||
at org.h2.message.DbException.get(DbException.java:199) | ||
at org.h2.table.Table.getColumn(Table.java:759) | ||
at org.h2.command.Parser.parseColumn(Parser.java:1190) | ||
at org.h2.command.Parser.parseColumnList(Parser.java:1175) | ||
at org.h2.command.Parser.parseInsert(Parser.java:1549) | ||
at org.h2.command.Parser.parsePrepared(Parser.java:719) | ||
at org.h2.command.Parser.parse(Parser.java:592) | ||
at org.h2.command.Parser.parse(Parser.java:564) | ||
at org.h2.command.Parser.prepareCommand(Parser.java:483) | ||
at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:639) | ||
at org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:559) | ||
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1166) | ||
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:245) | ||
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:231) | ||
at org.h2.server.web.WebApp.getResult(WebApp.java:1345) | ||
at org.h2.server.web.WebApp.query(WebApp.java:1143) | ||
at org.h2.server.web.WebApp.query(WebApp.java:1119) | ||
at org.h2.server.web.WebApp.process(WebApp.java:245) | ||
at org.h2.server.web.WebApp.processRequest(WebApp.java:177) | ||
at org.h2.server.web.JakartaWebServlet.doGet(JakartaWebServlet.java:129) | ||
at org.h2.server.web.JakartaWebServlet.doPost(JakartaWebServlet.java:166) | ||
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590) | ||
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) | ||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) | ||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) | ||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) | ||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) | ||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) | ||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) | ||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) | ||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) | ||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) | ||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389) | ||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) | ||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:904) | ||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741) | ||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) | ||
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190) | ||
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) | ||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) | ||
at java.base/java.lang.Thread.run(Thread.java:1583) | ||
2024-08-01 04:49:22.693481+09:00 jdbc[13]: exception | ||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "IMAGEURL" not found; SQL statement: | ||
-- Product 테이블에 더미 데이터 삽입 | ||
INSERT INTO product (name, price, imageUrl, category_id) VALUES | ||
('Smartphone', 699, 'http://example.com/smartphone.jpg', 1), | ||
('Laptop', 999, 'http://example.com/laptop.jpg', 1), | ||
('T-Shirt', 19, 'http://example.com/tshirt.jpg', 2), | ||
('Coffee Maker', 49, 'http://example.com/coffeemaker.jpg', 3) [42122-224] | ||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:514) | ||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) | ||
at org.h2.message.DbException.get(DbException.java:223) | ||
at org.h2.message.DbException.get(DbException.java:199) | ||
at org.h2.table.Table.getColumn(Table.java:759) | ||
at org.h2.command.Parser.parseColumn(Parser.java:1190) | ||
at org.h2.command.Parser.parseColumnList(Parser.java:1175) | ||
at org.h2.command.Parser.parseInsert(Parser.java:1549) | ||
at org.h2.command.Parser.parsePrepared(Parser.java:719) | ||
at org.h2.command.Parser.parse(Parser.java:592) | ||
at org.h2.command.Parser.parse(Parser.java:564) | ||
at org.h2.command.Parser.prepareCommand(Parser.java:483) | ||
at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:639) | ||
at org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:559) | ||
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1166) | ||
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:245) | ||
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:231) | ||
at org.h2.server.web.WebApp.getResult(WebApp.java:1345) | ||
at org.h2.server.web.WebApp.query(WebApp.java:1143) | ||
at org.h2.server.web.WebApp.query(WebApp.java:1119) | ||
at org.h2.server.web.WebApp.process(WebApp.java:245) | ||
at org.h2.server.web.WebApp.processRequest(WebApp.java:177) | ||
at org.h2.server.web.JakartaWebServlet.doGet(JakartaWebServlet.java:129) | ||
at org.h2.server.web.JakartaWebServlet.doPost(JakartaWebServlet.java:166) | ||
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590) | ||
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) | ||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) | ||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) | ||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) | ||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164) | ||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140) | ||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) | ||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) | ||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) | ||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) | ||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) | ||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) | ||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) | ||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389) | ||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) | ||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:904) | ||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741) | ||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) | ||
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190) | ||
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) | ||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) | ||
at java.base/java.lang.Thread.run(Thread.java:1583) | ||
2024-08-01 04:49:58.801112+09:00 jdbc[13]: exception | ||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "OPTIONS" not found; SQL statement: | ||
-- Option 테이블에 더미 데이터 삽입 | ||
INSERT INTO options (name, quantity, id) VALUES | ||
('64GB Storage', 100, 1), -- Smartphone | ||
('128GB Storage', 50, 1), -- Smartphone | ||
('16GB RAM', 20, 2), -- Laptop | ||
('32GB RAM', 15, 2), -- Laptop | ||
('Size M', 200, 3), -- T-Shirt | ||
('Size L', 150, 3), -- T-Shirt | ||
('Black', 75, 4), -- Coffee Maker | ||
('White', 50, 4) [42102-224] | ||
2024-08-01 04:49:58.805468+09:00 jdbc[13]: exception | ||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "OPTIONS" not found; SQL statement: | ||
select * from options [42102-224] | ||
2024-08-01 04:50:16.036865+09:00 jdbc[13]: exception | ||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "OPTIONS" not found; SQL statement: | ||
select * from options [42102-224] |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package gift.config; | ||
|
||
import io.jsonwebtoken.Jwts; | ||
import io.jsonwebtoken.Claims; | ||
import io.jsonwebtoken.security.Keys; | ||
import io.jsonwebtoken.SignatureAlgorithm; | ||
import org.springframework.stereotype.Component; | ||
import gift.constant.Constants; | ||
|
||
import java.util.Date; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@Component | ||
public class JwtConfig { | ||
|
||
public String generateToken(String email) { | ||
// Create a claims map | ||
Map<String, Object> claims = new HashMap<>(); | ||
claims.put("email", email); | ||
|
||
// Generate the JWT token | ||
return Jwts.builder() | ||
.setClaims(claims) | ||
.setSubject(email) | ||
.setIssuedAt(new Date()) | ||
.setExpiration(new Date(System.currentTimeMillis() + Constants.ONE_DAY_MILLIS)) | ||
.signWith(Keys.hmacShaKeyFor(Constants.SECRET_KEY.getBytes()), SignatureAlgorithm.HS256) | ||
.compact(); | ||
} | ||
|
||
public String extractEmail(String token) { | ||
return extractAllClaims(token).getSubject(); | ||
} | ||
|
||
public Claims extractAllClaims(String token) { | ||
return Jwts.parser() | ||
.setSigningKey(Keys.hmacShaKeyFor(Constants.SECRET_KEY.getBytes())) | ||
.parseClaimsJws(token) | ||
.getBody(); | ||
} | ||
|
||
public boolean validateToken(String token, String email) { | ||
final String extractedEmail = extractEmail(token); | ||
return extractedEmail.equals(email) && !isTokenExpired(token); | ||
} | ||
|
||
private boolean isTokenExpired(String token) { | ||
return extractAllClaims(token).getExpiration().before(new Date()); | ||
} | ||
} |
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,46 @@ | ||
package gift.config; | ||
|
||
import gift.resolver.LoginMemberArgumentResolver; | ||
import gift.service.MemberService; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.converter.HttpMessageConverter; | ||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | ||
import org.springframework.web.filter.CharacterEncodingFilter; | ||
import org.springframework.web.method.support.HandlerMethodArgumentResolver; | ||
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
import java.util.List; | ||
|
||
@Configuration | ||
public class WebConfig implements WebMvcConfigurer { | ||
private final MemberService memberService; | ||
|
||
public WebConfig(MemberService memberService) { | ||
this.memberService = memberService; | ||
} | ||
|
||
@Override | ||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { | ||
resolvers.add(new LoginMemberArgumentResolver(memberService)); | ||
} | ||
|
||
@Override | ||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { | ||
configurer.defaultContentType(MediaType.APPLICATION_JSON); | ||
} | ||
|
||
@Bean | ||
public CharacterEncodingFilter characterEncodingFilter() { | ||
CharacterEncodingFilter filter = new CharacterEncodingFilter(); | ||
filter.setEncoding("UTF-8"); | ||
filter.setForceEncoding(true); | ||
return filter; | ||
} | ||
@Override | ||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | ||
converters.add(new MappingJackson2HttpMessageConverter()); | ||
} | ||
} |
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,8 @@ | ||
package gift.constant; | ||
|
||
public class Constants { | ||
public static final String SECRET_KEY = "Yn2kjibddFAWtnPJ2AFlL8WXmohJMCvigQggaEypa5E="; | ||
public static final long ONE_DAY_MILLIS = 86400000; | ||
public static final String AUTHENTICATE_HEADER = "Authenticate"; | ||
public static final String BEARER = "Bearer"; | ||
} |
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,59 @@ | ||
package gift.controller; | ||
|
||
import gift.domain.Category; | ||
import gift.dto.CategoryListDto; | ||
import gift.dto.UpdateCategoryDto; | ||
import gift.service.CategoryService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.PageRequest; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("/api/categories") | ||
public class CategoryController { | ||
private final CategoryService categoryService; | ||
|
||
@Autowired | ||
public CategoryController(CategoryService categoryService) { | ||
this.categoryService = categoryService; | ||
} | ||
|
||
@Operation(summary = "모든 카테고리 조회") | ||
@GetMapping | ||
public ResponseEntity<List<CategoryListDto>> getAllCategories(@RequestParam(defaultValue = "0") int page, | ||
@RequestParam(defaultValue = "10") int size) { | ||
Comment on lines
+28
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
Pageable pageable = PageRequest.of(page, size); | ||
Page<CategoryListDto> categories = categoryService.findAll(pageable); | ||
return ResponseEntity.ok(categories.getContent()); | ||
} | ||
|
||
/* @GetMapping("/{id}") | ||
public ResponseEntity<Category> getCategoryById(@PathVariable Long id) { | ||
Category category = categoryService.findById(id); | ||
return ResponseEntity.ok(category); | ||
} | ||
|
||
@PostMapping | ||
public ResponseEntity<Category> createCategory(@RequestParam String name) { | ||
Category category = categoryService.addCategory(name); | ||
return ResponseEntity.ok(category); | ||
} | ||
|
||
@PutMapping("/{id}") | ||
public ResponseEntity<Category> updateCategory(@PathVariable Long id, @RequestBody UpdateCategoryDto updateCategoryDto) { | ||
Category updatedCategory = categoryService.updateCategory(id, updateCategoryDto); | ||
return ResponseEntity.ok(updatedCategory); | ||
} | ||
|
||
@DeleteMapping("/{id}") | ||
public ResponseEntity<Void> deleteCategory(@PathVariable Long id) { | ||
categoryService.deleteCategory(id); | ||
return ResponseEntity.noContent().build(); | ||
}*/ | ||
Comment on lines
+35
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저는 개인적으로 미사용 API는 다시 살리는게 어려운 건 아니구 git에 전부 기록되어 있어서 삭제하는 방향을 선호하는데요 |
||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런 trace는 디버깅 하실떄 사용하는 값이라 PR에 첨부하지 않도록 ignore 처리하는게 어떨까요?