Skip to content

Commit

Permalink
feat: Allow setting Announcement.createdAt when creating an announc…
Browse files Browse the repository at this point in the history
…ement
  • Loading branch information
oSumAtrIX committed Nov 13, 2024
1 parent 48469d3 commit 7f6e29d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/kotlin/app/revanced/api/configuration/APISchema.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package app.revanced.api.configuration

import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
import kotlinx.serialization.Serializable

interface ApiUser {
Expand Down Expand Up @@ -63,7 +66,7 @@ class ApiAnnouncement(
val attachments: List<String> = emptyList(),
// Using a list instead of a set because set semantics are unnecessary here.
val tags: List<String> = emptyList(),
val createdAt: LocalDateTime,
val createdAt: LocalDateTime = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()),
val archivedAt: LocalDateTime? = null,
val level: Int = 0,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ internal class AnnouncementRepository(private val database: Database) {
author = new.author
title = new.title
content = new.content
createdAt = new.createdAt
archivedAt = new.archivedAt
level = new.level
tags = SizedCollection(
Expand Down

0 comments on commit 7f6e29d

Please sign in to comment.