-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
707 additions
and
74 deletions.
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
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
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,38 @@ | ||
package com.ivory.ivory.config; | ||
|
||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.messaging.simp.config.MessageBrokerRegistry; | ||
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; | ||
import org.springframework.web.socket.config.annotation.StompEndpointRegistry; | ||
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; | ||
|
||
@Configuration | ||
@EnableWebSocketMessageBroker | ||
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { | ||
|
||
@Override | ||
public void configureMessageBroker(MessageBrokerRegistry registry) { | ||
// 클라이언트가 구독할 엔드포인트 | ||
registry.enableSimpleBroker("/topic"); | ||
// 클라이언트가 메시지를 보낼 엔드포인트 | ||
registry.setApplicationDestinationPrefixes("/app"); | ||
} | ||
|
||
@Override | ||
public void registerStompEndpoints(StompEndpointRegistry registry) { | ||
// WebSocket 연결 엔드포인트 | ||
registry.addEndpoint("/ws") | ||
.setAllowedOriginPatterns( | ||
"*" | ||
); | ||
registry.addEndpoint("/ws") | ||
.setAllowedOriginPatterns( | ||
"https://ivorygroup.click", | ||
"https://danpoong-ivory.vercel.app", | ||
"http://localhost:3000" | ||
) | ||
.withSockJS(); // SockJS 지원 | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/com/ivory/ivory/controller/CaregiverController.java
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,47 @@ | ||
package com.ivory.ivory.controller; | ||
|
||
import com.ivory.ivory.service.CaregiverService; | ||
import com.ivory.ivory.util.SecurityUtil; | ||
import com.ivory.ivory.util.response.CustomApiResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/caregivers") | ||
@RequiredArgsConstructor | ||
public class CaregiverController { | ||
|
||
private final CaregiverService caregiverService; | ||
private final SecurityUtil securityUtil; | ||
|
||
@GetMapping("/list") | ||
public ResponseEntity<?> getCareList () { | ||
Long currentMemberId = securityUtil.getCurrentMemberId(); | ||
CustomApiResponse<?> response =caregiverService.getCareList(currentMemberId); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@GetMapping("/{applyId}") | ||
public ResponseEntity<?> getCareDetail(@PathVariable Long applyId) { | ||
Long currentMemberId = securityUtil.getCurrentMemberId(); | ||
CustomApiResponse<?> response = caregiverService.getCareDetail(currentMemberId,applyId); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@PostMapping("/{applyId}") | ||
public ResponseEntity<?> AcceptCare (@PathVariable Long applyId) { | ||
Long currentMemberId = securityUtil.getCurrentMemberId(); | ||
CustomApiResponse<?> response = caregiverService.AcceptCare(currentMemberId,applyId); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@GetMapping() | ||
public ResponseEntity<?> getMatchedCare() { | ||
Long currentMemberId = securityUtil.getCurrentMemberId(); | ||
CustomApiResponse<?> response = caregiverService.getMatchedCare(currentMemberId); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
|
||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.ivory.ivory.domain; | ||
|
||
public enum Authority { | ||
ROLE_USER, ROLE_ADMIN | ||
ROLE_USER, ROLE_CAREGIVER, ROLE_ADMIN | ||
} |
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,40 @@ | ||
package com.ivory.ivory.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@Entity | ||
@Table(name="caregiver") | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Caregiver { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "caregiver_seq") | ||
@SequenceGenerator( | ||
name = "caregiver_seq", // 시퀀스 제너레이터 이름 | ||
sequenceName = "caregiver_sequence", // 실제 데이터베이스 시퀀스 이름 | ||
initialValue = 100, // 시작 값 | ||
allocationSize = 1 // 증가 값 | ||
) | ||
@Column(name="id") | ||
private Long id; | ||
|
||
@Column(name="email") | ||
private String email; | ||
|
||
@Column(name="password") | ||
private String password; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private Authority authority; | ||
|
||
public static Caregiver toEntity(String email, String password) { | ||
return Caregiver.builder() | ||
.email(email) | ||
.password(password) | ||
.authority(Authority.ROLE_CAREGIVER) | ||
.build(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.ivory.ivory.domain; | ||
|
||
public enum Status { | ||
YET, IN_PROGRESS, COMPLETE | ||
YET, MATCHED, IN_PROGRESS, COMPLETE | ||
} |
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
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 com.ivory.ivory.dto; | ||
|
||
import lombok.*; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class CareDetailDto { | ||
private String applyDate; | ||
private String careDate; | ||
private String careTime; | ||
private String memo; | ||
private String childName; | ||
private String birthDate; | ||
private Long age; | ||
private String diagnosisName; | ||
private String image; | ||
|
||
public static CareDetailDto from ( | ||
String applyDate, | ||
String careDate, | ||
String careTime, | ||
String memo, | ||
String childName, | ||
String birthDate, | ||
Long age, | ||
String diagnosisName, | ||
String image) { | ||
return CareDetailDto.builder() | ||
.applyDate(applyDate) | ||
.careDate(careDate) | ||
.careTime(careTime) | ||
.memo(memo) | ||
.childName(childName) | ||
.birthDate(birthDate) | ||
.age(age) | ||
.diagnosisName(diagnosisName) | ||
.image(image) | ||
.build(); | ||
} | ||
} | ||
|
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,28 @@ | ||
package com.ivory.ivory.dto; | ||
|
||
import lombok.*; | ||
|
||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class CareDto { | ||
private Long id; | ||
private String careDate; | ||
private String careTime; | ||
private String childName; | ||
private Long age; | ||
private String image; | ||
|
||
public static CareDto of(Long id, String careDate, String careTime, String childName, Long age, String image) { | ||
return CareDto.builder() | ||
.id(id) | ||
.careDate(careDate) | ||
.careTime(careTime) | ||
.childName(childName) | ||
.age(age) | ||
.image(image) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.