mirror of https://github.com/usbharu/Hideout.git
Compare commits
17 Commits
063d8f1359
...
b4035bebcf
| Author | SHA1 | Date |
|---|---|---|
|
|
b4035bebcf | |
|
|
1d6fbaca90 | |
|
|
e28b8f0d6c | |
|
|
ac2a8e4da2 | |
|
|
91aa7c7def | |
|
|
578ed2d8fe | |
|
|
516147252b | |
|
|
c88ff0b3fe | |
|
|
3c604abe37 | |
|
|
adf1dfc1f3 | |
|
|
a935537332 | |
|
|
4a6deacb7e | |
|
|
2ce08e0430 | |
|
|
dddbc8e4db | |
|
|
b0cc7c9df5 | |
|
|
f995f44c15 | |
|
|
10767d01c6 |
|
|
@ -11,7 +11,7 @@ services:
|
|||
POSTGRES_DB: "hideout"
|
||||
|
||||
mongodb:
|
||||
image: mongo:8.0.8
|
||||
image: mongo:8.0.9
|
||||
ports:
|
||||
- "27017:27017"
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,29 @@ subprojects {
|
|||
kotlin {
|
||||
jvmToolchain(21)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val mergeChildResources by tasks.registering(Copy::class) {
|
||||
// 各子プロジェクトの resources を処理後に取得
|
||||
dependsOn(subprojects.map { it.tasks.named("processResources") })
|
||||
|
||||
subprojects.forEach { sub ->
|
||||
// 各サブプロジェクトの 'bootBuildInfo' タスクを待機するように設定
|
||||
dependsOn(sub.tasks.named("bootBuildInfo"))
|
||||
|
||||
// サブプロジェクトの 'resources/main' をマージ
|
||||
from(sub.layout.buildDirectory.dir("resources/main"))
|
||||
}
|
||||
into(layout.buildDirectory.dir("resources/main"))
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
dependsOn(mergeChildResources)
|
||||
}
|
||||
|
||||
|
||||
tasks {
|
||||
register("run") {
|
||||
dependsOn(gradle.includedBuild("hideout-core").task(":run"))
|
||||
|
|
@ -83,7 +104,7 @@ tasks {
|
|||
}
|
||||
named<BootJar>("bootJar") {
|
||||
layered {
|
||||
enabled.set(false)
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.github.jk1.license.importer.XmlReportImporter
|
|||
import com.github.jk1.license.render.*
|
||||
import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootJar
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
|
|
@ -138,8 +139,18 @@ tasks {
|
|||
).toMutableList()
|
||||
}
|
||||
}
|
||||
|
||||
named<BootJar>("bootJar") {
|
||||
layered {
|
||||
// enabled.set(false)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
springBoot {
|
||||
buildInfo()
|
||||
}
|
||||
|
||||
|
||||
kover {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class Post(
|
|||
visibleActors: Set<ActorId>,
|
||||
hide: Boolean,
|
||||
moveTo: PostId?,
|
||||
val wasTruncated: Boolean,
|
||||
) : DomainEventStorable() {
|
||||
|
||||
val actorId = actorId
|
||||
|
|
@ -235,7 +236,8 @@ class Post(
|
|||
mediaIds = mediaIds,
|
||||
visibleActors = visibleActors,
|
||||
hide = hide,
|
||||
moveTo = moveTo
|
||||
moveTo = moveTo,
|
||||
wasTruncated = wasTruncated
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -310,7 +312,8 @@ class Post(
|
|||
mediaIds = mediaIds,
|
||||
visibleActors = visibleActors,
|
||||
hide = hide,
|
||||
moveTo = moveTo
|
||||
moveTo = moveTo,
|
||||
wasTruncated = content.wasTruncated
|
||||
)
|
||||
post.addDomainEvent(PostDomainEventFactory(post).createEvent(PostEvent.CREATE))
|
||||
return post
|
||||
|
|
|
|||
|
|
@ -18,11 +18,54 @@ package dev.usbharu.hideout.core.domain.model.post
|
|||
|
||||
import dev.usbharu.hideout.core.domain.model.emoji.CustomEmojiId
|
||||
|
||||
data class PostContent(val text: String, val content: String, val emojiIds: List<CustomEmojiId>) {
|
||||
class PostContent {
|
||||
|
||||
val text: String
|
||||
val content: String
|
||||
val emojiIds: List<CustomEmojiId>
|
||||
val wasTruncated: Boolean
|
||||
|
||||
constructor(text: String, content: String, emojiIds: List<CustomEmojiId>) {
|
||||
wasTruncated = text.length > TEXT_LENGTH || content.length > CONTENT_LENGTH
|
||||
this.text = text.take(TEXT_LENGTH)
|
||||
this.content = content.take(CONTENT_LENGTH)
|
||||
this.emojiIds = emojiIds.distinct()
|
||||
}
|
||||
|
||||
companion object {
|
||||
val empty = PostContent("", "", emptyList())
|
||||
const val CONTENT_LENGTH = 5000
|
||||
const val TEXT_LENGTH = 3000
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as PostContent
|
||||
|
||||
if (wasTruncated != other.wasTruncated) return false
|
||||
if (text != other.text) return false
|
||||
if (content != other.content) return false
|
||||
if (emojiIds != other.emojiIds) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = wasTruncated.hashCode()
|
||||
result = 31 * result + text.hashCode()
|
||||
result = 31 * result + content.hashCode()
|
||||
result = 31 * result + emojiIds.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "PostContent(" +
|
||||
"text='$text', " +
|
||||
"content='$content', " +
|
||||
"emojiIds=$emojiIds, " +
|
||||
"wasTruncated=$wasTruncated" +
|
||||
")"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ class PostResultRowMapper : ResultRowMapper<Post> {
|
|||
mediaIds = emptyList(),
|
||||
visibleActors = emptySet(),
|
||||
hide = resultRow[Posts.hide],
|
||||
moveTo = resultRow[Posts.moveTo]?.let { PostId(it) }
|
||||
moveTo = resultRow[Posts.moveTo]?.let { PostId(it) },
|
||||
wasTruncated = resultRow[Posts.wasTruncated]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import dev.usbharu.hideout.core.infrastructure.exposedrepository.Posts.sensitive
|
|||
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Posts.text
|
||||
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Posts.url
|
||||
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Posts.visibility
|
||||
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Posts.wasTruncated
|
||||
import org.jetbrains.exposed.sql.*
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
|
||||
|
|
@ -74,6 +75,7 @@ class ExposedPostRepository(
|
|||
it[deleted] = post.deleted
|
||||
it[hide] = post.hide
|
||||
it[moveTo] = post.moveTo?.id
|
||||
it[wasTruncated] = post.wasTruncated
|
||||
}
|
||||
PostsMedia.deleteWhere {
|
||||
postId eq post.id.id
|
||||
|
|
@ -123,6 +125,7 @@ class ExposedPostRepository(
|
|||
this[deleted] = it.deleted
|
||||
this[hide] = it.hide
|
||||
this[moveTo] = it.moveTo?.id
|
||||
this[wasTruncated] = it.wasTruncated
|
||||
}
|
||||
val mediaIds = posts.flatMap { post -> post.mediaIds.map { post.id.id to it.id } }
|
||||
val postsIds = posts.map { it.id.id }
|
||||
|
|
@ -296,10 +299,11 @@ object Posts : Table("posts") {
|
|||
val repostId = long("repost_id").references(id).nullable()
|
||||
val replyId = long("reply_id").references(id).nullable()
|
||||
val sensitive = bool("sensitive")
|
||||
val apId = varchar("ap_id", 1000)
|
||||
val apId = varchar("ap_id", 1000).uniqueIndex()
|
||||
val deleted = bool("deleted")
|
||||
val hide = bool("hide")
|
||||
val moveTo = long("move_to").references(id).nullable()
|
||||
val wasTruncated = bool("was_truncated").default(false).clientDefault { false }
|
||||
override val primaryKey: PrimaryKey = PrimaryKey(id)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,22 +149,23 @@ alter table actors
|
|||
|
||||
create table if not exists posts
|
||||
(
|
||||
id bigint primary key,
|
||||
actor_id bigint not null,
|
||||
instance_id bigint not null,
|
||||
overview varchar(100) null,
|
||||
content varchar(5000) not null,
|
||||
text varchar(3000) not null,
|
||||
created_at timestamp not null,
|
||||
visibility varchar(100) not null,
|
||||
url varchar(500) not null,
|
||||
repost_id bigint null,
|
||||
reply_id bigint null,
|
||||
"sensitive" boolean default false not null,
|
||||
ap_id varchar(100) not null unique,
|
||||
deleted boolean default false not null,
|
||||
hide boolean default false not null,
|
||||
move_to bigint default null null
|
||||
id bigint primary key,
|
||||
actor_id bigint not null,
|
||||
instance_id bigint not null,
|
||||
overview varchar(100) null,
|
||||
content varchar(5000) not null,
|
||||
text varchar(3000) not null,
|
||||
created_at timestamp not null,
|
||||
visibility varchar(100) not null,
|
||||
url varchar(500) not null,
|
||||
repost_id bigint null,
|
||||
reply_id bigint null,
|
||||
"sensitive" boolean default false not null,
|
||||
ap_id varchar(100) not null unique,
|
||||
deleted boolean default false not null,
|
||||
hide boolean default false not null,
|
||||
move_to bigint default null null,
|
||||
was_truncated boolean default false not null
|
||||
);
|
||||
alter table posts
|
||||
add constraint fk_posts_instance_id__id foreign key (instance_id) references instance (id) on delete cascade on update cascade;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<configuration>
|
||||
<property name="LOG_FILE" value="logs/logFile.log"/>
|
||||
<property name="CONSOLE_LOG_THRESHOLD" value="${CONSOLE_LOG_THRESHOLD:-INFO}"/>
|
||||
<property name="CONSOLE_LOG_THRESHOLD" value="${CONSOLE_LOG_THRESHOLD:-TRACE}"/>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/file-appender.xml"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package dev.usbharu.hideout.core.domain.model.post
|
||||
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class PostContentTest {
|
||||
@Test
|
||||
fun textがtext_lengthを超える場合は切り取られてwasTruncatedがtrue() {
|
||||
val postContent = PostContent(
|
||||
"a".repeat(PostContent.TEXT_LENGTH + 1),
|
||||
"b".repeat(PostContent.CONTENT_LENGTH),
|
||||
emptyList()
|
||||
)
|
||||
|
||||
assertTrue(postContent.wasTruncated)
|
||||
|
||||
assertEquals(postContent.text, "a".repeat(PostContent.TEXT_LENGTH))
|
||||
assertEquals(postContent.content, "b".repeat(PostContent.CONTENT_LENGTH))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun textがtext_lengthを超えない場合は変わらずwasTruncatedがfalse() {
|
||||
val postContent = PostContent(
|
||||
"a".repeat(PostContent.TEXT_LENGTH),
|
||||
"b".repeat(PostContent.CONTENT_LENGTH),
|
||||
emptyList()
|
||||
)
|
||||
|
||||
assertFalse(postContent.wasTruncated)
|
||||
|
||||
assertEquals(postContent.text, "a".repeat(PostContent.TEXT_LENGTH))
|
||||
assertEquals(postContent.content, "b".repeat(PostContent.CONTENT_LENGTH))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun contentがcontent_lengthを超える場合は切り取られてwasTruncatedがtrue() {
|
||||
val postContent = PostContent(
|
||||
"a".repeat(PostContent.TEXT_LENGTH),
|
||||
"b".repeat(PostContent.CONTENT_LENGTH + 1),
|
||||
emptyList()
|
||||
)
|
||||
|
||||
assertTrue(postContent.wasTruncated)
|
||||
|
||||
assertEquals(postContent.text, "a".repeat(PostContent.TEXT_LENGTH))
|
||||
assertEquals(postContent.content, "b".repeat(PostContent.CONTENT_LENGTH))
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ object TestPostFactory {
|
|||
hide: Boolean = false,
|
||||
moveTo: Long? = null,
|
||||
emojiIds: List<Long> = emptyList(),
|
||||
wasTruncated: Boolean = false,
|
||||
): Post {
|
||||
return Post(
|
||||
PostId(id),
|
||||
|
|
@ -49,7 +50,8 @@ object TestPostFactory {
|
|||
mediaIds = mediaIds.map { MediaId(it) },
|
||||
visibleActors = visibleActors.map { ActorId(it) }.toSet(),
|
||||
hide = hide,
|
||||
moveTo = moveTo?.let { PostId(it) }
|
||||
moveTo = moveTo?.let { PostId(it) },
|
||||
wasTruncated = wasTruncated
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -270,7 +270,8 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
null,
|
||||
false
|
||||
)
|
||||
}
|
||||
}.launch()
|
||||
|
|
@ -329,7 +330,8 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
null,
|
||||
false
|
||||
)
|
||||
}
|
||||
insertInto(PostsMedia.tableName) {
|
||||
|
|
@ -364,7 +366,9 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
deleted = false,
|
||||
mediaIds = listOf(MediaId(2)),
|
||||
visibleActors = setOf(ActorId(4)),
|
||||
hide = false, moveTo = null
|
||||
hide = false,
|
||||
moveTo = null,
|
||||
wasTruncated = false
|
||||
)
|
||||
|
||||
assertNotNull(actual)
|
||||
|
|
@ -398,60 +402,9 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1832779978794602496,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
2,
|
||||
1832779978794602496,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/18327739994749734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/18327793994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
3,
|
||||
1832779978794602496,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/183277399947494734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/183277939947493734912",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
postsValues(1)
|
||||
postsValues(2)
|
||||
postsValues(3)
|
||||
}
|
||||
}.launch()
|
||||
|
||||
|
|
@ -467,60 +420,9 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
2,
|
||||
2,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/18327739994749734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/18327793994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
3,
|
||||
1,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/183277399947494734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/183277939947493734912",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
postsValues(1)
|
||||
postsValues(2, 2)
|
||||
postsValues(3)
|
||||
}
|
||||
}.launch()
|
||||
|
||||
|
|
@ -536,65 +438,16 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
2,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-02T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/18327739994749734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/18327793994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
3,
|
||||
1,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-03T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/183277399947494734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/183277939947493734912",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
postsValues(1)
|
||||
postsValues(2)
|
||||
postsValues(3)
|
||||
}
|
||||
}.launch()
|
||||
|
||||
val findAllById = repository.findByActorId(ActorId(1), Page.of(maxId = 3))
|
||||
|
||||
findAllById.forEach(::println)
|
||||
|
||||
assertThat(findAllById)
|
||||
.hasSize(2)
|
||||
|
||||
|
|
@ -608,60 +461,9 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
2,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-02T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/18327739994749734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/18327793994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
3,
|
||||
1,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-03T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/183277399947494734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/183277939947493734912",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
postsValues(1)
|
||||
postsValues(2)
|
||||
postsValues(3)
|
||||
}
|
||||
}.launch()
|
||||
|
||||
|
|
@ -680,60 +482,9 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
2,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-02T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/18327739994749734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/18327793994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
3,
|
||||
1,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-03T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/183277399947494734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/183277939947493734912",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
postsValues(1)
|
||||
postsValues(2)
|
||||
postsValues(3)
|
||||
}
|
||||
}.launch()
|
||||
|
||||
|
|
@ -752,60 +503,9 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
2,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-02T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/18327739994749734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/18327793994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
3,
|
||||
1,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-03T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/183277399947494734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/183277939947493734912",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
postsValues(1)
|
||||
postsValues(2)
|
||||
postsValues(3)
|
||||
}
|
||||
}.launch()
|
||||
|
||||
|
|
@ -823,24 +523,7 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1832779978794602496,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
postsValues(1)
|
||||
}
|
||||
insertInto(PostsMedia.tableName) {
|
||||
columns(PostsMedia.columns)
|
||||
|
|
@ -884,78 +567,10 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
2,
|
||||
2,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-02T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/18327739994749734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/18327793994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
3,
|
||||
1,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-03T00:00:00Z")),
|
||||
"UNLISTED",
|
||||
"http://localhost:8081/users/a/posts/183277399947494734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/183277939947493734912",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
values(
|
||||
4,
|
||||
1,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-04T00:00:00Z")),
|
||||
"FOLLOWERS",
|
||||
"http://localhost:8081/users/a/posts/1832773999474947343912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779399474937349312",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
postsValues(1)
|
||||
postsValues(2, 2)
|
||||
postsValues(3, 2)
|
||||
postsValues(4)
|
||||
}
|
||||
}.launch()
|
||||
|
||||
|
|
@ -975,42 +590,8 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
3,
|
||||
1,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-03T00:00:00Z")),
|
||||
"UNLISTED",
|
||||
"http://localhost:8081/users/a/posts/183277399947494734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/183277939947493734912",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
postsValues(1)
|
||||
postsValues(3)
|
||||
}
|
||||
insertInto(PostsMedia.tableName) {
|
||||
columns(PostsMedia.columns)
|
||||
|
|
@ -1087,42 +668,8 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
values(
|
||||
3,
|
||||
1,
|
||||
1832779642545639424,
|
||||
"",
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-03T00:00:00Z")),
|
||||
"UNLISTED",
|
||||
"http://localhost:8081/users/a/posts/183277399947494734912",
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/183277939947493734912",
|
||||
false,
|
||||
false,
|
||||
2
|
||||
)
|
||||
postsValues(1)
|
||||
postsValues(3)
|
||||
}
|
||||
insertInto(PostsMedia.tableName) {
|
||||
columns(PostsMedia.columns)
|
||||
|
|
@ -1168,24 +715,7 @@ class ExposedPostRepositoryTest : AbstractRepositoryTest(Posts) {
|
|||
execute(disableReferenceIntegrityConstraints)
|
||||
insertInto("public.posts") {
|
||||
columns(Posts.columns)
|
||||
values(
|
||||
1,
|
||||
1,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z")),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
)
|
||||
postsValues(1)
|
||||
}
|
||||
}.launch()
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
|||
"https://example.com",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
null,
|
||||
false
|
||||
)
|
||||
}
|
||||
insertInto("public.actors") {
|
||||
|
|
@ -141,7 +142,8 @@ class ExposedReactionRepositoryTest : AbstractRepositoryTest(Reactions) {
|
|||
"https://example.com",
|
||||
false,
|
||||
false,
|
||||
null
|
||||
null,
|
||||
false
|
||||
)
|
||||
}
|
||||
insertInto("public.actors") {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package utils
|
||||
|
||||
import com.ninja_squad.dbsetup.operation.Insert
|
||||
import java.sql.Timestamp
|
||||
import java.time.Instant
|
||||
|
||||
fun Insert.Builder.postsValues(index: Long = 1, actor: Long = 1) {
|
||||
values(
|
||||
index,
|
||||
actor,
|
||||
1832779642545639424,
|
||||
null,
|
||||
"<p>test</p>",
|
||||
"test",
|
||||
Timestamp.from(Instant.parse("2020-01-01T00:00:00Z").plusSeconds(index.toLong())),
|
||||
"PUBLIC",
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912",
|
||||
2,
|
||||
2,
|
||||
false,
|
||||
"http://localhost:8081/users/a/posts/1832779994749734912$index",
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
[versions]
|
||||
|
||||
kotlin = "2.1.20"
|
||||
ktor = "3.1.1"
|
||||
ktor = "3.1.3"
|
||||
exposed = "0.59.0"
|
||||
javacv-ffmpeg = "7.1-1.5.11"
|
||||
detekt = "1.23.7"
|
||||
coroutines = "1.10.1"
|
||||
swagger = "2.2.28"
|
||||
coroutines = "1.10.2"
|
||||
swagger = "2.2.30"
|
||||
tika = "3.1.0"
|
||||
owl = "0.0.1"
|
||||
jackson = "2.18.2"
|
||||
protobuf = "4.29.3"
|
||||
grpc-java = "1.69.1"
|
||||
grpc-kotlin = "1.4.1"
|
||||
grpc-java = "1.72.0"
|
||||
grpc-kotlin = "1.4.3"
|
||||
|
||||
[libraries]
|
||||
|
||||
|
|
@ -89,11 +89,12 @@ grpc-protobuf = { module = "io.grpc:grpc-protobuf", version.ref = "grpc-java" }
|
|||
grpc-netty = { module = "io.grpc:grpc-netty", version.ref = "grpc-java" }
|
||||
protoc-gen-grpc-java = { module = "io.grpc:protoc-gen-grpc-java", version.ref = "grpc-java" }
|
||||
protoc-gen-grpc-kotlin = { module = "io.grpc:protoc-gen-grpc-kotlin", version.ref = "grpc-kotlin" }
|
||||
grpc-stub = { module = "io.grpc:grpc-stub", version.ref = "grpc-java" }
|
||||
|
||||
protobuf-kotlin = { module = "com.google.protobuf:protobuf-kotlin", version.ref = "protobuf" }
|
||||
protoc = { module = "com.google.protobuf:protoc", version.ref = "protobuf" }
|
||||
|
||||
koin-bom = { module = "io.insert-koin:koin-bom", version = "4.0.2" }
|
||||
koin-bom = { module = "io.insert-koin:koin-bom", version = "4.0.4" }
|
||||
koin-core = { module = "io.insert-koin:koin-core" }
|
||||
|
||||
log4j2-slf4j = { module = "org.apache.logging.log4j:log4j-slf4j2-impl", version = "2.24.3" }
|
||||
|
|
@ -122,15 +123,15 @@ apache-tika = ["apache-tika-core", "apache-tika-parsers"]
|
|||
owl-producer = ["owl-producer-api", "owl-producer-default", "owl-producer-embedded"]
|
||||
owl-broker = ["owl-broker", "owl-broker-mongodb"]
|
||||
jackson = ["jackson-databind", "jackson-module-kotlin"]
|
||||
grpc-kotlin = ["grpc-kotlin-stub", "grpc-netty", "grpc-protobuf", "protobuf-kotlin"]
|
||||
grpc-kotlin = ["grpc-kotlin-stub", "grpc-netty", "grpc-protobuf", "protobuf-kotlin", "grpc-stub"]
|
||||
|
||||
[plugins]
|
||||
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
spring-boot = { id = "org.springframework.boot", version = "3.4.3" }
|
||||
spring-boot = { id = "org.springframework.boot", version = "3.4.5" }
|
||||
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
|
||||
kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
|
||||
kover = { id = "org.jetbrains.kotlinx.kover", version = "0.9.1" }
|
||||
openapi-generator = { id = "org.openapi.generator", version = "7.13.0" }
|
||||
license-report = { id = "com.github.jk1.dependency-license-report", version = "2.9" }
|
||||
protobuf-plugin = { id = "com.google.protobuf", version = "0.9.4" }
|
||||
protobuf-plugin = { id = "com.google.protobuf", version = "0.9.5" }
|
||||
|
|
@ -40,7 +40,7 @@ subprojects {
|
|||
|
||||
dependencies {
|
||||
implementation("org.slf4j:slf4j-api:2.0.17")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.12.0")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.12.2")
|
||||
detektPlugins(rootProject.libs.detekt.formatting)
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue