feat(MatchService): enhance match filtering for own teams and update mobile app settings
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 43s

- Added logic in MatchService to filter matches based on the user's own teams, ensuring only relevant matches are displayed.
- Updated the mobile app's TODO list to reflect progress on ClubSettings and Predefined Activities features.
- Enhanced the AppRoot and ClubStammdatenScreens to support new settings and permissions for club management.
- Introduced new API methods for creating and updating training groups and times, improving the training management capabilities.
- Refactored MembersManager to include methods for managing training groups and times, streamlining the member management process.
This commit is contained in:
Torsten Schulz (local)
2026-05-13 00:01:25 +02:00
parent 57468f1efb
commit 54d9b9fc86
9 changed files with 1239 additions and 251 deletions

View File

@@ -1,11 +1,14 @@
package de.tt_tagebuch.shared.api
import de.tt_tagebuch.shared.api.http.AuthedHttpClient
import de.tt_tagebuch.shared.api.models.CreateClubTrainingGroupBody
import de.tt_tagebuch.shared.api.models.TrainingGroupDto
import de.tt_tagebuch.shared.api.models.UpdateClubTrainingGroupBody
import io.ktor.client.call.body
import io.ktor.client.request.delete
import io.ktor.client.request.get
import io.ktor.client.request.post
import io.ktor.client.request.put
import io.ktor.client.request.setBody
import io.ktor.http.ContentType
import io.ktor.http.contentType
@@ -31,4 +34,22 @@ class TrainingGroupsApi(
suspend fun removeMemberFromGroup(clubId: Int, groupId: Int, memberId: Int) {
client.http.delete("/api/training-groups/$clubId/$groupId/member/$memberId")
}
suspend fun createGroup(clubId: Int, name: String): TrainingGroupDto {
return client.http.post("/api/training-groups/$clubId") {
contentType(ContentType.Application.Json)
setBody(CreateClubTrainingGroupBody(name = name.trim()))
}.body()
}
suspend fun updateGroup(clubId: Int, groupId: Int, name: String, sortOrder: Int?): TrainingGroupDto {
return client.http.put("/api/training-groups/$clubId/$groupId") {
contentType(ContentType.Application.Json)
setBody(UpdateClubTrainingGroupBody(name = name.trim(), sortOrder = sortOrder))
}.body()
}
suspend fun deleteGroup(clubId: Int, groupId: Int) {
client.http.delete("/api/training-groups/$clubId/$groupId")
}
}

View File

