feat: 起動できる状態に

This commit is contained in:
usbharu 2024-07-20 01:27:30 +09:00
parent b61282a058
commit c32e264575
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
4 changed files with 57 additions and 13 deletions

View File

@ -18,6 +18,8 @@ package dev.usbharu.hideout.core.infrastructure.exposedrepository
import dev.usbharu.hideout.core.domain.model.actor.ActorId
import dev.usbharu.hideout.core.domain.model.post.*
import dev.usbharu.hideout.core.domain.model.support.page.Page
import dev.usbharu.hideout.core.domain.model.support.page.PaginationList
import dev.usbharu.hideout.core.domain.shared.domainevent.DomainEventPublisher
import dev.usbharu.hideout.core.domain.shared.repository.DomainEventPublishableRepository
import dev.usbharu.hideout.core.infrastructure.exposed.QueryMapper
@ -160,14 +162,14 @@ class ExposedPostRepository(
.first()
}
override suspend fun findByActorId(id: ActorId): List<Post> = query {
override suspend fun findByActorId(id: ActorId, page: Page?): PaginationList<Post, PostId> = PaginationList(query {
Posts
.selectAll()
.where {
actorId eq id.id
actorId eq actorId
}
.let(postQueryMapper::map)
}
}, null, null)
override suspend fun delete(post: Post) {
query {

View File

@ -42,6 +42,12 @@ class ExposedTimelineRepository(override val domainEventPublisher: DomainEventPu
}
}
override suspend fun findById(id: TimelineId): Timeline? {
return query {
Timelines.selectAll().where { Timelines.id eq id.value }.firstOrNull()?.toTimeline()
}
}
companion object {
private val logger = LoggerFactory.getLogger(ExposedTimelineRepository::class.java.name)
}

View File

@ -0,0 +1,35 @@
package dev.usbharu.hideout.core.infrastructure.mongorepository
import dev.usbharu.hideout.core.domain.model.actor.ActorId
import dev.usbharu.hideout.core.domain.model.post.PostId
import dev.usbharu.hideout.core.domain.model.timeline.TimelineId
import dev.usbharu.hideout.core.domain.model.timelineobject.TimelineObject
import dev.usbharu.hideout.core.infrastructure.timeline.InternalTimelineObjectRepository
import org.springframework.stereotype.Repository
@Repository
class MongoInternalTimelineObjectRepository : InternalTimelineObjectRepository {
override suspend fun save(timelineObject: TimelineObject): TimelineObject {
TODO("Not yet implemented")
}
override suspend fun saveAll(timelineObjectList: List<TimelineObject>): List<TimelineObject> {
TODO("Not yet implemented")
}
override suspend fun findByPostId(postId: PostId): List<TimelineObject> {
TODO("Not yet implemented")
}
override suspend fun deleteByPostId(postId: PostId) {
TODO("Not yet implemented")
}
override suspend fun deleteByTimelineIdAndActorId(timelineId: TimelineId, actorId: ActorId) {
TODO("Not yet implemented")
}
override suspend fun deleteByTimelineId(timelineId: TimelineId) {
TODO("Not yet implemented")
}
}

View File

@ -44,7 +44,7 @@ create table if not exists actors
created_at timestamp not null,
key_id varchar(1000) not null,
"following" varchar(1000) null,
followers varchar(1000) null,
"followers" varchar(1000) null,
"instance" bigint not null,
locked boolean not null,
following_count int null,
@ -53,11 +53,11 @@ create table if not exists actors
last_post_at timestamp null default null,
last_update_at timestamp not null,
suspend boolean not null,
move_to bigint null default null,
"move_to" bigint null default null,
emojis varchar(3000) not null default '',
deleted boolean not null default false,
icon bigint null,
banner bigint null,
"icon" bigint null,
"banner" bigint null,
unique ("name", "domain"),
constraint fk_actors_instance__id foreign key ("instance") references instance (id) on delete restrict on update restrict,
constraint fk_actors_actors__move_to foreign key ("move_to") references actors (id) on delete restrict on update restrict
@ -65,8 +65,8 @@ create table if not exists actors
create table if not exists actor_alsoknownas
(
actor_id bigint not null,
also_known_as bigint not null,
"actor_id" bigint not null,
"also_known_as" bigint not null,
constraint fk_actor_alsoknownas_actors__actor_id foreign key ("actor_id") references actors (id) on delete cascade on update cascade,
constraint fk_actor_alsoknownas_actors__also_known_as foreign key ("also_known_as") references actors (id) on delete cascade on update cascade
);
@ -179,13 +179,14 @@ create table if not exists relationships
unique (actor_id, target_actor_id)
);
insert into instance (id, name, description, url, icon_url, shared_inbox, software, version, is_blocked, is_muted,
insert into instance (id, "name", description, url, icon_url, shared_inbox, software, version, is_blocked, is_muted,
moderation_note, created_at)
values (0, 'system', '', '', '', null, '', '', false, false, '', current_timestamp);
insert into actors (id, name, domain, screen_name, description, inbox, outbox, url, public_key, private_key, created_at,
key_id, following, followers, instance, locked, following_count, followers_count, posts_count,
last_post_at, last_update_at, suspend, move_to, emojis)
insert into actors (id, "name", "domain", screen_name, description, inbox, outbox, url, public_key, private_key,
created_at,
key_id, "following", "followers", "instance", locked, following_count, followers_count, posts_count,
last_post_at, last_update_at, suspend, "move_to", emojis)
values (0, '', '', '', '', '', '', '', '', null, current_timestamp, '', null, null, 0, true, null, null, 0, null,
current_timestamp, false, null, '');