Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ”€ :: (#224) - standard λΆ€λΆ„ λ„€νŠΈμ›Œν¬ μ„ΈνŒ…μ„ ν–ˆμŠ΅λ‹ˆλ‹€. #225

Merged
merged 9 commits into from
Nov 30, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import com.school_of_company.data.repository.image.ImageRepository
import com.school_of_company.data.repository.image.ImageRepositoryImpl
import com.school_of_company.data.repository.sms.SmsRepository
import com.school_of_company.data.repository.sms.SmsRepositoryImpl
import com.school_of_company.data.repository.standard.StandardRepository
import com.school_of_company.data.repository.standard.StandardRepositoryImpl
import com.school_of_company.data.repository.training.TrainingRepository
import com.school_of_company.data.repository.training.TrainingRepositoryImpl
import dagger.Binds
Expand Down Expand Up @@ -43,4 +45,9 @@ abstract class RepositoryModule {
abstract fun bindTrainingRepository(
trainingRepositoryImpl: TrainingRepositoryImpl
) : TrainingRepository

@Binds
abstract fun bindStandardRepository(
standardRepositoryImpl: StandardRepositoryImpl
) : StandardRepository
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.school_of_company.data.repository.standard

import com.school_of_company.model.entity.standard.StandardAttendListResponseEntity
import com.school_of_company.model.entity.standard.StandardProgramListResponseEntity
import com.school_of_company.model.model.standard.StandardRequestModel
import kotlinx.coroutines.flow.Flow

interface StandardRepository {
fun registerStandardProgram(expoId: String, body: StandardRequestModel): Flow<Unit>
fun registerStandardListProgram(expoId: String, body: List<StandardRequestModel>): Flow<Unit>
fun modifyStandardProgram(standardProId: Long, body: StandardRequestModel): Flow<Unit>
fun deleteStandardProgram(standardProId: Long): Flow<Unit>
fun standardProgramList(expoId: String): Flow<List<StandardProgramListResponseEntity>>
fun standardProgramAttendList(standardProId: Long): Flow<List<StandardAttendListResponseEntity>>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.school_of_company.data.repository.standard

import com.school_of_company.model.entity.standard.StandardAttendListResponseEntity
import com.school_of_company.model.entity.standard.StandardProgramListResponseEntity
import com.school_of_company.model.model.standard.StandardRequestModel
import com.school_of_company.network.datasource.standard.StandardDataSource
import com.school_of_company.network.mapper.standard.request.toDto
import com.school_of_company.network.mapper.standard.response.toModel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.transform
import javax.inject.Inject

class StandardRepositoryImpl @Inject constructor(
private val dataSource: StandardDataSource
) : StandardRepository {
override fun registerStandardProgram(expoId: String, body: StandardRequestModel): Flow<Unit> {
return dataSource.registerStandardProgram(
expoId = expoId,
body = body.toDto()
)
}

override fun registerStandardListProgram(
expoId: String,
body: List<StandardRequestModel>
): Flow<Unit> {
return dataSource.registerStandardListProgram(
expoId = expoId,
body = body.map { it.toDto() }
)
}

override fun modifyStandardProgram(
standardProId: Long,
body: StandardRequestModel
): Flow<Unit> {
return dataSource.modifyStandardProgram(
standardProId = standardProId,
body = body.toDto()
)
}

override fun deleteStandardProgram(standardProId: Long): Flow<Unit> {
return dataSource.deleteStandardProgram(standardProId = standardProId)
}

override fun standardProgramList(expoId: String): Flow<List<StandardProgramListResponseEntity>> {
return dataSource.standardProgramList(expoId = expoId).transform { list -> emit(list.map { it.toModel() }) }
}

override fun standardProgramAttendList(standardProId: Long): Flow<List<StandardAttendListResponseEntity>> {
return dataSource.standardProgramAttendList(standardProId = standardProId).transform { list -> emit(list.map { it.toModel() }) }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.school_of_company.domain.usecase.standard

import com.school_of_company.data.repository.standard.StandardRepository
import javax.inject.Inject

class DeleteStandardProgramListUseCase @Inject constructor(
private val repository: StandardRepository
) {
Comment on lines +6 to +8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

클래슀 이름이 κΈ°λŠ₯κ³Ό μΌμΉ˜ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€

ν˜„μž¬ 클래슀 이름은 DeleteStandardProgramListUseCaseμ΄μ§€λ§Œ μ‹€μ œλ‘œλŠ” 단일 ν”„λ‘œκ·Έλž¨μ„ μ‚­μ œν•˜λŠ” κΈ°λŠ₯을 μˆ˜ν–‰ν•©λ‹ˆλ‹€. 더 λͺ…ν™•ν•œ 의미 전달을 μœ„ν•΄ DeleteStandardProgramUseCase둜 λ³€κ²½ν•˜λŠ” 것이 μ’‹κ² μŠ΅λ‹ˆλ‹€.

-class DeleteStandardProgramListUseCase @Inject constructor(
+class DeleteStandardProgramUseCase @Inject constructor(
    private val repository: StandardRepository
)
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
class DeleteStandardProgramListUseCase @Inject constructor(
private val repository: StandardRepository
) {
class DeleteStandardProgramUseCase @Inject constructor(
private val repository: StandardRepository
) {

operator fun invoke(standardProId: Long) = runCatching {
repository.deleteStandardProgram(standardProId = standardProId)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.school_of_company.domain.usecase.standard

import com.school_of_company.data.repository.standard.StandardRepository
import com.school_of_company.model.model.standard.StandardRequestModel
import javax.inject.Inject

class ModifyStandardProgramUseCase @Inject constructor(
private val repository: StandardRepository
) {
operator fun invoke(
standardProId: Long,
body: StandardRequestModel
) = runCatching {
repository.modifyStandardProgram(
standardProId = standardProId,
body = body
)

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.school_of_company.domain.usecase.standard

import com.school_of_company.data.repository.standard.StandardRepository
import com.school_of_company.model.model.standard.StandardRequestModel
import javax.inject.Inject

class RegisterStandardListProgramUseCase @Inject constructor(
private val repository: StandardRepository
) {
operator fun invoke(
expoId: String,
body: List<StandardRequestModel>
) = runCatching {
repository.registerStandardListProgram(
expoId = expoId,
body = body
)
}
}
Comment on lines +7 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

μ½”λ“œ 쀑볡 및 μ„±λŠ₯ κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

  1. μ½”λ“œ 쀑볡:

    • RegisterStandardProgramUseCase와 μœ μ‚¬ν•œ ꡬ쑰가 μ€‘λ³΅λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.
    • 곡톡 λ‘œμ§μ„ 좔상 ν΄λž˜μŠ€λ‚˜ μΈν„°νŽ˜μ΄μŠ€λ‘œ λΆ„λ¦¬ν•˜λŠ” 것을 κ³ λ €ν•΄λ³΄μ„Έμš”.
  2. μ„±λŠ₯ 고렀사항:

    • λŒ€λŸ‰μ˜ 데이터 처리 μ‹œ 배치 크기 μ œν•œμ΄ μ—†μŠ΅λ‹ˆλ‹€.
    • 병렬 처리 방식이 κ³ λ €λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

μ˜ˆμ‹œ μ½”λ“œ:

 operator fun invoke(
     expoId: String,
     body: List<StandardRequestModel>
 ) = runCatching {
+    require(body.size <= MAX_BATCH_SIZE) { "μ΅œλŒ€ 처리 κ°€λŠ₯ν•œ 크기λ₯Ό μ΄ˆκ³Όν–ˆμŠ΅λ‹ˆλ‹€" }
+
+    body.chunked(OPTIMAL_CHUNK_SIZE)
+        .asFlow()
+        .flatMapMerge { chunk ->
     repository.registerStandardListProgram(
         expoId = expoId,
-        body = body
+        body = chunk
     )
+ }
 }

+companion object {
+    private const val MAX_BATCH_SIZE = 1000
+    private const val OPTIMAL_CHUNK_SIZE = 100
+}

Committable suggestion skipped: line range outside the PR's diff.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.school_of_company.domain.usecase.standard

import com.school_of_company.data.repository.standard.StandardRepository
import com.school_of_company.model.model.standard.StandardRequestModel
import javax.inject.Inject

class RegisterStandardProgramUseCase @Inject constructor(
private val repository: StandardRepository
) {
operator fun invoke(
expoId: String,
body: StandardRequestModel
) = runCatching {
repository.registerStandardProgram(
expoId = expoId,
body = body
)
}
Comment on lines +13 to +18
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

μ—λŸ¬ 처리 κ°œμ„ μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

ν˜„μž¬ runCatchingλ§ŒμœΌλ‘œλŠ” ꡬ체적인 μ—λŸ¬ μ²˜λ¦¬κ°€ λΆ€μ‘±ν•  수 μžˆμŠ΅λ‹ˆλ‹€. λ‹€μŒκ³Ό 같은 κ°œμ„ μ‚¬ν•­μ„ κ³ λ €ν•΄λ³΄μ„Έμš”:

  1. ꡬ체적인 μ˜ˆμ™Έ νƒ€μž… μ •μ˜
  2. λΉ„μ¦ˆλ‹ˆμŠ€ 둜직 μ‹€νŒ¨μ— λŒ€ν•œ 처리
  3. λ„€νŠΈμ›Œν¬ 였λ₯˜ ꡬ뢄

μ˜ˆμ‹œ μ½”λ“œ:

- ) = runCatching {
+ ) = runCatching {
+    require(expoId.isNotBlank()) { "expoIdλŠ” λΉ„μ–΄μžˆμ„ 수 μ—†μŠ΅λ‹ˆλ‹€" }
+    require(body.isValid()) { "μœ νš¨ν•˜μ§€ μ•Šμ€ μš”μ²­μž…λ‹ˆλ‹€" }
+
     repository.registerStandardProgram(
         expoId = expoId,
         body = body
     )
+ }.onFailure { throwable ->
+    when (throwable) {
+        is IllegalArgumentException -> throw BusinessException(throwable)
+        is IOException -> throw NetworkException(throwable)
+        else -> throw throwable
+    }
 }

Committable suggestion skipped: line range outside the PR's diff.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.school_of_company.domain.usecase.standard

import com.school_of_company.data.repository.standard.StandardRepository
import com.school_of_company.model.entity.standard.StandardAttendListResponseEntity
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

class StandardProgramAttendListUseCase @Inject constructor(
private val repository: StandardRepository
) {
operator fun invoke(standardProId: Long) : Flow<List<StandardAttendListResponseEntity>> =
repository.standardProgramAttendList(standardProId = standardProId)
Comment on lines +11 to +12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

μž…λ ₯κ°’ 검증과 μ˜ˆμ™Έ μ²˜λ¦¬κ°€ ν•„μš”ν•©λ‹ˆλ‹€

standardProIdκ°€ μœ νš¨ν•œμ§€ ν™•μΈν•˜λŠ” 둜직이 μ—†μœΌλ©°, μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” ν”„λ‘œκ·Έλž¨μ— λŒ€ν•œ μ˜ˆμ™Έ μ²˜λ¦¬κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

 operator fun invoke(standardProId: Long) : Flow<List<StandardAttendListResponseEntity>> =
+    require(standardProId > 0) { "standardProIdλŠ” 0보닀 컀야 ν•©λ‹ˆλ‹€" }
     repository.standardProgramAttendList(standardProId = standardProId)
+        .catch { throwable ->
+            when (throwable) {
+                is NoSuchElementException -> throw StandardProgramNotFoundException(standardProId)
+                else -> throw throwable
+            }
+        }

Committable suggestion skipped: line range outside the PR's diff.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.school_of_company.domain.usecase.standard

import com.school_of_company.data.repository.standard.StandardRepository
import com.school_of_company.model.entity.standard.StandardProgramListResponseEntity
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

class StandardProgramListUseCase @Inject constructor(
private val repository: StandardRepository
) {
operator fun invoke(expoId: String) : Flow<List<StandardProgramListResponseEntity>> =
repository.standardProgramList(expoId = expoId)
Comment on lines +11 to +12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

μž…λ ₯κ°’ 검증이 ν•„μš”ν•©λ‹ˆλ‹€

expoId에 λŒ€ν•œ μœ νš¨μ„± 검사가 μ—†μŠ΅λ‹ˆλ‹€. 빈 λ¬Έμžμ—΄μ΄λ‚˜ 잘λͺ»λœ ν˜•μ‹μ˜ IDκ°€ μž…λ ₯될 경우 μ²˜λ¦¬κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

 operator fun invoke(expoId: String) : Flow<List<StandardProgramListResponseEntity>> =
+    require(expoId.isNotBlank()) { "expoIdλŠ” λΉ„μ–΄μžˆμ„ 수 μ—†μŠ΅λ‹ˆλ‹€" }
     repository.standardProgramList(expoId = expoId)
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
operator fun invoke(expoId: String) : Flow<List<StandardProgramListResponseEntity>> =
repository.standardProgramList(expoId = expoId)
operator fun invoke(expoId: String) : Flow<List<StandardProgramListResponseEntity>> =
require(expoId.isNotBlank()) { "expoIdλŠ” λΉ„μ–΄μžˆμ„ 수 μ—†μŠ΅λ‹ˆλ‹€" }
repository.standardProgramList(expoId = expoId)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.school_of_company.model.entity.standard

data class StandardAttendListResponseEntity(
val name: String,
val affiliation: String,
val position: String,
val programName: String,
val status: Boolean,
val entryTime: String,
val leaveTime: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.school_of_company.model.entity.standard

data class StandardProgramListResponseEntity(
val id: Long,
val title: String,
val startedAt: String,
val endedAt: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.school_of_company.model.model.standard

data class StandardRequestModel(
val title: String,
val startedAt: String,
val endedAt: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.school_of_company.network.api

import com.school_of_company.network.dto.standard.request.StandardRequest
import com.school_of_company.network.dto.standard.response.StandardAttendListResponse
import com.school_of_company.network.dto.standard.response.StandardProgramListResponse
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path

interface StandardAPI {

@POST("/standard/{expo_id}")
suspend fun registerStandardProgram(
@Path("expo_id") expoId: String,
@Body body: StandardRequest
)
Comment on lines +14 to +18
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

API μ—”λ“œν¬μΈνŠΈ 경둜의 일관성 κ²€ν† κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

μ—”λ“œν¬μΈνŠΈ κ²½λ‘œμ—μ„œ λ‹€μŒκ³Ό 같은 비일관성이 λ°œκ²¬λ©λ‹ˆλ‹€:

  • /standard/{expo_id} vs /standard/list/{expo_id} vs /standard/{standardPro_id}
  • expo_id와 standardPro_id의 넀이밍 μ»¨λ²€μ…˜μ΄ λ‹€λ¦…λ‹ˆλ‹€ (snake_case vs camelCase)

λ‹€μŒκ³Ό 같이 μˆ˜μ •ν•˜λŠ” 것을 μ œμ•ˆλ“œλ¦½λ‹ˆλ‹€:

-    @POST("/standard/{expo_id}")
+    @POST("/standard/program/{expoId}")
     suspend fun registerStandardProgram(
-        @Path("expo_id") expoId: String,
+        @Path("expoId") expoId: String,
         @Body body: StandardRequest
     )

-    @POST("/standard/list/{expo_id}")
+    @POST("/standard/program/list/{expoId}")
     suspend fun registerStandardListProgram(
-        @Path("expo_id") expoId: String,
+        @Path("expoId") expoId: String,
         @Body body: List<StandardRequest>
     )

-    @POST("/standard/{standardPro_id}")
+    @POST("/standard/program/{standardProId}")
     suspend fun modifyStandardProgram(
-        @Path("standardPro_id") standardProId: Long,
+        @Path("standardProId") standardProId: Long,
         @Body body: StandardRequest
     )

Also applies to: 20-24, 26-30


@POST("/standard/list/{expo_id}")
suspend fun registerStandardListProgram(
@Path("expo_id") expoId: String,
@Body body: List<StandardRequest>
)

@POST("/standard/{standardPro_id}")
suspend fun modifyStandardProgram(
@Path("standardPro_id") standardProId: Long,
@Body body: StandardRequest
)

@DELETE("/standard/{standardPro_id}")
suspend fun deleteStandardProgram(
@Path("standardPro_id") standardProId: Long
)

@GET("/standard/program/{expo_id}")
suspend fun standardProgramList(
@Path("expo_id") expoId: String
) : List<StandardProgramListResponse>

@GET("/standard/{standardPro_id}")
suspend fun standardProgramAttendList(
@Path("standardPro_id") standardProId: Long
) : List<StandardAttendListResponse>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.school_of_company.network.datasource.standard

import com.school_of_company.network.dto.standard.request.StandardRequest
import com.school_of_company.network.dto.standard.response.StandardAttendListResponse
import com.school_of_company.network.dto.standard.response.StandardProgramListResponse
import kotlinx.coroutines.flow.Flow

interface StandardDataSource {
fun registerStandardProgram(expoId: String, body: StandardRequest) : Flow<Unit>
fun registerStandardListProgram(expoId: String, body: List<StandardRequest>) : Flow<Unit>
fun modifyStandardProgram(standardProId: Long, body: StandardRequest) : Flow<Unit>
fun deleteStandardProgram(standardProId: Long) : Flow<Unit>
fun standardProgramList(expoId: String) : Flow<List<StandardProgramListResponse>>
fun standardProgramAttendList(standardProId: Long) : Flow<List<StandardAttendListResponse>>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.school_of_company.network.datasource.standard

import com.school_of_company.network.api.StandardAPI
import com.school_of_company.network.dto.standard.request.StandardRequest
import com.school_of_company.network.dto.standard.response.StandardAttendListResponse
import com.school_of_company.network.dto.standard.response.StandardProgramListResponse
import com.school_of_company.network.util.performApiRequest
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

class StandardDataSourceImpl @Inject constructor(
private val service: StandardAPI
) : StandardDataSource {
override fun registerStandardProgram(expoId: String, body: StandardRequest): Flow<Unit> =
performApiRequest { service.registerStandardProgram(
expoId = expoId,
body = body
) }

override fun registerStandardListProgram(
expoId: String,
body: List<StandardRequest>
): Flow<Unit> =
performApiRequest { service.registerStandardListProgram(
expoId = expoId,
body = body
) }

override fun modifyStandardProgram(standardProId: Long, body: StandardRequest): Flow<Unit> =
performApiRequest { service.modifyStandardProgram(
standardProId = standardProId,
body = body
) }
Comment on lines +29 to +33
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

Long νƒ€μž… λ§€κ°œλ³€μˆ˜ μœ νš¨μ„± 검사 μΆ”κ°€ ν•„μš”

standardProIdκ°€ 0보닀 μž‘μ€ κ²½μš°μ— λŒ€ν•œ μ²˜λ¦¬κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같은 μœ νš¨μ„± 검사 μΆ”κ°€λ₯Ό μ œμ•ˆν•©λ‹ˆλ‹€:

 override fun modifyStandardProgram(standardProId: Long, body: StandardRequest): Flow<Unit> =
+    require(standardProId > 0) { "standardProId must be positive" }
     performApiRequest { service.modifyStandardProgram(
         standardProId = standardProId,
         body = body
     ) }
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
override fun modifyStandardProgram(standardProId: Long, body: StandardRequest): Flow<Unit> =
performApiRequest { service.modifyStandardProgram(
standardProId = standardProId,
body = body
) }
override fun modifyStandardProgram(standardProId: Long, body: StandardRequest): Flow<Unit> =
require(standardProId > 0) { "standardProId must be positive" }
performApiRequest { service.modifyStandardProgram(
standardProId = standardProId,
body = body
) }


override fun deleteStandardProgram(standardProId: Long): Flow<Unit> =
performApiRequest { service.deleteStandardProgram(standardProId = standardProId) }

override fun standardProgramList(expoId: String): Flow<List<StandardProgramListResponse>> =
performApiRequest { service.standardProgramList(expoId = expoId) }

override fun standardProgramAttendList(standardProId: Long): Flow<List<StandardAttendListResponse>> =
performApiRequest { service.standardProgramAttendList(standardProId = standardProId) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.school_of_company.network.api.AuthAPI
import com.school_of_company.network.api.ExpoAPI
import com.school_of_company.network.api.ImageAPI
import com.school_of_company.network.api.SmsAPI
import com.school_of_company.network.api.StandardAPI
import com.school_of_company.network.api.TrainingAPI
import com.school_of_company.network.util.AuthInterceptor
import com.school_of_company.network.util.TokenAuthenticator
Expand Down Expand Up @@ -108,4 +109,9 @@ object NetworkModule {
@Provides
fun provideTrainingAPI(retrofit: Retrofit) : TrainingAPI =
retrofit.create(TrainingAPI::class.java)

@Provides
fun provideStandardAPI(retrofit: Retrofit) : StandardAPI =
retrofit.create(StandardAPI::class.java)

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import com.school_of_company.network.datasource.image.ImageDataSource
import com.school_of_company.network.datasource.image.ImageDataSourceImpl
import com.school_of_company.network.datasource.sms.SmsDataSource
import com.school_of_company.network.datasource.sms.SmsDataSourceImpl
import com.school_of_company.network.datasource.standard.StandardDataSource
import com.school_of_company.network.datasource.standard.StandardDataSourceImpl
import com.school_of_company.network.datasource.training.TrainingDataSource
import com.school_of_company.network.datasource.training.TrainingDataSourceImpl
import dagger.Binds
Expand Down Expand Up @@ -43,4 +45,9 @@ abstract class RemoteDataSourceModule {
abstract fun bindTrainingRemoteDataSource(
trainingDataSourceImpl: TrainingDataSourceImpl
) : TrainingDataSource

@Binds
abstract fun bindStandardRemoteDataSource(
standardDataSourceImpl: StandardDataSourceImpl
) : StandardDataSource
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.school_of_company.network.dto.standard.request

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class StandardRequest(
@Json(name = "title") val title: String,
@Json(name = "startedAt") val startedAt: String,
@Json(name = "endedAt") val endedAt: String,
Comment on lines +8 to +10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codebase verification

μ‹œκ°„ ν•„λ“œμ— λŒ€ν•œ 검증이 ν•„μš”ν•˜λ©° λ¬Έμ„œν™”κ°€ λ―Έν‘ν•©λ‹ˆλ‹€.

μ½”λ“œλ² μ΄μŠ€ 뢄석 κ²°κ³Ό λ‹€μŒκ³Ό 같은 λ¬Έμ œμ λ“€μ΄ λ°œκ²¬λ˜μ—ˆμŠ΅λ‹ˆλ‹€:

  1. startedAtκ³Ό endedAt ν•„λ“œλŠ” "yyyy-MM-dd" ν˜•μ‹μœΌλ‘œ 처리되고 μžˆμœΌλ‚˜, 이에 λŒ€ν•œ λͺ…μ‹œμ μΈ λ¬Έμ„œν™”κ°€ DTO에 μ—†μŠ΅λ‹ˆλ‹€.
  2. formatServerDate() μœ ν‹Έλ¦¬ν‹°λŠ” μžˆμ§€λ§Œ, λ‚ μ§œμ˜ μœ νš¨μ„±μ„ κ²€μ¦ν•˜λŠ” 둜직이 μ—†μŠ΅λ‹ˆλ‹€.
  3. startedAt이 endedAt보닀 이전 μ‹œκ°„μΈμ§€ ν™•μΈν•˜λŠ” 검증 둜직이 μ—†μŠ΅λ‹ˆλ‹€.

κ°œμ„  ꢌμž₯사항:

  • DTO ν΄λž˜μŠ€μ— λ‚ μ§œ ν˜•μ‹μ— λŒ€ν•œ λͺ…ν™•ν•œ λ¬Έμ„œν™” μΆ”κ°€ (예: @Json μ–΄λ…Έν…Œμ΄μ…˜ μœ„μ— KDoc μ£Όμ„μœΌλ‘œ "yyyy-MM-dd" ν˜•μ‹μž„μ„ λͺ…μ‹œ)
  • λ‚ μ§œ μœ νš¨μ„± 검증 둜직 κ΅¬ν˜„
  • μ‹œμž‘μΌμ΄ μ’…λ£ŒμΌλ³΄λ‹€ 이전인지 ν™•μΈν•˜λŠ” 검증 둜직 μΆ”κ°€
πŸ”— Analysis chain

μ‹œκ°„ ν•„λ“œμ— λŒ€ν•œ μœ νš¨μ„± 검사와 λ¬Έμ„œν™”κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

startedAtκ³Ό endedAt ν•„λ“œμ™€ κ΄€λ ¨ν•˜μ—¬ λ‹€μŒ 사항듀을 κ³ λ €ν•΄μ£Όμ„Έμš”:

  1. μ‹œκ°„ ν˜•μ‹μ— λŒ€ν•œ λͺ…ν™•ν•œ λ¬Έμ„œν™”κ°€ ν•„μš”ν•©λ‹ˆλ‹€ (예: ISO 8601 ν˜•μ‹ μ‚¬μš© μ—¬λΆ€).
  2. startedAt이 endedAt보닀 이전 μ‹œκ°„μΈμ§€ κ²€μ¦ν•˜λŠ” 둜직이 ν•„μš”ν•  것 κ°™μŠ΅λ‹ˆλ‹€.

λ‹€μŒ 슀크립트둜 μ‹œκ°„ κ΄€λ ¨ 검증 둜직의 쑴재 μ—¬λΆ€λ₯Ό 확인할 수 μžˆμŠ΅λ‹ˆλ‹€:


Let's search more broadly to understand the context and validation patterns in the codebase.


Let's search for date/time validation and formatting related code to better understand how dates are handled in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for time validation logic in the codebase

# Search for time validation patterns
rg -i "validate.*time|time.*validate|check.*time|time.*check" 

# Search for date/time utility functions
ast-grep --pattern 'fun $_($$TIME|$$Date|$$DateTime)$_($$$) { $$$ }'

Length of output: 134


Script:

#!/bin/bash
# Search for any date/time related validation or utility code
rg -i "date|time" -A 3 --type kotlin

# Search specifically in the network module
fd . "core/network" -e kt -x cat {}

# Look for validation related code
rg -i "validate|check" -A 3 --type kotlin

Length of output: 100877


Script:

#!/bin/bash
# Let's check for date/time validation and formatting utilities
rg -i "format.*date|date.*format|parse.*date|date.*parse" -A 3

# Look for any date/time related utilities or helper functions
fd . "core/ui/src/main/java" -e kt -x cat {}

# Check for any validation related code in the codebase
ast-grep --pattern 'fun $_validate$_($$$) { $$$ }'

Length of output: 5945

)
Loading
Loading