Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e6ad18f

Browse files
committed
projects can't work with data classes
1 parent 6c0b7d2 commit e6ad18f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

β€Žtelegram-bot/src/main/kotlin/by/jprof/coding/problems/bot/domain/domain.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ enum class Messenger(val messenger: String) {
1515
}
1616

1717
@Table
18-
data class Problem(
19-
@Id @JvmField var id: String,
20-
val link: String,
21-
val title: String,
18+
class Problem(
19+
@Id @JvmField var id: String?,
20+
val link: String?,
21+
val title: String?,
2222
val acceptance: String?,
23-
val difficulty: String,
24-
val platform: String = Platform.LEETCODE.platform
23+
val difficulty: String?,
24+
val platform: String? = Platform.LEETCODE.platform
2525
) : Persistable<String> {
26-
override fun getId(): String = id
26+
override fun getId(): String ? = id
2727

2828
override fun isNew(): Boolean {
29-
val new = id.isEmpty()
29+
val new = id?.isEmpty() ?: true
3030
id = if (new) UUID.randomUUID().toString() else id
3131
return new
3232
}
3333

3434
}
3535

36-
data class Chat(
36+
class Chat(
3737
val id: String,
3838
val messenger: String = Messenger.TELEGRAM.messenger
3939
)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package by.jprof.coding.problems.bot.projection
22

33
interface ProblemLink {
4-
fun getLink(): String
4+
val link: String
55
}

β€Žtelegram-bot/src/main/kotlin/by/jprof/coding/problems/bot/task/PoolLeetcodeProblem.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class PoolLeetcodeProblem(
2929
fun runPool() = runBlocking {
3030
txOperator.executeAndAwait {
3131
log.info("getting saved leetcode problems")
32-
val links = problemRepository.findAllProjectedBy().map { it.getLink() }.toSet()
32+
val links = problemRepository.findAllProjectedBy().map { it.link }.toSet()
3333
log.info("scraping all leetcode the problems")
3434
val scrapedProblems = leetCodeProblemsScraper.scrapeAllLeetCodeProblems()
3535
scrapedProblems.forEach {log.info(it.difficulty)}

0 commit comments

Comments
Β (0)