-
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 #19 from KusitmsHDmedi/feature/14-user
[feat] 초대 code 생성 api 구현
- Loading branch information
Showing
5 changed files
with
106 additions
and
9 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
24 changes: 24 additions & 0 deletions
24
src/main/java/com/kusithm/hdmedi_server/domain/user/domain/AuthCode.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,24 @@ | ||
package com.kusithm.hdmedi_server.domain.user.domain; | ||
|
||
import jakarta.persistence.Id; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import org.springframework.data.redis.core.RedisHash; | ||
|
||
@AllArgsConstructor | ||
@Builder | ||
@Getter | ||
@RedisHash(value = "authCode", timeToLive = 604800000) | ||
public class AuthCode { | ||
@Id | ||
private String authCode; | ||
private Long id; | ||
|
||
public static AuthCode createAuthCode(String authCode, Long id){ | ||
return AuthCode.builder() | ||
.authCode(authCode) | ||
.id(id) | ||
.build(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/kusithm/hdmedi_server/domain/user/dto/response/AuthCodeResponseDto.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,16 @@ | ||
package com.kusithm.hdmedi_server.domain.user.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@Getter | ||
public class AuthCodeResponseDto { | ||
private String authCode; | ||
|
||
public static AuthCodeResponseDto of(String authCode){ | ||
return AuthCodeResponseDto.builder() | ||
.authCode(authCode) | ||
.build(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/kusithm/hdmedi_server/domain/user/repository/AuthCodeRepository.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.kusithm.hdmedi_server.domain.user.repository; | ||
|
||
import com.kusithm.hdmedi_server.domain.user.domain.AuthCode; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface AuthCodeRepository extends CrudRepository<AuthCode, Long> { | ||
boolean existsByAuthCode(String authCode); | ||
} |
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