-
Notifications
You must be signed in to change notification settings - Fork 0
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
12 changed files
with
253 additions
and
12 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
19 changes: 19 additions & 0 deletions
19
src/main/java/com/numberone/backend/domain/member/dto/request/OnboardingAddress.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,19 @@ | ||
package com.numberone.backend.domain.member.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class OnboardingAddress { | ||
@Schema(defaultValue = "서울특별시") | ||
private String lv1; | ||
|
||
@Schema(defaultValue = "영등포구") | ||
private String lv2; | ||
|
||
@Schema(defaultValue = "신길동") | ||
private String lv3; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/numberone/backend/domain/member/dto/request/OnboardingDisasterType.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,13 @@ | ||
package com.numberone.backend.domain.member.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class OnboardingDisasterType { | ||
@Schema(defaultValue = "화재") | ||
private String disasterType; | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/numberone/backend/domain/member/dto/request/OnboardingRequest.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,21 @@ | ||
package com.numberone.backend.domain.member.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class OnboardingRequest { | ||
@Schema(defaultValue = "초롱이") | ||
@NotNull | ||
private String nickname; | ||
|
||
private List<OnboardingAddress> addresses; | ||
|
||
private List<OnboardingDisasterType> disasterTypes; | ||
} |
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
40 changes: 40 additions & 0 deletions
40
...n/java/com/numberone/backend/domain/notificationdisaster/entity/NotificationDisaster.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,40 @@ | ||
package com.numberone.backend.domain.notificationdisaster.entity; | ||
|
||
import com.numberone.backend.domain.disaster.util.DisasterType; | ||
import com.numberone.backend.domain.member.entity.Member; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.Comment; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class NotificationDisaster { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Comment("재난 유형") | ||
@Enumerated(EnumType.STRING) | ||
private DisasterType disasterType; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@Builder | ||
public NotificationDisaster(DisasterType disasterType, Member member) { | ||
this.disasterType = disasterType; | ||
this.member = member; | ||
} | ||
|
||
public static NotificationDisaster of(DisasterType disasterType, Member member) { | ||
return NotificationDisaster.builder() | ||
.disasterType(disasterType) | ||
.member(member) | ||
.build(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...berone/backend/domain/notificationdisaster/repository/NotificationDisasterRepository.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,8 @@ | ||
package com.numberone.backend.domain.notificationdisaster.repository; | ||
|
||
import com.numberone.backend.domain.notificationdisaster.entity.NotificationDisaster; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface NotificationDisasterRepository extends JpaRepository<NotificationDisaster, Long> { | ||
void deleteAllByMemberId(Long memberId); | ||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/com/numberone/backend/domain/notificationregion/entity/NotificationRegion.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,56 @@ | ||
package com.numberone.backend.domain.notificationregion.entity; | ||
|
||
import com.numberone.backend.domain.member.entity.Member; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.Comment; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class NotificationRegion { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Comment("법정동 주소") | ||
private String location; | ||
|
||
@Comment("시/도") | ||
private String lv1; | ||
|
||
@Comment("구/군") | ||
private String lv2; | ||
|
||
@Comment("동/읍/면") | ||
private String lv3; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@Builder | ||
public NotificationRegion(String lv1, String lv2, String lv3, Member member) { | ||
this.lv1 = lv1; | ||
this.lv2 = lv2; | ||
this.lv3 = lv3; | ||
this.location = (lv1 + " " + lv2 + " " + lv3) | ||
.replace("null", "") | ||
.replace(" ", " ") | ||
.trim(); | ||
this.member = member; | ||
} | ||
|
||
public static NotificationRegion of(String lv1, String lv2, String lv3, Member member) { | ||
return NotificationRegion.builder() | ||
.lv1(lv1) | ||
.lv2(lv2) | ||
.lv3(lv3) | ||
.member(member) | ||
.build(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
.../numberone/backend/domain/notificationregion/repository/NotificationRegionRepository.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,8 @@ | ||
package com.numberone.backend.domain.notificationregion.repository; | ||
|
||
import com.numberone.backend.domain.notificationregion.entity.NotificationRegion; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface NotificationRegionRepository extends JpaRepository<NotificationRegion, Long> { | ||
void deleteAllByMemberId(Long memberId); | ||
} |
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