-
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.
⒠루ν΄μ΄ μμΌλΉ νλλ§ ν λΉ λλλ‘ μμ β’ μ€λμ λ£¨ν΄ μ‘°ν API ꡬν β’ κ±Έμμ μμ±, μμ API ꡬν
- Loading branch information
Showing
83 changed files
with
976 additions
and
182 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
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
24 changes: 24 additions & 0 deletions
24
.../src/main/kotlin/com/info/maeumgagym/domain/routine/repository/RoutineNativeRepository.kt
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.info.maeumgagym.domain.routine.repository | ||
|
||
import com.info.maeumgagym.TableNames | ||
import com.info.maeumgagym.domain.routine.entity.RoutineJpaEntity | ||
import org.springframework.data.jpa.repository.Query | ||
import org.springframework.data.repository.Repository | ||
import org.springframework.data.repository.query.Param | ||
import java.util.* | ||
|
||
@org.springframework.stereotype.Repository | ||
interface RoutineNativeRepository : Repository<RoutineJpaEntity, Long?> { | ||
|
||
@Query( | ||
value = "SELECT * FROM ${TableNames.ROUTINE_TABLE} r " + | ||
"INNER JOIN ${TableNames.ROUTINE_TABLE}_day_of_weeks d " + | ||
"ON r.id = d.${TableNames.ROUTINE_TABLE}_id " + | ||
"WHERE r.is_archived = false AND r.user_id = :userId AND d.day_of_weeks LIKE :dayOfWeek", | ||
nativeQuery = true | ||
) | ||
fun findByUserIdAndDayOfWeekAndIsArchivedFalse( | ||
@Param("userId") userId: UUID, | ||
@Param("dayOfWeek") dayOfWeek: String | ||
): RoutineJpaEntity? | ||
} |
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
22 changes: 22 additions & 0 deletions
22
...gym-application/src/main/kotlin/com/info/maeumgagym/domain/step/StepPersistenceAdapter.kt
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.info.maeumgagym.domain.step | ||
|
||
import com.info.common.PersistenceAdapter | ||
import com.info.maeumgagym.domain.step.mapper.StepMapper | ||
import com.info.maeumgagym.domain.step.repository.StepRepository | ||
import com.info.maeumgagym.step.model.Step | ||
import com.info.maeumgagym.step.port.out.ReadStepPort | ||
import com.info.maeumgagym.step.port.out.SaveStepPort | ||
import org.springframework.transaction.annotation.Propagation | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@PersistenceAdapter | ||
internal class StepPersistenceAdapter( | ||
private val stepRepository: StepRepository, | ||
private val stepMapper: StepMapper | ||
) : SaveStepPort, ReadStepPort { | ||
override fun readByUserOauthId(oauthId: String): Step? = | ||
stepRepository.findById(oauthId)?.let { stepMapper.toDomain(it) } | ||
|
||
@Transactional(propagation = Propagation.MANDATORY) | ||
override fun save(step: Step): Step = stepMapper.toDomain(stepRepository.save(stepMapper.toEntity(step))) | ||
} |
24 changes: 24 additions & 0 deletions
24
...gym-application/src/main/kotlin/com/info/maeumgagym/domain/step/entity/StepRedisEntity.kt
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.info.maeumgagym.domain.step.entity | ||
|
||
import com.info.maeumgagym.TableNames | ||
import org.springframework.data.annotation.Id | ||
import org.springframework.data.redis.core.RedisHash | ||
import org.springframework.data.redis.core.TimeToLive | ||
|
||
@RedisHash(value = TableNames.REDIS_STEP_TABLE) | ||
class StepRedisEntity( | ||
id: String, | ||
numberOfSteps: Int, | ||
ttl: Long | ||
) { | ||
@Id | ||
var id: String = id | ||
protected set | ||
|
||
var numberOfSteps: Int = numberOfSteps | ||
protected set | ||
|
||
@TimeToLive | ||
var ttl: Long = ttl | ||
protected set | ||
} |
24 changes: 24 additions & 0 deletions
24
maeumgagym-application/src/main/kotlin/com/info/maeumgagym/domain/step/mapper/StepMapper.kt
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.info.maeumgagym.domain.step.mapper | ||
|
||
import com.info.maeumgagym.domain.step.entity.StepRedisEntity | ||
import com.info.maeumgagym.step.model.Step | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class StepMapper { | ||
fun toEntity(domain: Step): StepRedisEntity = domain.run { | ||
StepRedisEntity( | ||
id = id, | ||
numberOfSteps = numberOfSteps, | ||
ttl = ttl | ||
) | ||
} | ||
|
||
fun toDomain(entity: StepRedisEntity): Step = entity.run { | ||
Step( | ||
id = id, | ||
numberOfSteps = numberOfSteps, | ||
ttl = ttl | ||
) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...-application/src/main/kotlin/com/info/maeumgagym/domain/step/repository/StepRepository.kt
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 com.info.maeumgagym.domain.step.repository | ||
|
||
import com.info.maeumgagym.domain.step.entity.StepRedisEntity | ||
import org.springframework.data.repository.Repository | ||
@org.springframework.stereotype.Repository | ||
interface StepRepository : Repository<StepRedisEntity, String> { | ||
fun save(entity: StepRedisEntity): StepRedisEntity | ||
|
||
fun findById(id: String): StepRedisEntity? | ||
} |
11 changes: 11 additions & 0 deletions
11
maeumgagym-common/src/main/kotlin/com/info/common/ReadOnlyUseCase.kt
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 com.info.common | ||
|
||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Retention(AnnotationRetention.RUNTIME) | ||
@Target(AnnotationTarget.CLASS) | ||
@MustBeDocumented | ||
@Transactional(readOnly = true) | ||
@Service | ||
annotation class ReadOnlyUseCase() |
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,9 +1,12 @@ | ||
package com.info.common | ||
|
||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Isolation | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Retention(AnnotationRetention.RUNTIME) | ||
@Target(AnnotationTarget.CLASS) | ||
@MustBeDocumented | ||
@Transactional(isolation = Isolation.REPEATABLE_READ, rollbackFor = [Exception::class]) | ||
@Service | ||
annotation class UseCase() |
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
4 changes: 2 additions & 2 deletions
4
maeumgagym-core/src/main/kotlin/com/info/maeumgagym/auth/service/DuplicatedCheckService.kt
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
Oops, something went wrong.