mirror of
https://github.com/revanced/revanced-api.git
synced 2025-04-29 22:24:31 +02:00
feat: Allow setting Announcement.createdAt
when creating an announcement
This commit is contained in:
parent
48469d32c2
commit
7f6e29de52
@ -1,6 +1,9 @@
|
|||||||
package app.revanced.api.configuration
|
package app.revanced.api.configuration
|
||||||
|
|
||||||
|
import kotlinx.datetime.Clock
|
||||||
import kotlinx.datetime.LocalDateTime
|
import kotlinx.datetime.LocalDateTime
|
||||||
|
import kotlinx.datetime.TimeZone
|
||||||
|
import kotlinx.datetime.toLocalDateTime
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
interface ApiUser {
|
interface ApiUser {
|
||||||
@ -63,7 +66,7 @@ class ApiAnnouncement(
|
|||||||
val attachments: List<String> = emptyList(),
|
val attachments: List<String> = emptyList(),
|
||||||
// Using a list instead of a set because set semantics are unnecessary here.
|
// Using a list instead of a set because set semantics are unnecessary here.
|
||||||
val tags: List<String> = emptyList(),
|
val tags: List<String> = emptyList(),
|
||||||
val createdAt: LocalDateTime,
|
val createdAt: LocalDateTime = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()),
|
||||||
val archivedAt: LocalDateTime? = null,
|
val archivedAt: LocalDateTime? = null,
|
||||||
val level: Int = 0,
|
val level: Int = 0,
|
||||||
)
|
)
|
||||||
|
@ -100,6 +100,7 @@ internal class AnnouncementRepository(private val database: Database) {
|
|||||||
author = new.author
|
author = new.author
|
||||||
title = new.title
|
title = new.title
|
||||||
content = new.content
|
content = new.content
|
||||||
|
createdAt = new.createdAt
|
||||||
archivedAt = new.archivedAt
|
archivedAt = new.archivedAt
|
||||||
level = new.level
|
level = new.level
|
||||||
tags = SizedCollection(
|
tags = SizedCollection(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user