@@ -1,9 +1,18 @@
package de.tt_tagebuch.shared.api
import de.tt_tagebuch.shared.api.http.AuthedHttpClient
import de.tt_tagebuch.shared.api.models.CreateTrainingTimeBody
import de.tt_tagebuch.shared.api.models.TrainingGroupDto
import de.tt_tagebuch.shared.api.models.TrainingTimeDto
import de.tt_tagebuch.shared.api.models.UpdateTrainingTimeBody
import io.ktor.client.call.body
import io.ktor.client.request.delete
import io.ktor.client.request.get
import io.ktor.client.request.post
import io.ktor.client.request.put
import io.ktor.client.request.setBody
import io.ktor.http.ContentType
import io.ktor.http.contentType
class TrainingTimesApi(
private val client: AuthedHttpClient,
@@ -11,4 +20,22 @@ class TrainingTimesApi(
suspend fun listGroupsWithTimes(clubId: Int): List<TrainingGroupDto> {
return client.http.get("/api/training-times/$clubId").body()
}
suspend fun createTime(clubId: Int, body: CreateTrainingTimeBody): TrainingTimeDto {
return client.http.post("/api/training-times/$clubId") {
contentType(ContentType.Application.Json)
setBody(body)
}.body()
}
suspend fun updateTime(clubId: Int, timeId: Int, body: UpdateTrainingTimeBody): TrainingTimeDto {
return client.http.put("/api/training-times/$clubId/$timeId") {
contentType(ContentType.Application.Json)
setBody(body)
}.body()
}
suspend fun deleteTime(clubId: Int, timeId: Int) {
client.http.delete("/api/training-times/$clubId/$timeId")
}
}

View File

@@ -12,6 +12,13 @@ data class TrainingTimeDto(
val sortOrder: Int = 0,
)
@Serializable
data class TrainingGroupMemberBrief(
val id: Int,
val firstName: String? = null,
val lastName: String? = null,
)
@Serializable
data class TrainingGroupDto(
val id: Int = 0,
@@ -21,4 +28,32 @@ data class TrainingGroupDto(
val isPreset: Boolean = false,
val presetType: String? = null,
val trainingTimes: List<TrainingTimeDto> = emptyList(),
val members: List<TrainingGroupMemberBrief> = emptyList(),
)
@Serializable
data class CreateClubTrainingGroupBody(
val name: String,
val sortOrder: Int? = null,
)
@Serializable
data class UpdateClubTrainingGroupBody(
val name: String,
val sortOrder: Int? = null,
)
@Serializable
data class CreateTrainingTimeBody(
val trainingGroupId: Int,
val weekday: Int,
val startTime: String,
val endTime: String,
)
@Serializable
data class UpdateTrainingTimeBody(
val weekday: Int,
val startTime: String,
val endTime: String,
)

View File

@@ -4,11 +4,14 @@ import de.tt_tagebuch.shared.api.MemberActivitiesApi
import de.tt_tagebuch.shared.api.MembersApi
import de.tt_tagebuch.shared.api.TrainingGroupsApi
import de.tt_tagebuch.shared.api.TrainingTimesApi
import de.tt_tagebuch.shared.api.models.CreateTrainingTimeBody
import de.tt_tagebuch.shared.api.models.Member
import de.tt_tagebuch.shared.api.models.MemberActivityStatDto
import de.tt_tagebuch.shared.api.models.MemberLastParticipationDto
import de.tt_tagebuch.shared.api.models.MemberSetBody
import de.tt_tagebuch.shared.api.models.TrainingGroupDto
import de.tt_tagebuch.shared.api.models.TrainingTimeDto
import de.tt_tagebuch.shared.api.models.UpdateTrainingTimeBody
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
@@ -43,6 +46,20 @@ class MembersManager(
suspend fun listTrainingGroups(clubId: Int): List<TrainingGroupDto> = trainingGroupsApi.listGroups(clubId)
suspend fun listMembersForClub(clubId: Int, activeOnly: Boolean = true): List<Member> =
membersApi.listMembers(clubId, showAll = !activeOnly)
.sortedWith(compareBy<Member> { it.lastName.lowercase() }.thenBy { it.firstName.lowercase() })
suspend fun createClubTrainingGroup(clubId: Int, name: String): TrainingGroupDto =
trainingGroupsApi.createGroup(clubId, name)
suspend fun updateClubTrainingGroup(clubId: Int, groupId: Int, name: String, sortOrder: Int?): TrainingGroupDto =
trainingGroupsApi.updateGroup(clubId, groupId, name, sortOrder)
suspend fun deleteClubTrainingGroup(clubId: Int, groupId: Int) {
trainingGroupsApi.deleteGroup(clubId, groupId)
}
suspend fun listMemberTrainingGroups(clubId: Int, memberId: Int): List<TrainingGroupDto> =
trainingGroupsApi.listMemberGroups(clubId, memberId)
@@ -54,6 +71,16 @@ class MembersManager(
trainingGroupsApi.removeMemberFromGroup(clubId, groupId, memberId)
}
suspend fun createClubTrainingTime(clubId: Int, body: CreateTrainingTimeBody): TrainingTimeDto =
trainingTimesApi.createTime(clubId, body)
suspend fun updateClubTrainingTime(clubId: Int, timeId: Int, body: UpdateTrainingTimeBody): TrainingTimeDto =
trainingTimesApi.updateTime(clubId, timeId, body)
suspend fun deleteClubTrainingTime(clubId: Int, timeId: Int) {
trainingTimesApi.deleteTime(clubId, timeId)
}
suspend fun memberActivityStats(clubId: Int, memberId: Int, period: String = "year"): List<MemberActivityStatDto> =
memberActivitiesApi.listActivityStats(clubId, memberId, period)