mirror of https://github.com/usbharu/Hideout.git
Merge branch 'develop' into structured-logging
This commit is contained in:
commit
cc0e14f00b
|
@ -37,10 +37,7 @@ class CustomEmojiRepositoryImpl : CustomEmojiRepository,
|
||||||
get() = Companion.logger
|
get() = Companion.logger
|
||||||
|
|
||||||
override suspend fun save(customEmoji: CustomEmoji): CustomEmoji = query {
|
override suspend fun save(customEmoji: CustomEmoji): CustomEmoji = query {
|
||||||
val singleOrNull =
|
CustomEmojis.upsert {
|
||||||
CustomEmojis.selectAll().where { CustomEmojis.id eq customEmoji.id.emojiId }.forUpdate().singleOrNull()
|
|
||||||
if (singleOrNull == null) {
|
|
||||||
CustomEmojis.insert {
|
|
||||||
it[id] = customEmoji.id.emojiId
|
it[id] = customEmoji.id.emojiId
|
||||||
it[name] = customEmoji.name
|
it[name] = customEmoji.name
|
||||||
it[domain] = customEmoji.domain.domain
|
it[domain] = customEmoji.domain.domain
|
||||||
|
@ -49,16 +46,6 @@ class CustomEmojiRepositoryImpl : CustomEmojiRepository,
|
||||||
it[category] = customEmoji.category
|
it[category] = customEmoji.category
|
||||||
it[createdAt] = customEmoji.createdAt
|
it[createdAt] = customEmoji.createdAt
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
CustomEmojis.update({ CustomEmojis.id eq customEmoji.id.emojiId }) {
|
|
||||||
it[name] = customEmoji.name
|
|
||||||
it[domain] = customEmoji.domain.domain
|
|
||||||
it[instanceId] = customEmoji.instanceId.instanceId
|
|
||||||
it[url] = customEmoji.url.toString()
|
|
||||||
it[category] = customEmoji.category
|
|
||||||
it[createdAt] = customEmoji.createdAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return@query customEmoji
|
return@query customEmoji
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class ExposedTimelineRelationshipRepository : AbstractRepository(), TimelineRela
|
||||||
|
|
||||||
override suspend fun save(timelineRelationship: TimelineRelationship): TimelineRelationship {
|
override suspend fun save(timelineRelationship: TimelineRelationship): TimelineRelationship {
|
||||||
query {
|
query {
|
||||||
TimelineRelationships.insert {
|
TimelineRelationships.upsert {
|
||||||
it[id] = timelineRelationship.id.value
|
it[id] = timelineRelationship.id.value
|
||||||
it[timelineId] = timelineRelationship.timelineId.value
|
it[timelineId] = timelineRelationship.timelineId.value
|
||||||
it[actorId] = timelineRelationship.actorId.id
|
it[actorId] = timelineRelationship.actorId.id
|
||||||
|
|
|
@ -20,7 +20,7 @@ class ExposedTimelineRepository(override val domainEventPublisher: DomainEventPu
|
||||||
|
|
||||||
override suspend fun save(timeline: Timeline): Timeline {
|
override suspend fun save(timeline: Timeline): Timeline {
|
||||||
query {
|
query {
|
||||||
Timelines.insert {
|
Timelines.upsert {
|
||||||
it[id] = timeline.id.value
|
it[id] = timeline.id.value
|
||||||
it[userDetailId] = timeline.userDetailId.id
|
it[userDetailId] = timeline.userDetailId.id
|
||||||
it[name] = timeline.name.value
|
it[name] = timeline.name.value
|
||||||
|
|
|
@ -33,8 +33,7 @@ class InstanceRepositoryImpl : InstanceRepository,
|
||||||
get() = Companion.logger
|
get() = Companion.logger
|
||||||
|
|
||||||
override suspend fun save(instance: InstanceEntity): InstanceEntity = query {
|
override suspend fun save(instance: InstanceEntity): InstanceEntity = query {
|
||||||
if (Instance.selectAll().where { Instance.id.eq(instance.id.instanceId) }.forUpdate().empty()) {
|
Instance.upsert {
|
||||||
Instance.insert {
|
|
||||||
it[id] = instance.id.instanceId
|
it[id] = instance.id.instanceId
|
||||||
it[name] = instance.name.name
|
it[name] = instance.name.name
|
||||||
it[description] = instance.description.description
|
it[description] = instance.description.description
|
||||||
|
@ -48,21 +47,7 @@ class InstanceRepositoryImpl : InstanceRepository,
|
||||||
it[moderationNote] = instance.moderationNote.note
|
it[moderationNote] = instance.moderationNote.note
|
||||||
it[createdAt] = instance.createdAt
|
it[createdAt] = instance.createdAt
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Instance.update({ Instance.id eq instance.id.instanceId }) {
|
|
||||||
it[name] = instance.name.name
|
|
||||||
it[description] = instance.description.description
|
|
||||||
it[url] = instance.url.toString()
|
|
||||||
it[iconUrl] = instance.iconUrl.toString()
|
|
||||||
it[sharedInbox] = instance.sharedInbox?.toString()
|
|
||||||
it[software] = instance.software.software
|
|
||||||
it[version] = instance.version.version
|
|
||||||
it[isBlocked] = instance.isBlocked
|
|
||||||
it[isMuted] = instance.isMuted
|
|
||||||
it[moderationNote] = instance.moderationNote.note
|
|
||||||
it[createdAt] = instance.createdAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return@query instance
|
return@query instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,22 @@ class MediaRepositoryImpl : MediaRepository, AbstractRepository() {
|
||||||
override val logger: Logger
|
override val logger: Logger
|
||||||
get() = Companion.logger
|
get() = Companion.logger
|
||||||
|
|
||||||
|
override suspend fun save(media: EntityMedia): EntityMedia = query {
|
||||||
|
Media.upsert {
|
||||||
|
it[id] = media.id.id
|
||||||
|
it[name] = media.name.name
|
||||||
|
it[url] = media.url.toString()
|
||||||
|
it[remoteUrl] = media.remoteUrl?.toString()
|
||||||
|
it[thumbnailUrl] = media.thumbnailUrl?.toString()
|
||||||
|
it[type] = media.type.name
|
||||||
|
it[blurhash] = media.blurHash?.hash
|
||||||
|
it[mimeType] = media.mimeType.type + "/" + media.mimeType.subtype
|
||||||
|
it[description] = media.description?.description
|
||||||
|
it[actorId] = media.actorId.id
|
||||||
|
}
|
||||||
|
return@query media
|
||||||
|
}
|
||||||
|
|
||||||
override suspend fun findById(id: MediaId): dev.usbharu.hideout.core.domain.model.media.Media? {
|
override suspend fun findById(id: MediaId): dev.usbharu.hideout.core.domain.model.media.Media? {
|
||||||
return query {
|
return query {
|
||||||
return@query Media
|
return@query Media
|
||||||
|
@ -55,37 +71,6 @@ class MediaRepositoryImpl : MediaRepository, AbstractRepository() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun save(media: EntityMedia): EntityMedia = query {
|
|
||||||
if (Media.selectAll().where { Media.id eq media.id.id }.forUpdate().singleOrNull() != null
|
|
||||||
) {
|
|
||||||
Media.update({ Media.id eq media.id.id }) {
|
|
||||||
it[name] = media.name.name
|
|
||||||
it[url] = media.url.toString()
|
|
||||||
it[remoteUrl] = media.remoteUrl?.toString()
|
|
||||||
it[thumbnailUrl] = media.thumbnailUrl?.toString()
|
|
||||||
it[type] = media.type.name
|
|
||||||
it[blurhash] = media.blurHash?.hash
|
|
||||||
it[mimeType] = media.mimeType.type + "/" + media.mimeType.subtype
|
|
||||||
it[description] = media.description?.description
|
|
||||||
it[actorId] = media.actorId.id
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Media.insert {
|
|
||||||
it[id] = media.id.id
|
|
||||||
it[name] = media.name.name
|
|
||||||
it[url] = media.url.toString()
|
|
||||||
it[remoteUrl] = media.remoteUrl?.toString()
|
|
||||||
it[thumbnailUrl] = media.thumbnailUrl?.toString()
|
|
||||||
it[type] = media.type.name
|
|
||||||
it[blurhash] = media.blurHash?.hash
|
|
||||||
it[mimeType] = media.mimeType.type + "/" + media.mimeType.subtype
|
|
||||||
it[description] = media.description?.description
|
|
||||||
it[actorId] = media.actorId.id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return@query media
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = LoggerFactory.getLogger(MediaRepositoryImpl::class.java)
|
private val logger = LoggerFactory.getLogger(MediaRepositoryImpl::class.java)
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,10 +41,7 @@ class UserDetailRepositoryImpl(override val domainEventPublisher: DomainEventPub
|
||||||
|
|
||||||
override suspend fun save(userDetail: UserDetail): UserDetail {
|
override suspend fun save(userDetail: UserDetail): UserDetail {
|
||||||
val userDetail1 = query {
|
val userDetail1 = query {
|
||||||
val singleOrNull =
|
UserDetails.upsert {
|
||||||
UserDetails.selectAll().where { UserDetails.id eq userDetail.id.id }.forUpdate().singleOrNull()
|
|
||||||
if (singleOrNull == null) {
|
|
||||||
UserDetails.insert {
|
|
||||||
it[id] = userDetail.id.id
|
it[id] = userDetail.id.id
|
||||||
it[actorId] = userDetail.actorId.id
|
it[actorId] = userDetail.actorId.id
|
||||||
it[password] = userDetail.password.password
|
it[password] = userDetail.password.password
|
||||||
|
@ -52,15 +49,7 @@ class UserDetailRepositoryImpl(override val domainEventPublisher: DomainEventPub
|
||||||
it[lastMigration] = userDetail.lastMigration
|
it[lastMigration] = userDetail.lastMigration
|
||||||
it[homeTimelineId] = userDetail.homeTimelineId?.value
|
it[homeTimelineId] = userDetail.homeTimelineId?.value
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
UserDetails.update({ UserDetails.id eq userDetail.id.id }) {
|
|
||||||
it[actorId] = userDetail.actorId.id
|
|
||||||
it[password] = userDetail.password.password
|
|
||||||
it[autoAcceptFolloweeFollowRequest] = userDetail.autoAcceptFolloweeFollowRequest
|
|
||||||
it[lastMigration] = userDetail.lastMigration
|
|
||||||
it[homeTimelineId] = userDetail.homeTimelineId?.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onComplete {
|
onComplete {
|
||||||
update(userDetail)
|
update(userDetail)
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-
|
||||||
|
|
||||||
blurhash = { module = "io.trbl:blurhash", version = "1.0.0" }
|
blurhash = { module = "io.trbl:blurhash", version = "1.0.0" }
|
||||||
|
|
||||||
aws-s3 = { module = "software.amazon.awssdk:s3", version = "2.27.20" }
|
aws-s3 = { module = "software.amazon.awssdk:s3", version = "2.27.21" }
|
||||||
|
|
||||||
jsoup = { module = "org.jsoup:jsoup", version = "1.18.1" }
|
jsoup = { module = "org.jsoup:jsoup", version = "1.18.1" }
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ protoc = { module = "com.google.protobuf:protoc", version.ref = "protobuf" }
|
||||||
koin-bom = { module = "io.insert-koin:koin-bom", version = "3.5.6" }
|
koin-bom = { module = "io.insert-koin:koin-bom", version = "3.5.6" }
|
||||||
koin-core = { module = "io.insert-koin:koin-core" }
|
koin-core = { module = "io.insert-koin:koin-core" }
|
||||||
|
|
||||||
log4j2-slf4j = { module = "org.apache.logging.log4j:log4j-slf4j2-impl", version = "2.23.1" }
|
log4j2-slf4j = { module = "org.apache.logging.log4j:log4j-slf4j2-impl", version = "2.24.0" }
|
||||||
|
|
||||||
mongodb-kotlin-coroutine = { module = "org.mongodb:mongodb-driver-kotlin-coroutine", version = "5.1.4" }
|
mongodb-kotlin-coroutine = { module = "org.mongodb:mongodb-driver-kotlin-coroutine", version = "5.1.4" }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue