-
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.
Merge pull request #214 from TEAM-SAMSION/PET-312
PET-312 랜딩 API 구현
- Loading branch information
Showing
10 changed files
with
153 additions
and
23 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
26 changes: 26 additions & 0 deletions
26
...User-Application/src/main/java/com/pawith/userapplication/dto/request/LandingRequest.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,26 @@ | ||
package com.pawith.userapplication.dto.request; | ||
|
||
import java.util.regex.Pattern; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class LandingRequest { | ||
|
||
private static final Pattern EMAIL_PATTERN = Pattern.compile("^[A-Za-z0-9+_.-]+@(.+)$"); | ||
|
||
private String email; | ||
private String name; | ||
|
||
public void setEmail(String email) { | ||
if (!EMAIL_PATTERN.matcher(email).matches()) { | ||
throw new IllegalArgumentException("Email should be valid"); | ||
} | ||
this.email = email; | ||
} | ||
|
||
} |
16 changes: 8 additions & 8 deletions
16
...r-Application/src/main/java/com/pawith/userapplication/dto/response/UserInfoResponse.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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package com.pawith.userapplication.dto.response; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class UserInfoResponse { | ||
private final String nickname; | ||
private final String email; | ||
private final String profileImageUrl; | ||
private String nickname; | ||
private String email; | ||
private String profileImageUrl; | ||
|
||
public UserInfoResponse(String nickname, String email, String profileImageUrl) { | ||
this.nickname = nickname; | ||
this.email = email; | ||
this.profileImageUrl = profileImageUrl; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...odule/User-Application/src/main/java/com/pawith/userapplication/mapper/LandingMapper.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,15 @@ | ||
package com.pawith.userapplication.mapper; | ||
|
||
import com.pawith.userapplication.dto.request.LandingRequest; | ||
import com.pawith.userdomain.entity.Landing; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class LandingMapper { | ||
|
||
public static Landing toLandingEntity(LandingRequest landingRequest) { | ||
return new Landing(landingRequest.getEmail(), landingRequest.getName()); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
...er-Application/src/main/java/com/pawith/userapplication/service/LandingCreateUseCase.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,22 @@ | ||
package com.pawith.userapplication.service; | ||
|
||
import com.pawith.commonmodule.annotation.ApplicationService; | ||
import com.pawith.userapplication.dto.request.LandingRequest; | ||
import com.pawith.userapplication.mapper.LandingMapper; | ||
import com.pawith.userdomain.entity.Landing; | ||
import com.pawith.userdomain.service.LandingSaveService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@ApplicationService | ||
@RequiredArgsConstructor | ||
public class LandingCreateUseCase { | ||
private final LandingSaveService landingSaveService; | ||
|
||
@Transactional | ||
public void createLanding(LandingRequest request){ | ||
Landing landing = LandingMapper.toLandingEntity(request); | ||
landingSaveService.saveUserLanding(landing); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...in-Module/User-Module/User-Domain/src/main/java/com/pawith/userdomain/entity/Landing.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,31 @@ | ||
package com.pawith.userdomain.entity; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Landing { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "landing_id") | ||
private Long id; | ||
|
||
private String email; | ||
|
||
private String name; | ||
|
||
public Landing(String email, String name) { | ||
this.email = email; | ||
this.name = name; | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...-Module/User-Domain/src/main/java/com/pawith/userdomain/repository/LandingRepository.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,7 @@ | ||
package com.pawith.userdomain.repository; | ||
|
||
import com.pawith.userdomain.entity.Landing; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface LandingRepository extends JpaRepository<Landing, Long> { | ||
} |
17 changes: 17 additions & 0 deletions
17
...er-Module/User-Domain/src/main/java/com/pawith/userdomain/service/LandingSaveService.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,17 @@ | ||
package com.pawith.userdomain.service; | ||
|
||
import com.pawith.commonmodule.annotation.DomainService; | ||
import com.pawith.userdomain.entity.Landing; | ||
import com.pawith.userdomain.repository.LandingRepository; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@DomainService | ||
@RequiredArgsConstructor | ||
public class LandingSaveService { | ||
private final LandingRepository landingRepository; | ||
|
||
public void saveUserLanding(Landing landing) { | ||
landingRepository.save(landing); | ||
} | ||
|
||
} |
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