From 22f35284c80d409961ccdeec869c3b8feed704ce Mon Sep 17 00:00:00 2001 From: Jaakko Nakaza Date: Fri, 23 Aug 2024 14:00:16 +0300 Subject: [PATCH] Change model classes to be data classes and remove unused annotations --- src/main/kotlin/fi/aalto/cs/apluscourses/model/Course.kt | 2 +- .../aalto/cs/apluscourses/model/exercise/SubmissionFileInfo.kt | 3 --- .../fi/aalto/cs/apluscourses/model/exercise/SubmissionInfo.kt | 2 -- .../aalto/cs/apluscourses/model/exercise/SubmissionResult.kt | 2 -- .../fi/aalto/cs/apluscourses/model/exercise/SubmittableFile.kt | 3 --- .../kotlin/fi/aalto/cs/apluscourses/model/news/NewsItem.kt | 2 +- .../kotlin/fi/aalto/cs/apluscourses/model/news/NewsList.kt | 2 +- src/main/kotlin/fi/aalto/cs/apluscourses/model/people/User.kt | 2 +- 8 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/model/Course.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/model/Course.kt index 28e6dd373..ccd7d376e 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/model/Course.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/model/Course.kt @@ -13,7 +13,7 @@ import io.ktor.http.* * @param exerciseModules Mapping of exercise IDs to modules. The keys are exercise IDs, and the values are maps from language codes to module names. Note that some exercises use modules that are not in the course configuration file, so the modules may not be in [Course.getModules]. * @param resourceUrls URLs of resources related to the course. The keys are the names of the resources and the values are the URLs. */ -class Course( +data class Course( val id: Long, val name: String, val htmlUrl: String, diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionFileInfo.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionFileInfo.kt index 7ba8e18cf..08090d87a 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionFileInfo.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionFileInfo.kt @@ -1,8 +1,5 @@ package fi.aalto.cs.apluscourses.model.exercise -import kotlinx.serialization.Serializable - -@Serializable data class SubmissionFileInfo( val fileName: String, val url: String diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionInfo.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionInfo.kt index f4caea121..ac9a6f153 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionInfo.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionInfo.kt @@ -1,9 +1,7 @@ package fi.aalto.cs.apluscourses.model.exercise import fi.aalto.cs.apluscourses.api.APlusApi -import kotlinx.serialization.Serializable -@Serializable data class SubmissionInfo(val files: Map>) { // private val files: Map> = files diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionResult.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionResult.kt index 7af20f869..d38772ba1 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionResult.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmissionResult.kt @@ -2,9 +2,7 @@ package fi.aalto.cs.apluscourses.model.exercise import com.intellij.openapi.project.Project import fi.aalto.cs.apluscourses.api.APlusApi -import kotlinx.serialization.Serializable -@Serializable data class SubmissionResult( val id: Long, val url: String, diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmittableFile.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmittableFile.kt index a0f9f494d..b81350747 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmittableFile.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/model/exercise/SubmittableFile.kt @@ -1,6 +1,3 @@ package fi.aalto.cs.apluscourses.model.exercise -import kotlinx.serialization.Serializable - -@Serializable data class SubmittableFile(val key: String, val name: String) diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/model/news/NewsItem.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/model/news/NewsItem.kt index 7ef6ced94..50c272370 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/model/news/NewsItem.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/model/news/NewsItem.kt @@ -5,7 +5,7 @@ import java.time.ZonedDateTime import java.time.format.DateTimeFormatter import java.time.format.FormatStyle -class NewsItem( +data class NewsItem( val id: Long, val title: String, val body: String, diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/model/news/NewsList.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/model/news/NewsList.kt index 28ff15f07..ce70b5e2c 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/model/news/NewsList.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/model/news/NewsList.kt @@ -1,6 +1,6 @@ package fi.aalto.cs.apluscourses.model.news -class NewsList(val news: List = emptyList()) { +data class NewsList(val news: List = emptyList()) { fun setAllRead() { news.forEach { newsItem: NewsItem -> newsItem.isRead = true } } diff --git a/src/main/kotlin/fi/aalto/cs/apluscourses/model/people/User.kt b/src/main/kotlin/fi/aalto/cs/apluscourses/model/people/User.kt index 1519ae326..78e77d42d 100644 --- a/src/main/kotlin/fi/aalto/cs/apluscourses/model/people/User.kt +++ b/src/main/kotlin/fi/aalto/cs/apluscourses/model/people/User.kt @@ -6,7 +6,7 @@ package fi.aalto.cs.apluscourses.model.people * @property aplusId The A+ ID of the user. * @property staffCourses List of course IDs that the user is a staff member of. */ -class User( +data class User( val userName: String, val studentId: String, val aplusId: Long,