-
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.
feat: introduce UserContextData and Auditable
feat: CommonConstant feat: CommonMapper feat: introduce AbstractAuditableEntity, AbstractBaseEntity interface in common
- Loading branch information
1 parent
7540621
commit 829e596
Showing
22 changed files
with
295 additions
and
186 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
10 changes: 10 additions & 0 deletions
10
sep490-common/src/main/java/sep490/common/api/AuditableEntity.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,10 @@ | ||
package sep490.common.api; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public interface AuditableEntity { | ||
String getCreatedBy(); | ||
LocalDateTime getCreatedDate(); | ||
String getLastModifiedBy(); | ||
LocalDateTime getLastModifiedDate(); | ||
} |
8 changes: 8 additions & 0 deletions
8
sep490-common/src/main/java/sep490/common/api/BaseEntity.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 sep490.common.api; | ||
|
||
import java.util.UUID; | ||
|
||
public interface BaseEntity { | ||
UUID getId(); | ||
int getVersion(); | ||
} |
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
14 changes: 0 additions & 14 deletions
14
sep490-common/src/main/java/sep490/common/api/dto/SearchCriteria.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
sep490-common/src/main/java/sep490/common/api/dto/SearchCriteriaDTO.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 sep490.common.api.dto; | ||
|
||
import java.util.List; | ||
|
||
public record SearchCriteriaDTO<T>( | ||
PageDTO page, | ||
List<SortDTO> sorts, | ||
T criteria | ||
) { | ||
public static <T> SearchCriteriaDTO<T> of(PageDTO page, List<SortDTO> sorts, T criteria) { | ||
return new SearchCriteriaDTO<>(page, sorts, criteria); | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
sep490-common/src/main/java/sep490/common/api/utils/CommonConstant.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,11 @@ | ||
package sep490.common.api.utils; | ||
|
||
public final class CommonConstant { | ||
|
||
// RFC5322 | ||
public static final String EMAIL_PATTERN = "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$"; | ||
|
||
private CommonConstant() { | ||
// Utility class. No instantiation allowed. | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
sep490-idp/src/main/java/sep490/idp/configs/AuditorAwareImpl.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 sep490.idp.configs; | ||
|
||
import jakarta.annotation.Nonnull; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.domain.AuditorAware; | ||
import sep490.idp.security.UserContextData; | ||
import sep490.idp.utils.SecurityUtils; | ||
|
||
import java.util.Optional; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class AuditorAwareImpl implements AuditorAware<String> { | ||
|
||
@Nonnull | ||
@Override | ||
public Optional<String> getCurrentAuditor() { | ||
return SecurityUtils.getUserContextData().map(UserContextData::getUsername); | ||
} | ||
} |
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
90 changes: 58 additions & 32 deletions
90
sep490-idp/src/main/java/sep490/idp/entity/AbstractBaseEntity.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
Oops, something went wrong.