-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into feat/#459
# Conflicts: # backend/src/main/java/com/festago/festival/application/FestivalService.java # backend/src/main/java/com/festago/festival/domain/Festival.java # backend/src/main/java/com/festago/presentation/AdminController.java # backend/src/main/java/com/festago/presentation/StageController.java # backend/src/main/java/com/festago/school/application/SchoolService.java # backend/src/main/java/com/festago/school/domain/School.java # backend/src/main/java/com/festago/stage/application/StageService.java # backend/src/main/java/com/festago/stage/domain/Stage.java # backend/src/test/java/com/festago/domain/FestivalTest.java # backend/src/test/java/com/festago/domain/StageTest.java # backend/src/test/java/com/festago/domain/TicketTest.java
- Loading branch information
Showing
118 changed files
with
1,666 additions
and
322 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
17 changes: 17 additions & 0 deletions
17
android/festago/app/src/main/java/com/festago/festago/data/dto/SchoolResponse.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,17 @@ | ||
package com.festago.festago.data.dto | ||
|
||
import com.festago.festago.model.School | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SchoolResponse( | ||
val id: Int, | ||
val domain: String, | ||
val name: String | ||
) { | ||
fun toDomain(): School = School( | ||
id = id.toLong(), | ||
domain = domain, | ||
name = name | ||
) | ||
} |
11 changes: 11 additions & 0 deletions
11
android/festago/app/src/main/java/com/festago/festago/data/dto/SchoolsResponse.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.festago.festago.data.dto | ||
|
||
import com.festago.festago.model.School | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SchoolsResponse( | ||
val schools: List<SchoolResponse> | ||
) { | ||
fun toDomain(): List<School> = schools.map { it.toDomain() } | ||
} |
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
13 changes: 13 additions & 0 deletions
13
android/festago/app/src/main/java/com/festago/festago/data/dto/VerificationRequest.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,13 @@ | ||
package com.festago.festago.data.dto | ||
|
||
import com.festago.festago.model.StudentVerificationCode | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class VerificationRequest( | ||
val code: String, | ||
) { | ||
companion object { | ||
fun from(code: StudentVerificationCode) = VerificationRequest(code.value) | ||
} | ||
} |
14 changes: 13 additions & 1 deletion
14
.../festago/app/src/main/java/com/festago/festago/data/repository/SchoolDefaultRepository.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
11 changes: 11 additions & 0 deletions
11
android/festago/app/src/main/java/com/festago/festago/data/service/SchoolRetrofitService.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.festago.festago.data.service | ||
|
||
import com.festago.festago.data.dto.SchoolsResponse | ||
import retrofit2.Response | ||
import retrofit2.http.GET | ||
|
||
interface SchoolRetrofitService { | ||
|
||
@GET("/schools") | ||
suspend fun getSchools(): Response<SchoolsResponse> | ||
} |
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
87 changes: 87 additions & 0 deletions
87
...pp/src/main/java/com/festago/festago/presentation/ui/selectschool/SelectSchoolActivity.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,87 @@ | ||
package com.festago.festago.presentation.ui.selectschool | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.widget.ArrayAdapter | ||
import androidx.activity.viewModels | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.festago.festago.R | ||
import com.festago.festago.databinding.ActivitySelectSchoolBinding | ||
import com.festago.festago.presentation.ui.studentverification.StudentVerificationActivity | ||
import com.festago.festago.presentation.util.repeatOnStarted | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class SelectSchoolActivity : AppCompatActivity() { | ||
|
||
private val binding: ActivitySelectSchoolBinding by lazy { | ||
ActivitySelectSchoolBinding.inflate(layoutInflater) | ||
} | ||
|
||
private val vm: SelectSchoolViewModel by viewModels() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
initBinding() | ||
initObserve() | ||
initView() | ||
} | ||
|
||
private fun initBinding() { | ||
setContentView(binding.root) | ||
binding.lifecycleOwner = this | ||
binding.vm = vm | ||
} | ||
|
||
private fun initObserve() { | ||
repeatOnStarted(this) { | ||
vm.uiState.collect { uiState -> | ||
handleUiState(uiState) | ||
} | ||
} | ||
repeatOnStarted(this) { | ||
vm.event.collect { event -> | ||
handleEvent(event) | ||
} | ||
} | ||
} | ||
|
||
private fun initView() { | ||
vm.loadSchools() | ||
} | ||
|
||
private fun handleUiState(uiState: SelectSchoolUiState) { | ||
binding.uiState = uiState | ||
when (uiState) { | ||
is SelectSchoolUiState.Loading, is SelectSchoolUiState.Error -> Unit | ||
is SelectSchoolUiState.Success -> handleSuccess(uiState) | ||
} | ||
} | ||
|
||
private fun handleSuccess(uiState: SelectSchoolUiState.Success) { | ||
val adapter = | ||
ArrayAdapter(this, R.layout.item_select_school, uiState.schools.map { it.name }) | ||
binding.actvSelectSchool.setAdapter(adapter) | ||
binding.actvSelectSchool.setOnItemClickListener { _, _, position, _ -> | ||
val selectedSchool = uiState.schools.firstOrNull { | ||
it.name == adapter.getItem(position) | ||
} | ||
selectedSchool?.let { vm.selectSchool(it.id) } | ||
} | ||
} | ||
|
||
private fun handleEvent(event: SelectSchoolEvent) { | ||
when (event) { | ||
is SelectSchoolEvent.ShowStudentVerification -> { | ||
startActivity(StudentVerificationActivity.getIntent(this, event.schoolId)) | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
fun getIntent(context: Context): Intent { | ||
return Intent(context, SelectSchoolActivity::class.java) | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...o/app/src/main/java/com/festago/festago/presentation/ui/selectschool/SelectSchoolEvent.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,5 @@ | ||
package com.festago.festago.presentation.ui.selectschool | ||
|
||
interface SelectSchoolEvent { | ||
class ShowStudentVerification(val schoolId: Long) : SelectSchoolEvent | ||
} |
21 changes: 21 additions & 0 deletions
21
...app/src/main/java/com/festago/festago/presentation/ui/selectschool/SelectSchoolUiState.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,21 @@ | ||
package com.festago.festago.presentation.ui.selectschool | ||
|
||
import com.festago.festago.model.School | ||
|
||
interface SelectSchoolUiState { | ||
object Loading : SelectSchoolUiState | ||
|
||
data class Success( | ||
val schools: List<School>, | ||
val selectedSchoolId: Long? = null | ||
) : SelectSchoolUiState { | ||
val schoolSelected = selectedSchoolId != null | ||
} | ||
|
||
object Error : SelectSchoolUiState | ||
|
||
val enableNext get() = (this is Success) && schoolSelected | ||
val shouldShowSuccess get() = this is Success | ||
val shouldShowLoading get() = this is Loading | ||
val shouldShowError get() = this is Error | ||
} |
Oops, something went wrong.