diff --git a/core/model/src/commonMain/kotlin/club/nito/core/model/participant/Participant.kt b/core/model/src/commonMain/kotlin/club/nito/core/model/participant/Participant.kt index ba75db86..e5341ef3 100644 --- a/core/model/src/commonMain/kotlin/club/nito/core/model/participant/Participant.kt +++ b/core/model/src/commonMain/kotlin/club/nito/core/model/participant/Participant.kt @@ -4,10 +4,10 @@ package club.nito.core.model.participant * 参加情報 * @param scheduleId スケジュールID * @param userId 参加ユーザーID - * @param comment コメント + * @param status 参加状況 */ public data class Participant( val scheduleId: String, val userId: String, - val comment: String, + val status: ParticipantStatus, ) diff --git a/core/model/src/commonMain/kotlin/club/nito/core/model/participant/ParticipantStatus.kt b/core/model/src/commonMain/kotlin/club/nito/core/model/participant/ParticipantStatus.kt new file mode 100644 index 00000000..0997fec4 --- /dev/null +++ b/core/model/src/commonMain/kotlin/club/nito/core/model/participant/ParticipantStatus.kt @@ -0,0 +1,21 @@ +package club.nito.core.model.participant + +/** + * 参加状況 + */ +public enum class ParticipantStatus { + /** + * 未定 + */ + PENDING, + + /** + * 出席 + */ + ATTENDANCE, + + /** + * 欠席 + */ + ABSENCE, +} diff --git a/core/network/src/commonMain/kotlin/club/nito/core/network/participation/SupabaseParticipantRemoteDataSource.kt b/core/network/src/commonMain/kotlin/club/nito/core/network/participation/SupabaseParticipantRemoteDataSource.kt index 0e9851ae..005ecc5f 100644 --- a/core/network/src/commonMain/kotlin/club/nito/core/network/participation/SupabaseParticipantRemoteDataSource.kt +++ b/core/network/src/commonMain/kotlin/club/nito/core/network/participation/SupabaseParticipantRemoteDataSource.kt @@ -21,7 +21,6 @@ public class SupabaseParticipantRemoteDataSource( filter { and { eq("schedule_id", scheduleId) - exact("deleted_at", null) } } } @@ -35,7 +34,6 @@ public class SupabaseParticipantRemoteDataSource( filter { and { isIn("schedule_id", scheduleIds) - exact("deleted_at", null) } } } diff --git a/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipant.kt b/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipant.kt index 26b0765a..487442b2 100644 --- a/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipant.kt +++ b/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipant.kt @@ -7,21 +7,21 @@ import kotlinx.serialization.Serializable internal data class NetworkParticipant( val scheduleId: String, val userId: String, - val comment: String, + val status: NetworkParticipantStatus, ) { fun toParticipant() = Participant( scheduleId = scheduleId, userId = userId, - comment = comment, + status = status.toParticipantStatus(), ) } internal fun createFakeNetworkParticipant( scheduleId: String = "bbe00d24-d840-460d-a127-f23f9e472cc6", userId: String = "bbe00d24-d840-460d-a127-f23f9e472cc6", - comment: String = "コメント", + status: NetworkParticipantStatus = NetworkParticipantStatus.ATTENDANCE, ) = NetworkParticipant( scheduleId = scheduleId, userId = userId, - comment = comment, + status = status, ) diff --git a/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipantStatus.kt b/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipantStatus.kt new file mode 100644 index 00000000..91dd8ca1 --- /dev/null +++ b/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipantStatus.kt @@ -0,0 +1,36 @@ +package club.nito.core.network.participation.model + +import club.nito.core.model.participant.ParticipantStatus +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +/** + * 参加状況 + */ +@Serializable +internal enum class NetworkParticipantStatus { + /** + * 未定 + */ + @SerialName(value = "pending") + PENDING, + + /** + * 出席 + */ + @SerialName(value = "attendance") + ATTENDANCE, + + /** + * 欠席 + */ + @SerialName(value = "absence") + ABSENCE; + + fun toParticipantStatus(): ParticipantStatus = + when (this) { + PENDING -> ParticipantStatus.PENDING + ATTENDANCE -> ParticipantStatus.ATTENDANCE + ABSENCE -> ParticipantStatus.ABSENCE + } +}