From e0df7297b9e8c8f8aa7289606c5854f5c948f6b6 Mon Sep 17 00:00:00 2001 From: Seonghun Jeong <119427233+zzoe2346@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:57:33 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Feat:=204=EC=A3=BC=EC=B0=A8=20=EC=B5=9C?= =?UTF-8?q?=EC=A2=85=20=EC=82=B0=EC=B6=9C=EB=AC=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/sinitto/SinittoApplication.java | 4 +- .../auth/controller/AuthController.java | 36 ++++++++ .../sinitto/auth/dto/TokenRefreshRequest.java | 4 + .../sinitto/auth/dto/TokenResponse.java | 4 + .../controller/CallbackController.java | 53 ++++++++++++ .../callback/dto/CallbackResponse.java | 9 ++ .../sinitto/callback/entity/Callback.java | 30 +++++++ .../sinitto/common/annotation/MemberId.java | 11 +++ .../sinitto/common/config/SwaggerConfig.java | 25 ++++++ .../sinitto/common/config/WebConfig.java | 18 ++++ .../resolver/MemberIdArgumentResolver.java | 24 ++++++ .../guard/controller/GuardController.java | 84 +++++++++++++++++++ .../sinitto/guard/dto/GuardRequest.java | 7 ++ .../sinitto/guard/dto/GuardResponse.java | 7 ++ .../sinitto/guard/dto/SeniorRequest.java | 6 ++ .../sinitto/guard/dto/SeniorResponse.java | 7 ++ .../controller/GuardGuidelineController.java | 53 ++++++++++++ .../dto/GuardGuidelineRequest.java | 4 + .../dto/GuardGuidelineResponse.java | 6 ++ .../guardGuideline/entity/GuardGuideLine.java | 25 ++++++ .../controller/HelloCallController.java | 76 +++++++++++++++++ .../dto/HelloCallDetailResponse.java | 20 +++++ .../helloCall/dto/HelloCallReportRequest.java | 20 +++++ .../helloCall/dto/HelloCallRequest.java | 21 +++++ .../helloCall/dto/HelloCallResponse.java | 7 ++ .../member/controller/MemberController.java | 31 +++++++ .../member/dto/GuardSignupRequest.java | 7 ++ .../member/dto/SinittoSignupRequest.java | 9 ++ .../example/sinitto/member/entity/Member.java | 24 ++++++ .../example/sinitto/member/entity/Senior.java | 24 ++++++ .../sinitto/member/entity/Sinitto.java | 24 ++++++ .../point/controller/PointController.java | 54 ++++++++++++ .../sinitto/point/dto/PointLogResponse.java | 10 +++ .../sinitto/point/dto/PointRequest.java | 5 ++ .../sinitto/point/dto/PointResponse.java | 5 ++ .../example/sinitto/point/entity/Point.java | 23 +++++ .../sinitto/point/entity/PointLog.java | 32 +++++++ .../review/controller/ReviewController.java | 31 +++++++ .../sinitto/review/dto/ReviewRequest.java | 6 ++ .../sinitto/review/dto/ReviewResponse.java | 10 +++ .../sinitto/controller/SinittoController.java | 47 +++++++++++ .../sinitto/sinitto/dto/SinittoRequest.java | 9 ++ .../sinitto/sinitto/dto/SinittoResponse.java | 9 ++ 43 files changed, 920 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/example/sinitto/auth/controller/AuthController.java create mode 100644 src/main/java/com/example/sinitto/auth/dto/TokenRefreshRequest.java create mode 100644 src/main/java/com/example/sinitto/auth/dto/TokenResponse.java create mode 100644 src/main/java/com/example/sinitto/callback/controller/CallbackController.java create mode 100644 src/main/java/com/example/sinitto/callback/dto/CallbackResponse.java create mode 100644 src/main/java/com/example/sinitto/callback/entity/Callback.java create mode 100644 src/main/java/com/example/sinitto/common/annotation/MemberId.java create mode 100644 src/main/java/com/example/sinitto/common/config/SwaggerConfig.java create mode 100644 src/main/java/com/example/sinitto/common/config/WebConfig.java create mode 100644 src/main/java/com/example/sinitto/common/resolver/MemberIdArgumentResolver.java create mode 100644 src/main/java/com/example/sinitto/guard/controller/GuardController.java create mode 100644 src/main/java/com/example/sinitto/guard/dto/GuardRequest.java create mode 100644 src/main/java/com/example/sinitto/guard/dto/GuardResponse.java create mode 100644 src/main/java/com/example/sinitto/guard/dto/SeniorRequest.java create mode 100644 src/main/java/com/example/sinitto/guard/dto/SeniorResponse.java create mode 100644 src/main/java/com/example/sinitto/guardGuideline/controller/GuardGuidelineController.java create mode 100644 src/main/java/com/example/sinitto/guardGuideline/dto/GuardGuidelineRequest.java create mode 100644 src/main/java/com/example/sinitto/guardGuideline/dto/GuardGuidelineResponse.java create mode 100644 src/main/java/com/example/sinitto/guardGuideline/entity/GuardGuideLine.java create mode 100644 src/main/java/com/example/sinitto/helloCall/controller/HelloCallController.java create mode 100644 src/main/java/com/example/sinitto/helloCall/dto/HelloCallDetailResponse.java create mode 100644 src/main/java/com/example/sinitto/helloCall/dto/HelloCallReportRequest.java create mode 100644 src/main/java/com/example/sinitto/helloCall/dto/HelloCallRequest.java create mode 100644 src/main/java/com/example/sinitto/helloCall/dto/HelloCallResponse.java create mode 100644 src/main/java/com/example/sinitto/member/controller/MemberController.java create mode 100644 src/main/java/com/example/sinitto/member/dto/GuardSignupRequest.java create mode 100644 src/main/java/com/example/sinitto/member/dto/SinittoSignupRequest.java create mode 100644 src/main/java/com/example/sinitto/member/entity/Member.java create mode 100644 src/main/java/com/example/sinitto/member/entity/Senior.java create mode 100644 src/main/java/com/example/sinitto/member/entity/Sinitto.java create mode 100644 src/main/java/com/example/sinitto/point/controller/PointController.java create mode 100644 src/main/java/com/example/sinitto/point/dto/PointLogResponse.java create mode 100644 src/main/java/com/example/sinitto/point/dto/PointRequest.java create mode 100644 src/main/java/com/example/sinitto/point/dto/PointResponse.java create mode 100644 src/main/java/com/example/sinitto/point/entity/Point.java create mode 100644 src/main/java/com/example/sinitto/point/entity/PointLog.java create mode 100644 src/main/java/com/example/sinitto/review/controller/ReviewController.java create mode 100644 src/main/java/com/example/sinitto/review/dto/ReviewRequest.java create mode 100644 src/main/java/com/example/sinitto/review/dto/ReviewResponse.java create mode 100644 src/main/java/com/example/sinitto/sinitto/controller/SinittoController.java create mode 100644 src/main/java/com/example/sinitto/sinitto/dto/SinittoRequest.java create mode 100644 src/main/java/com/example/sinitto/sinitto/dto/SinittoResponse.java diff --git a/src/main/java/com/example/sinitto/SinittoApplication.java b/src/main/java/com/example/sinitto/SinittoApplication.java index bb6c40a8..d0f00069 100644 --- a/src/main/java/com/example/sinitto/SinittoApplication.java +++ b/src/main/java/com/example/sinitto/SinittoApplication.java @@ -2,10 +2,12 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; @SpringBootApplication +@EnableJpaAuditing public class SinittoApplication { - + public static void main(String[] args) { SpringApplication.run(SinittoApplication.class, args); } diff --git a/src/main/java/com/example/sinitto/auth/controller/AuthController.java b/src/main/java/com/example/sinitto/auth/controller/AuthController.java new file mode 100644 index 00000000..11cc6cd1 --- /dev/null +++ b/src/main/java/com/example/sinitto/auth/controller/AuthController.java @@ -0,0 +1,36 @@ +package com.example.sinitto.auth.controller; + +import com.example.sinitto.auth.dto.TokenRefreshRequest; +import com.example.sinitto.auth.dto.TokenResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api/auth") +@Tag(name = "[미구현][의논필요]회원 인증", description = "회원 인증 관련 API") +public class AuthController { + + @Operation(summary = "토큰 재발급", description = "RefreshToken으로 AccessToken을 재발급 한다.") + @PostMapping("/refresh") + public ResponseEntity refreshToken(@RequestBody TokenRefreshRequest request) { + // 임시 응답 + return ResponseEntity.ok(new TokenResponse()); + } + + @Operation(summary = "Oauth 카카오 인증페이지 리다이렉트", description = "카카오 로그인 화면으로 이동한다.") + @GetMapping("/oauth/kakao") + public ResponseEntity redirectToKakaoAuth() { + // 실제로는 리다이렉트 로직이 필요 + return ResponseEntity.ok("카카오 로그인 페이지로 리다이렉트됩니다."); + } + + @Operation(summary = "Oauth 카카오 로그인 콜백", description = "카카오 로그인 이후 발생하는 인가코드를 통해 AccessToken을 발급한다.") + @GetMapping("/oauth/kakao/callback") + public ResponseEntity kakaoCallback(@RequestParam("code") String code) { + // 임시 응답 + return ResponseEntity.ok(new TokenResponse()); + } + +} diff --git a/src/main/java/com/example/sinitto/auth/dto/TokenRefreshRequest.java b/src/main/java/com/example/sinitto/auth/dto/TokenRefreshRequest.java new file mode 100644 index 00000000..625d759f --- /dev/null +++ b/src/main/java/com/example/sinitto/auth/dto/TokenRefreshRequest.java @@ -0,0 +1,4 @@ +package com.example.sinitto.auth.dto; + +public record TokenRefreshRequest() { +} diff --git a/src/main/java/com/example/sinitto/auth/dto/TokenResponse.java b/src/main/java/com/example/sinitto/auth/dto/TokenResponse.java new file mode 100644 index 00000000..21fe361f --- /dev/null +++ b/src/main/java/com/example/sinitto/auth/dto/TokenResponse.java @@ -0,0 +1,4 @@ +package com.example.sinitto.auth.dto; + +public record TokenResponse() { +} diff --git a/src/main/java/com/example/sinitto/callback/controller/CallbackController.java b/src/main/java/com/example/sinitto/callback/controller/CallbackController.java new file mode 100644 index 00000000..1d5c5240 --- /dev/null +++ b/src/main/java/com/example/sinitto/callback/controller/CallbackController.java @@ -0,0 +1,53 @@ +package com.example.sinitto.callback.controller; + +import com.example.sinitto.callback.dto.CallbackResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; + +@RestController +@RequestMapping("/api/callbacks") +@Tag(name = "[미구현]콜백 서비스", description = "콜백 관련 API") +public class CallbackController { + + @Operation(summary = "콜백 전화 리스트 보기(페이지)", description = "시니어가 요청한 콜백전화를 페이징으로 보여줍니다.") + @GetMapping + public ResponseEntity> getCallbackList() { + // 임시 응답 + return ResponseEntity.ok(new PageImpl<>(new ArrayList<>())); + } + + @Operation(summary = "콜백 전화 상세보기(not 페이징)", description = "") + @GetMapping("/{callbackId}") + public ResponseEntity getCallbackGuidelines(@PathVariable Long callbackId) { + // 임시 응답 + return ResponseEntity.ok(new CallbackResponse(null, null, null)); + } + + @Operation(summary = "콜백 전화 완료", description = "시니또와 시니어의 연락이 끝났을 때 시니어의 요청사항을 수행 여부를 선택하여 처리합니다.") + @PutMapping("/complete/{callbackId}") + public ResponseEntity completeCallback(@PathVariable Long callbackId) { + // 임시 응답 + return ResponseEntity.ok("콜백 전화 끝냄"); + } + + @Operation(summary = "콜백 서비스 수락 신청", description = "시니또가 콜백 서비스 수락을 신청합니다.") + @PutMapping("/accept/{callbackId}") + public ResponseEntity acceptCallbackService(@PathVariable Long callbackId) { + // 임시 응답 + return ResponseEntity.ok("콜백 서비스가 수락"); + } + + @Operation(summary = "진행중인 콜백 서비스 취소", description = "시니또가 진행중인 콜백 서비스를 취소합니다.") + @PutMapping("/cancel/{callbackId}") + public ResponseEntity cancelCallbackService(@PathVariable Long callbackId) { + // 임시 응답 + return ResponseEntity.ok("콜백 서비스가 취소"); + } + +} diff --git a/src/main/java/com/example/sinitto/callback/dto/CallbackResponse.java b/src/main/java/com/example/sinitto/callback/dto/CallbackResponse.java new file mode 100644 index 00000000..9cd2d3fb --- /dev/null +++ b/src/main/java/com/example/sinitto/callback/dto/CallbackResponse.java @@ -0,0 +1,9 @@ +package com.example.sinitto.callback.dto; + +import java.time.LocalDateTime; + +public record CallbackResponse( + String seniorName, + LocalDateTime postTime, + String status) { +} diff --git a/src/main/java/com/example/sinitto/callback/entity/Callback.java b/src/main/java/com/example/sinitto/callback/entity/Callback.java new file mode 100644 index 00000000..1a50faf7 --- /dev/null +++ b/src/main/java/com/example/sinitto/callback/entity/Callback.java @@ -0,0 +1,30 @@ +package com.example.sinitto.callback.entity; + +import com.example.sinitto.member.entity.Senior; +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.time.LocalDateTime; + +@Entity +@EntityListeners(AuditingEntityListener.class) +public class Callback { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + @CreatedDate + private LocalDateTime postTime; + @NotNull + private String status; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "senior_id") + @NotNull + @OnDelete(action = OnDeleteAction.CASCADE) + private Senior senior; + +} diff --git a/src/main/java/com/example/sinitto/common/annotation/MemberId.java b/src/main/java/com/example/sinitto/common/annotation/MemberId.java new file mode 100644 index 00000000..e478c8ab --- /dev/null +++ b/src/main/java/com/example/sinitto/common/annotation/MemberId.java @@ -0,0 +1,11 @@ +package com.example.sinitto.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.PARAMETER) +public @interface MemberId { +} diff --git a/src/main/java/com/example/sinitto/common/config/SwaggerConfig.java b/src/main/java/com/example/sinitto/common/config/SwaggerConfig.java new file mode 100644 index 00000000..b328fd8d --- /dev/null +++ b/src/main/java/com/example/sinitto/common/config/SwaggerConfig.java @@ -0,0 +1,25 @@ +package com.example.sinitto.common.config; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SwaggerConfig { + + @Bean + public OpenAPI openAPI() { + return new OpenAPI() + .components(new Components()) + .info(apiInfo()); + } + + private Info apiInfo() { + return new Info() + .title("나만의 작은 시니또") + .description("아자아자 화이팅") + .version("0.0.1"); + } +} diff --git a/src/main/java/com/example/sinitto/common/config/WebConfig.java b/src/main/java/com/example/sinitto/common/config/WebConfig.java new file mode 100644 index 00000000..4f005b48 --- /dev/null +++ b/src/main/java/com/example/sinitto/common/config/WebConfig.java @@ -0,0 +1,18 @@ +package com.example.sinitto.common.config; + +import com.example.sinitto.common.resolver.MemberIdArgumentResolver; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.List; + +@Configuration +public class WebConfig implements WebMvcConfigurer { + + @Override + public void addArgumentResolvers(List resolvers) { + resolvers.add(new MemberIdArgumentResolver()); + } + +} diff --git a/src/main/java/com/example/sinitto/common/resolver/MemberIdArgumentResolver.java b/src/main/java/com/example/sinitto/common/resolver/MemberIdArgumentResolver.java new file mode 100644 index 00000000..29476817 --- /dev/null +++ b/src/main/java/com/example/sinitto/common/resolver/MemberIdArgumentResolver.java @@ -0,0 +1,24 @@ +package com.example.sinitto.common.resolver; + +import com.example.sinitto.common.annotation.MemberId; +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.core.MethodParameter; +import org.springframework.web.bind.support.WebDataBinderFactory; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.method.support.ModelAndViewContainer; + +public class MemberIdArgumentResolver implements HandlerMethodArgumentResolver { + + @Override + public boolean supportsParameter(MethodParameter parameter) { + return parameter.getParameterAnnotation(MemberId.class) != null; + } + + @Override + public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { + HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest(); + return request.getAttribute("memberId"); + } + +} diff --git a/src/main/java/com/example/sinitto/guard/controller/GuardController.java b/src/main/java/com/example/sinitto/guard/controller/GuardController.java new file mode 100644 index 00000000..56a313ae --- /dev/null +++ b/src/main/java/com/example/sinitto/guard/controller/GuardController.java @@ -0,0 +1,84 @@ +package com.example.sinitto.guard.controller; + +import com.example.sinitto.guard.dto.GuardRequest; +import com.example.sinitto.guard.dto.GuardResponse; +import com.example.sinitto.guard.dto.SeniorRequest; +import com.example.sinitto.guard.dto.SeniorResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/api/guards") +@Tag(name = "[미구현]마이페이지 - 보호자용", description = "보호자와 시니어 관련 마이페이지 API") +public class GuardController { + + @Operation(summary = "연결된 모든 시니어 정보 조회", description = "보호자가 등록한 모든 시니어의 정보를 요청합니다.") + @GetMapping("/senior") + public ResponseEntity> getAllSeniors() { + // 임시 응답 + return ResponseEntity.ok(new ArrayList<>()); + } + + @Operation(summary = "연결된 특정 시니어 정보 조회", description = "보호자가 등록한 특정 시니어의 정보를 요청합니다.") + @GetMapping("/senior/{seniorId}") + public ResponseEntity getSenior(@PathVariable Long seniorId) { + // 임시 응답 + return ResponseEntity.ok(new SeniorResponse(null, null, null)); + } + + @Operation(summary = "시니어 정보 수정", description = "시니어의 정보를 수정합니다.") + @PutMapping("/senior/{seniorId}") + public ResponseEntity updateSenior(@PathVariable Long seniorId, @RequestBody SeniorRequest request) { + // 임시 응답 + return ResponseEntity.ok("시니어 정보가 수정되었습니다."); + } + + @Operation(summary = "시니어 추가", description = "보호자가 새로운 시니어를 등록합니다.") + @PostMapping("/senior") + public ResponseEntity createSenior(@RequestBody SeniorRequest request) { + // 임시 응답 + return ResponseEntity.ok("새로운 시니어가 등록되었습니다."); + } + + @Operation(summary = "시니어 삭제", description = "보호자가 시니어를 등록 해제합니다.") + @DeleteMapping("/senior/{seniorId}") + public ResponseEntity deleteSenior(@PathVariable Long seniorId) { + // 임시 응답 + return ResponseEntity.ok("시니어가 삭제되었습니다."); + } + + @Operation(summary = "보호자 본인 정보 조회", description = "보호자의 본인 정보를 조회합니다.") + @GetMapping + public ResponseEntity getGuardInfo() { + // 임시 응답 + return ResponseEntity.ok(new GuardResponse(null, null, null)); + } + + @Operation(summary = "보호자 본인 정보 수정", description = "보호자의 본인 정보를 수정합니다.") + @PutMapping + public ResponseEntity updateGuardInfo(@RequestBody GuardRequest request) { + // 임시 응답 + return ResponseEntity.ok("보호자 정보가 수정되었습니다."); + } + + //PASS + @Operation(summary = "보호자 삭제", description = "관리자용 API입니다.") + @DeleteMapping + public ResponseEntity deleteGuard() { + // 임시 응답 + return ResponseEntity.ok("보호자가 삭제되었습니다."); + } + + @Operation(summary = "모든 보호자 조회", description = "관리자용 API입니다.") + @GetMapping("/all") + public ResponseEntity> getAllGuards() { + // 임시 응답 + return ResponseEntity.ok(new ArrayList<>()); + } + +} diff --git a/src/main/java/com/example/sinitto/guard/dto/GuardRequest.java b/src/main/java/com/example/sinitto/guard/dto/GuardRequest.java new file mode 100644 index 00000000..8f9aa8cc --- /dev/null +++ b/src/main/java/com/example/sinitto/guard/dto/GuardRequest.java @@ -0,0 +1,7 @@ +package com.example.sinitto.guard.dto; + +public record GuardRequest( + String name, + String email, + String phoneNumber) { +} diff --git a/src/main/java/com/example/sinitto/guard/dto/GuardResponse.java b/src/main/java/com/example/sinitto/guard/dto/GuardResponse.java new file mode 100644 index 00000000..bab9225e --- /dev/null +++ b/src/main/java/com/example/sinitto/guard/dto/GuardResponse.java @@ -0,0 +1,7 @@ +package com.example.sinitto.guard.dto; + +public record GuardResponse( + String name, + String email, + String phoneNumber) { +} diff --git a/src/main/java/com/example/sinitto/guard/dto/SeniorRequest.java b/src/main/java/com/example/sinitto/guard/dto/SeniorRequest.java new file mode 100644 index 00000000..0b47924e --- /dev/null +++ b/src/main/java/com/example/sinitto/guard/dto/SeniorRequest.java @@ -0,0 +1,6 @@ +package com.example.sinitto.guard.dto; + +public record SeniorRequest( + String seniorName, + String seniorPhoneNumber) { +} diff --git a/src/main/java/com/example/sinitto/guard/dto/SeniorResponse.java b/src/main/java/com/example/sinitto/guard/dto/SeniorResponse.java new file mode 100644 index 00000000..558fd218 --- /dev/null +++ b/src/main/java/com/example/sinitto/guard/dto/SeniorResponse.java @@ -0,0 +1,7 @@ +package com.example.sinitto.guard.dto; + +public record SeniorResponse( + Long seniorId, + String seniorName, + String seniorPhoneNumber) { +} diff --git a/src/main/java/com/example/sinitto/guardGuideline/controller/GuardGuidelineController.java b/src/main/java/com/example/sinitto/guardGuideline/controller/GuardGuidelineController.java new file mode 100644 index 00000000..94ae661f --- /dev/null +++ b/src/main/java/com/example/sinitto/guardGuideline/controller/GuardGuidelineController.java @@ -0,0 +1,53 @@ +package com.example.sinitto.guardGuideline.controller; + +import com.example.sinitto.guardGuideline.dto.GuardGuidelineRequest; +import com.example.sinitto.guardGuideline.dto.GuardGuidelineResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/api/guardguidelines") +@Tag(name = "[미구현][의논필요]보호자용 가이드라인", description = "보호자가 입력하는 시니어별 가이드라인 관련 API") +public class GuardGuidelineController { + + @Operation(summary = "가이드라인 추가", description = "보호자가 시니어별 가이드라인을 추가합니다.") + @PostMapping + public ResponseEntity addGuideline(@RequestBody GuardGuidelineRequest request) { + // 임시 응답 + return ResponseEntity.ok("가이드라인이 추가되었습니다."); + } + + @Operation(summary = "카테고리에 해당하는 모든 가이드라인 조회", description = "시니또용 앱에서 카테고리에 해당하는 모든 가이드라인들을 요청할 때 필요합니다.") + @GetMapping("/{seniorId}/{typeId}") + public ResponseEntity> getGuidelinesByCategory(@PathVariable Long seniorId, @PathVariable Long typeId) { + // 임시 응답 + return ResponseEntity.ok(new ArrayList<>()); + } + + @Operation(summary = "가이드라인 수정", description = "보호자가 특정 가이드라인을 수정할 때 필요합니다.") + @PutMapping("/{guidelineId}") + public ResponseEntity updateGuideline(@PathVariable Long guidelineId, @RequestBody GuardGuidelineRequest request) { + // 임시 응답 + return ResponseEntity.ok("가이드라인이 수정되었습니다."); + } + + @Operation(summary = "모든 가이드라인 조회(시니어별로)", description = "보호자가 가이드라인 수정을 위해 시니어별로 모든 가이드라인을 요청할 때 필요합니다.") + @GetMapping("/{seniorId}") + public ResponseEntity> getAllGuidelinesBySenior(@PathVariable Long seniorId) { + // 임시 응답 + return ResponseEntity.ok(new ArrayList<>()); + } + + @Operation(summary = "특정 가이드라인 조회", description = "보호자용 API입니다.") + @GetMapping("/{guidelineId}") + public ResponseEntity getGuideline(@PathVariable Long guidelineId) { + // 임시 응답 + return ResponseEntity.ok(new GuardGuidelineResponse(null, null)); + } + +} diff --git a/src/main/java/com/example/sinitto/guardGuideline/dto/GuardGuidelineRequest.java b/src/main/java/com/example/sinitto/guardGuideline/dto/GuardGuidelineRequest.java new file mode 100644 index 00000000..05d6635d --- /dev/null +++ b/src/main/java/com/example/sinitto/guardGuideline/dto/GuardGuidelineRequest.java @@ -0,0 +1,4 @@ +package com.example.sinitto.guardGuideline.dto; + +public record GuardGuidelineRequest() { +} diff --git a/src/main/java/com/example/sinitto/guardGuideline/dto/GuardGuidelineResponse.java b/src/main/java/com/example/sinitto/guardGuideline/dto/GuardGuidelineResponse.java new file mode 100644 index 00000000..a820d21a --- /dev/null +++ b/src/main/java/com/example/sinitto/guardGuideline/dto/GuardGuidelineResponse.java @@ -0,0 +1,6 @@ +package com.example.sinitto.guardGuideline.dto; + +public record GuardGuidelineResponse( + String title, + String content) { +} diff --git a/src/main/java/com/example/sinitto/guardGuideline/entity/GuardGuideLine.java b/src/main/java/com/example/sinitto/guardGuideline/entity/GuardGuideLine.java new file mode 100644 index 00000000..686e1287 --- /dev/null +++ b/src/main/java/com/example/sinitto/guardGuideline/entity/GuardGuideLine.java @@ -0,0 +1,25 @@ +package com.example.sinitto.guardGuideline.entity; + +import com.example.sinitto.member.entity.Senior; +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +@Entity +public class GuardGuideLine { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + @NotNull + private String content; + @NotNull + private String type; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "senior_id") + @NotNull + @OnDelete(action = OnDeleteAction.CASCADE) + private Senior senior; + +} diff --git a/src/main/java/com/example/sinitto/helloCall/controller/HelloCallController.java b/src/main/java/com/example/sinitto/helloCall/controller/HelloCallController.java new file mode 100644 index 00000000..d5bea87c --- /dev/null +++ b/src/main/java/com/example/sinitto/helloCall/controller/HelloCallController.java @@ -0,0 +1,76 @@ +package com.example.sinitto.helloCall.controller; + +import com.example.sinitto.helloCall.dto.HelloCallDetailResponse; +import com.example.sinitto.helloCall.dto.HelloCallReportRequest; +import com.example.sinitto.helloCall.dto.HelloCallResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; + +@RestController +@RequestMapping("/api/hellocalls") +@Tag(name = "[미구현]안부전화", description = "안부 전화 서비스 관련 API") +public class HelloCallController { + + @Operation(summary = "안부 전화 서비스 전체 리스트 보기", description = "보호자가 요청한 안부전화 신청정보를 리스트로 조회합니다. 페이징 처리 됩니다.") + @GetMapping + public ResponseEntity> getHelloCallList() { + // 임시 응답 + return ResponseEntity.ok(new PageImpl<>(new ArrayList<>())); + } + + @Operation(summary = "선택한 안부 전화 서비스의 상세정보 보기", description = "안부전화 신청정보의 상세정보를 조회합니다.") + @GetMapping("/{callId}") + public ResponseEntity getHelloCallDetail(@PathVariable Long callId) { + // 임시 응답 + return ResponseEntity.ok(new HelloCallDetailResponse(null, null, null, null)); + } + + @Operation(summary = "서비스 수락하기", description = "시니또가 안부전화 신청을 수락합니다.") + @PutMapping("/accept/{callId}") + public ResponseEntity acceptHelloCall(@PathVariable Long callId) { + // 임시 응답 + return ResponseEntity.ok("안부전화 서비스가 수락되었습니다."); + } + + @Operation(summary = "소통 보고서 작성", description = "시니또가 안부전화 후에 보고서를 작성합니다.") + @PostMapping("/reports") + public ResponseEntity createHelloCallReport(@RequestBody HelloCallReportRequest request) { + // 임시 응답 + return ResponseEntity.ok("소통 보고서가 작성되었습니다."); + } + + @Operation(summary = "서비스 수행 완료", description = "시니또가 안부전화 수행을 완료합니다.") + @PutMapping("/complete/{callId}") + public ResponseEntity completeHelloCall(@PathVariable Long callId) { + // 임시 응답 + return ResponseEntity.ok("안부전화 서비스가 완료되었습니다."); + } + + @Operation(summary = "소통 보고서 조회", description = "보호자가 보고서 조회합니다.") + @GetMapping("/reports") + public ResponseEntity getHelloCallReports() { + // 임시 응답 + return ResponseEntity.ok(new HelloCallDetailResponse(null, null, null, null)); + } + + @Operation(summary = "소통 보고서 상세조회", description = "보호자가 보고서 상세정보를 조회합니다.") + @GetMapping("/reports/{reportId}") + public ResponseEntity getHelloCallReportDetail(@PathVariable Long reportId) { + // 임시 응답 + return ResponseEntity.ok(new HelloCallDetailResponse(null, null, null, null)); + } + + @Operation(summary = "진행중인 안부 서비스 취소 요청", description = "시니또가 진행중인 안부전화 서비스를 취소합니다.") + @PutMapping("/cancel/{callId}") + public ResponseEntity cancelHelloCall(@PathVariable Long callId) { + // 임시 응답 + return ResponseEntity.ok("안부전화 서비스가 취소되었습니다."); + } + +} diff --git a/src/main/java/com/example/sinitto/helloCall/dto/HelloCallDetailResponse.java b/src/main/java/com/example/sinitto/helloCall/dto/HelloCallDetailResponse.java new file mode 100644 index 00000000..a5a177c0 --- /dev/null +++ b/src/main/java/com/example/sinitto/helloCall/dto/HelloCallDetailResponse.java @@ -0,0 +1,20 @@ +package com.example.sinitto.helloCall.dto; + +import java.time.LocalTime; +import java.util.Date; +import java.util.List; + +public record HelloCallDetailResponse( + Date startDate, + Date endDate, + List timeSlots, + String content +) { + + public record TimeSlot( + String day, + LocalTime startTime, + LocalTime endTime, + int serviceTime) { + } +} diff --git a/src/main/java/com/example/sinitto/helloCall/dto/HelloCallReportRequest.java b/src/main/java/com/example/sinitto/helloCall/dto/HelloCallReportRequest.java new file mode 100644 index 00000000..23b18fad --- /dev/null +++ b/src/main/java/com/example/sinitto/helloCall/dto/HelloCallReportRequest.java @@ -0,0 +1,20 @@ +package com.example.sinitto.helloCall.dto; + +import java.time.LocalTime; +import java.util.Date; +import java.util.List; + +public record HelloCallReportRequest( + Date startDate, + Date endDate, + List timeSlots, + String content +) { + + public record TimeSlot( + String day, + LocalTime startTime, + LocalTime endTime, + int serviceTime) { + } +} diff --git a/src/main/java/com/example/sinitto/helloCall/dto/HelloCallRequest.java b/src/main/java/com/example/sinitto/helloCall/dto/HelloCallRequest.java new file mode 100644 index 00000000..ec11e618 --- /dev/null +++ b/src/main/java/com/example/sinitto/helloCall/dto/HelloCallRequest.java @@ -0,0 +1,21 @@ +package com.example.sinitto.helloCall.dto; + +import java.time.LocalTime; +import java.util.Date; +import java.util.List; + +public record HelloCallRequest( + Long seniorId, + Date startDate, + Date endDate, + List timeSlots, + String content +) { + + public record TimeSlot( + String day, + LocalTime startTime, + LocalTime endTime, + int serviceTime) { + } +} diff --git a/src/main/java/com/example/sinitto/helloCall/dto/HelloCallResponse.java b/src/main/java/com/example/sinitto/helloCall/dto/HelloCallResponse.java new file mode 100644 index 00000000..0c7387a6 --- /dev/null +++ b/src/main/java/com/example/sinitto/helloCall/dto/HelloCallResponse.java @@ -0,0 +1,7 @@ +package com.example.sinitto.helloCall.dto; + +public record HelloCallResponse( + Long helloCallId, + String seniorName, + boolean[] days) { +} diff --git a/src/main/java/com/example/sinitto/member/controller/MemberController.java b/src/main/java/com/example/sinitto/member/controller/MemberController.java new file mode 100644 index 00000000..bdc22926 --- /dev/null +++ b/src/main/java/com/example/sinitto/member/controller/MemberController.java @@ -0,0 +1,31 @@ +package com.example.sinitto.member.controller; + +import com.example.sinitto.member.dto.GuardSignupRequest; +import com.example.sinitto.member.dto.SinittoSignupRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/members") +@Tag(name = "[미구현]회원가입", description = "회원가입 시 정보 입력 관련 API") +public class MemberController { + + @Operation(summary = "시니또 회원가입", description = "시니또의 회원가입") + @PostMapping("/sinitto") + public ResponseEntity sinittoSignup(@RequestBody SinittoSignupRequest request) { + // 임시 응답 + return ResponseEntity.ok("시니또 회원가입이 완료되었습니다."); + } + + @Operation(summary = "보호자 회원가입", description = "보호자의 회원가입") + @PostMapping("/guard") + public ResponseEntity guardSignup(@RequestBody GuardSignupRequest request) { + // 임시 응답 + return ResponseEntity.ok("보호자 회원가입이 완료되었습니다."); + } +} diff --git a/src/main/java/com/example/sinitto/member/dto/GuardSignupRequest.java b/src/main/java/com/example/sinitto/member/dto/GuardSignupRequest.java new file mode 100644 index 00000000..e77d227f --- /dev/null +++ b/src/main/java/com/example/sinitto/member/dto/GuardSignupRequest.java @@ -0,0 +1,7 @@ +package com.example.sinitto.member.dto; + +public record GuardSignupRequest( + String name, + String email, + String phoneNumber) { +} diff --git a/src/main/java/com/example/sinitto/member/dto/SinittoSignupRequest.java b/src/main/java/com/example/sinitto/member/dto/SinittoSignupRequest.java new file mode 100644 index 00000000..ad7232b4 --- /dev/null +++ b/src/main/java/com/example/sinitto/member/dto/SinittoSignupRequest.java @@ -0,0 +1,9 @@ +package com.example.sinitto.member.dto; + +public record SinittoSignupRequest( + String name, + String phoneNumber, + String email, + String accountNumber, + String bankName) { +} diff --git a/src/main/java/com/example/sinitto/member/entity/Member.java b/src/main/java/com/example/sinitto/member/entity/Member.java new file mode 100644 index 00000000..dab35cc5 --- /dev/null +++ b/src/main/java/com/example/sinitto/member/entity/Member.java @@ -0,0 +1,24 @@ +package com.example.sinitto.member.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.validation.constraints.NotNull; + +@Entity +public class Member { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + @NotNull + private String name; + @NotNull + private String phoneNumber; + @NotNull + private String email; + @NotNull + private boolean isSinitto; + +} diff --git a/src/main/java/com/example/sinitto/member/entity/Senior.java b/src/main/java/com/example/sinitto/member/entity/Senior.java new file mode 100644 index 00000000..6517a14b --- /dev/null +++ b/src/main/java/com/example/sinitto/member/entity/Senior.java @@ -0,0 +1,24 @@ +package com.example.sinitto.member.entity; + +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +@Entity +public class Senior { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + @NotNull + private String name; + @NotNull + private String phoneNumber; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + @NotNull + @OnDelete(action = OnDeleteAction.CASCADE) + private Member member; + +} diff --git a/src/main/java/com/example/sinitto/member/entity/Sinitto.java b/src/main/java/com/example/sinitto/member/entity/Sinitto.java new file mode 100644 index 00000000..e16ed8cc --- /dev/null +++ b/src/main/java/com/example/sinitto/member/entity/Sinitto.java @@ -0,0 +1,24 @@ +package com.example.sinitto.member.entity; + +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +@Entity +public class Sinitto { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + @NotNull + private String bankName; + @NotNull + private String accountNumber; + @OneToOne + @JoinColumn(name = "member_id") + @NotNull + @OnDelete(action = OnDeleteAction.CASCADE) + private Member member; + +} diff --git a/src/main/java/com/example/sinitto/point/controller/PointController.java b/src/main/java/com/example/sinitto/point/controller/PointController.java new file mode 100644 index 00000000..1fe64765 --- /dev/null +++ b/src/main/java/com/example/sinitto/point/controller/PointController.java @@ -0,0 +1,54 @@ +package com.example.sinitto.point.controller; + +import com.example.sinitto.point.dto.PointLogResponse; +import com.example.sinitto.point.dto.PointRequest; +import com.example.sinitto.point.dto.PointResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/api/points") +@Tag(name = "[미구현]포인트", description = "포인트 API") +public class PointController { + + @Operation(summary = "포인트 추가", description = "(임시) 관리자가 직접 추가 - 이후 외부 결제 api 연동") + @PutMapping("/add") + public ResponseEntity addPoints(@RequestBody PointRequest request) { + // 임시 응답 + return ResponseEntity.ok("포인트가 추가되었습니다."); + } + + @Operation(summary = "포인트 차감", description = "요청사항 등록 시 포인트를 차감합니다.") + @PutMapping("/deduct") + public ResponseEntity deductPoints(@RequestBody PointRequest request) { + // 임시 응답 + return ResponseEntity.ok("포인트가 차감되었습니다."); + } + + @Operation(summary = "포인트 조회", description = "시니또, 보호자가 본인의 포인트를 조회합니다.") + @GetMapping() + public ResponseEntity getPoint() { + // 임시 응답 + return ResponseEntity.ok(new PointResponse(1000)); + } + + @Operation(summary = "포인트 출금 요청", description = "시니또가 포인트 출금을 요청합니다.") + @PostMapping("/withdraw") + public ResponseEntity requestPointWithdraw(@RequestBody PointRequest request) { + // 임시 응답 + return ResponseEntity.ok("포인트 출금 요청이 완료되었습니다."); + } + + @Operation(summary = "포인트 로그 조회", description = "포인트 로그를 조회합니다.") + @GetMapping("/logs") + public ResponseEntity> getPointLogs() { + // 임시 응답 + return ResponseEntity.ok(new ArrayList<>()); + } + +} diff --git a/src/main/java/com/example/sinitto/point/dto/PointLogResponse.java b/src/main/java/com/example/sinitto/point/dto/PointLogResponse.java new file mode 100644 index 00000000..2eea0f96 --- /dev/null +++ b/src/main/java/com/example/sinitto/point/dto/PointLogResponse.java @@ -0,0 +1,10 @@ +package com.example.sinitto.point.dto; + +import java.time.LocalDateTime; + +public record PointLogResponse( + LocalDateTime postTime, + String requirementContent, + int price, + String type) { +} diff --git a/src/main/java/com/example/sinitto/point/dto/PointRequest.java b/src/main/java/com/example/sinitto/point/dto/PointRequest.java new file mode 100644 index 00000000..7e637dab --- /dev/null +++ b/src/main/java/com/example/sinitto/point/dto/PointRequest.java @@ -0,0 +1,5 @@ +package com.example.sinitto.point.dto; + +public record PointRequest( + int price) { +} diff --git a/src/main/java/com/example/sinitto/point/dto/PointResponse.java b/src/main/java/com/example/sinitto/point/dto/PointResponse.java new file mode 100644 index 00000000..a90d8582 --- /dev/null +++ b/src/main/java/com/example/sinitto/point/dto/PointResponse.java @@ -0,0 +1,5 @@ +package com.example.sinitto.point.dto; + +public record PointResponse( + int price) { +} diff --git a/src/main/java/com/example/sinitto/point/entity/Point.java b/src/main/java/com/example/sinitto/point/entity/Point.java new file mode 100644 index 00000000..f53d09cc --- /dev/null +++ b/src/main/java/com/example/sinitto/point/entity/Point.java @@ -0,0 +1,23 @@ +package com.example.sinitto.point.entity; + +import com.example.sinitto.member.entity.Member; +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +@Entity +public class Point { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + @NotNull + private int price; + @OneToOne + @JoinColumn(name = "member_id") + @NotNull + @OnDelete(action = OnDeleteAction.CASCADE) + private Member member; + +} diff --git a/src/main/java/com/example/sinitto/point/entity/PointLog.java b/src/main/java/com/example/sinitto/point/entity/PointLog.java new file mode 100644 index 00000000..edcf6d40 --- /dev/null +++ b/src/main/java/com/example/sinitto/point/entity/PointLog.java @@ -0,0 +1,32 @@ +package com.example.sinitto.point.entity; + +import com.example.sinitto.member.entity.Member; +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.time.LocalDateTime; + +@Entity +@EntityListeners(AuditingEntityListener.class) +public class PointLog { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + @NotNull + private int price; + @CreatedDate + private LocalDateTime postTime; + @NotNull + private String type; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + @NotNull + @OnDelete(action = OnDeleteAction.CASCADE) + private Member member; + +} diff --git a/src/main/java/com/example/sinitto/review/controller/ReviewController.java b/src/main/java/com/example/sinitto/review/controller/ReviewController.java new file mode 100644 index 00000000..326a6880 --- /dev/null +++ b/src/main/java/com/example/sinitto/review/controller/ReviewController.java @@ -0,0 +1,31 @@ +package com.example.sinitto.review.controller; + +import com.example.sinitto.review.dto.ReviewRequest; +import com.example.sinitto.review.dto.ReviewResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/api/reviews") +@Tag(name = "[미구현]리뷰", description = "서비스 리뷰 관련 API") +public class ReviewController { + + @Operation(summary = "서비스 리뷰 리스트 보기", description = "서비스 리뷰를 리스트 형태로 보여줍니다.") + @GetMapping + public ResponseEntity> getReviewList() { + // 임시 응답 + return ResponseEntity.ok(new ArrayList<>()); + } + + @Operation(summary = "서비스 리뷰 및 평가 제출", description = "시니또에 대한 별점과 작성한 평가 내용(선택사항)을 제출합니다.") + @PostMapping + public ResponseEntity submitReview(@RequestBody ReviewRequest request) { + // 임시 응답 + return ResponseEntity.ok("리뷰가 성공적으로 제출되었습니다."); + } +} diff --git a/src/main/java/com/example/sinitto/review/dto/ReviewRequest.java b/src/main/java/com/example/sinitto/review/dto/ReviewRequest.java new file mode 100644 index 00000000..335422df --- /dev/null +++ b/src/main/java/com/example/sinitto/review/dto/ReviewRequest.java @@ -0,0 +1,6 @@ +package com.example.sinitto.review.dto; + +public record ReviewRequest( + int starCount, + String content) { +} diff --git a/src/main/java/com/example/sinitto/review/dto/ReviewResponse.java b/src/main/java/com/example/sinitto/review/dto/ReviewResponse.java new file mode 100644 index 00000000..0fe0e2d6 --- /dev/null +++ b/src/main/java/com/example/sinitto/review/dto/ReviewResponse.java @@ -0,0 +1,10 @@ +package com.example.sinitto.review.dto; + +import java.util.Date; + +public record ReviewResponse( + String name, + int starCount, + Date postDate, + String content) { +} diff --git a/src/main/java/com/example/sinitto/sinitto/controller/SinittoController.java b/src/main/java/com/example/sinitto/sinitto/controller/SinittoController.java new file mode 100644 index 00000000..9b07916b --- /dev/null +++ b/src/main/java/com/example/sinitto/sinitto/controller/SinittoController.java @@ -0,0 +1,47 @@ +package com.example.sinitto.sinitto.controller; + +import com.example.sinitto.sinitto.dto.SinittoRequest; +import com.example.sinitto.sinitto.dto.SinittoResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/api/sinittos") +@Tag(name = "[미구현]마이페이지 - 시니또용", description = "시니또 관련 마이페이지 API") +public class SinittoController { + + @Operation(summary = "시니또 본인 정보 조회", description = "시니또 본인의 정보를 요청한다.") + @GetMapping + public ResponseEntity getSinittoInfo() { + // 임시 응답 + return ResponseEntity.ok(new SinittoResponse(null, null, null, null, null)); + } + + @Operation(summary = "시니또 본인 정보 수정", description = "시니또 본인의 정보를 수정요청한다.") + @PutMapping + public ResponseEntity updateSinittoInfo(@RequestBody SinittoRequest request) { + // 임시 응답 + return ResponseEntity.ok("시니또 정보가 수정되었습니다."); + } + + //Pass + @Operation(summary = "시니또 삭제", description = "관리자용") + @DeleteMapping + public ResponseEntity deleteSinitto() { + // 임시 응답 + return ResponseEntity.ok("시니또가 삭제되었습니다."); + } + + //Pass + @Operation(summary = "모든 시니또 조회", description = "관리자용") + @GetMapping("/all") + public ResponseEntity> getAllSinittos() { + // 임시 응답 + return ResponseEntity.ok(new ArrayList<>()); + } +} diff --git a/src/main/java/com/example/sinitto/sinitto/dto/SinittoRequest.java b/src/main/java/com/example/sinitto/sinitto/dto/SinittoRequest.java new file mode 100644 index 00000000..8f04c960 --- /dev/null +++ b/src/main/java/com/example/sinitto/sinitto/dto/SinittoRequest.java @@ -0,0 +1,9 @@ +package com.example.sinitto.sinitto.dto; + +public record SinittoRequest( + String name, + String phoneNumber, + String email, + String accountNumber, + String bankName) { +} diff --git a/src/main/java/com/example/sinitto/sinitto/dto/SinittoResponse.java b/src/main/java/com/example/sinitto/sinitto/dto/SinittoResponse.java new file mode 100644 index 00000000..c5223649 --- /dev/null +++ b/src/main/java/com/example/sinitto/sinitto/dto/SinittoResponse.java @@ -0,0 +1,9 @@ +package com.example.sinitto.sinitto.dto; + +public record SinittoResponse( + String name, + String phoneNumber, + String email, + String accountNumber, + String bankName) { +} From 629c1d334b9de1bc776a06e21bd6772acfbeddfd Mon Sep 17 00:00:00 2001 From: Seonghun Jeong Date: Fri, 27 Sep 2024 20:06:52 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Chore:=20=EC=9E=98=EB=AA=BB=EB=90=9C=20?= =?UTF-8?q?=EB=A8=B8=EC=A7=80=20=EA=B2=B0=EA=B3=BC=20=EC=88=98=EC=A0=95(?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20SwaggerConfig=20=EC=A0=9C=EA=B1=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/sinitto/config/SwaggerConfig.java | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 src/main/java/com/example/sinitto/config/SwaggerConfig.java diff --git a/src/main/java/com/example/sinitto/config/SwaggerConfig.java b/src/main/java/com/example/sinitto/config/SwaggerConfig.java deleted file mode 100644 index afae08e0..00000000 --- a/src/main/java/com/example/sinitto/config/SwaggerConfig.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.example.sinitto.config; - -import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class SwaggerConfig { - - @Bean - public OpenAPI openAPI() { - return new OpenAPI() - .components(new Components()) - .info(apiInfo()); - } - - private Info apiInfo() { - return new Info() - .title("나만의 작은 시니또") - .description("아자아자 화이팅") - .version("0.0.1"); - } -} From 593482412b47350bd89ea5b90dccf880f3f37768 Mon Sep 17 00:00:00 2001 From: JIHO LEE <161289673+GitJIHO@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:39:37 +0900 Subject: [PATCH 3/3] =?UTF-8?q?DOCS:=20Docker=EC=99=80=20CI/CD=EB=A5=BC=20?= =?UTF-8?q?=ED=99=9C=EC=9A=A9=ED=95=9C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=20=EC=9D=BC=EA=B4=80=EC=84=B1=20=EB=B0=8F=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=ED=99=94=EB=90=9C=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=ED=92=88=EC=A7=88=20=EA=B4=80=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e0ac9ba7..d3cd7427 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ 나만의 작은 시니또 -## 목차 +## 바로가기 - [🤔 시니또가 무엇인가요?](#시니또가-무엇인가요) - [🧑🏻‍💻 어떤 서비스인가요?](#어떤-서비스인가요) - [💬 핵심 기능 간략한 설명](#핵심-기능-간략한-설명) @@ -457,6 +457,37 @@ redis-server image-3 image-3 +### 4. Docker와 CI/CD를 활용한 테스트 환경 일관성 및 자동화된 코드 품질 관리 +> **1. Docker를 통한 테스트 환경 일관성** + +**일관된 환경**: Docker로 Redis와 MySQL을 컨테이너로 관리해, 모든 개발자와 CI/CD 환경에서 동일한 테스트 환경을 보장했습니다. + +**빠른 초기화**: Docker 이미지를 통해 데이터베이스와 캐시 서버를 빠르게 설정하여, CI/CD에서 시간을 절약하도록 조치했습니다. + +> **2. 자동화된 테스트 및 코드 품질 관리** + +**PR 자동 테스트**: PR 생성 시 자동으로 모든 테스트가 실행되며, 코드 변경 사항에 대한 즉각적인 검증이 가능합니다. + +**결과 자동 코멘트**: 테스트 결과가 PR에 자동으로 코멘트로 남겨져, 리뷰어가 쉽게 확인할 수 있습니다. + +> **3. 실패한 코드 라인 피드백** + +**즉각적 피드백**: 실패한 테스트에 대한 코드 라인이 PR에 표시되어, 빠르게 문제를 해결할 수 있습니다. + +> **4. 높은 테스트 커버리지** + +**클래스 커버리지 80%**: 주요 모듈(callback, guard, review 등)에서 100% 커버리지를 달성하여, 높은 안정성을 확보했습니다. + +

+ image +

+

[ PR 자동 테스트 코멘트 ]

+
+

+ image +

+

[ 테스트 Coverage ]

+ ## 👩‍👩‍👧‍👧 협업 효율