mirror of https://github.com/usbharu/Hideout.git
feat: 自分自身をホームタイムラインに追加するように
This commit is contained in:
parent
e9d776f71a
commit
e1787423e8
|
@ -4,6 +4,10 @@ import dev.usbharu.hideout.core.application.shared.AbstractApplicationService
|
|||
import dev.usbharu.hideout.core.application.shared.Transaction
|
||||
import dev.usbharu.hideout.core.domain.model.support.principal.Principal
|
||||
import dev.usbharu.hideout.core.domain.model.timeline.*
|
||||
import dev.usbharu.hideout.core.domain.model.timelinerelationship.TimelineRelationship
|
||||
import dev.usbharu.hideout.core.domain.model.timelinerelationship.TimelineRelationshipId
|
||||
import dev.usbharu.hideout.core.domain.model.timelinerelationship.TimelineRelationshipRepository
|
||||
import dev.usbharu.hideout.core.domain.model.timelinerelationship.Visible
|
||||
import dev.usbharu.hideout.core.domain.model.userdetails.UserDetailId
|
||||
import dev.usbharu.hideout.core.domain.model.userdetails.UserDetailRepository
|
||||
import dev.usbharu.hideout.core.domain.shared.id.IdGenerateService
|
||||
|
@ -15,6 +19,7 @@ class UserRegisterHomeTimelineApplicationService(
|
|||
private val userDetailRepository: UserDetailRepository,
|
||||
private val timelineRepository: TimelineRepository,
|
||||
private val idGenerateService: IdGenerateService, transaction: Transaction,
|
||||
private val timelineRelationshipRepository: TimelineRelationshipRepository
|
||||
) : AbstractApplicationService<RegisterHomeTimeline, Unit>(transaction, logger) {
|
||||
override suspend fun internalExecute(command: RegisterHomeTimeline, principal: Principal) {
|
||||
|
||||
|
@ -31,6 +36,15 @@ class UserRegisterHomeTimelineApplicationService(
|
|||
timelineRepository.save(timeline)
|
||||
userDetail.homeTimelineId = timeline.id
|
||||
|
||||
val timelineRelationship = TimelineRelationship(
|
||||
TimelineRelationshipId(idGenerateService.generateId()),
|
||||
timeline.id,
|
||||
userDetail.actorId,
|
||||
Visible.DIRECT
|
||||
)
|
||||
|
||||
timelineRelationshipRepository.save(timelineRelationship)
|
||||
|
||||
userDetailRepository.save(userDetail)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,12 @@ hideout:
|
|||
|
||||
|
||||
spring:
|
||||
data:
|
||||
mongodb:
|
||||
auto-index-creation: true
|
||||
host: localhost
|
||||
port: 27017
|
||||
database: hideout
|
||||
jmx:
|
||||
enabled: false
|
||||
jackson:
|
||||
|
@ -31,12 +37,6 @@ spring:
|
|||
url: "jdbc:postgresql:hideout"
|
||||
username: "postgres"
|
||||
password: "password"
|
||||
data:
|
||||
mongodb:
|
||||
auto-index-creation: true
|
||||
host: localhost
|
||||
port: 27017
|
||||
database: hideout
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 40MB
|
||||
|
|
|
@ -81,7 +81,7 @@ create table timelines
|
|||
);
|
||||
create table if not exists user_details
|
||||
(
|
||||
id bigserial primary key,
|
||||
id bigint primary key,
|
||||
actor_id bigint not null unique,
|
||||
password varchar(255) not null,
|
||||
auto_accept_followee_follow_request boolean not null,
|
||||
|
@ -286,4 +286,34 @@ create table if not exists actor_instance_relationships
|
|||
PRIMARY KEY (actor_id, instance_id),
|
||||
constraint fk_actor_instance_relationships_actor_id__id foreign key (actor_id) references actors (id) on delete cascade on update cascade,
|
||||
constraint fk_actor_instance_relationships_instance_id__id foreign key (instance_id) references instance (id) on delete cascade on update cascade
|
||||
);
|
||||
);
|
||||
|
||||
create table if not exists timeline_relationships
|
||||
(
|
||||
id bigint primary key,
|
||||
timeline_id bigint not null,
|
||||
actor_id bigint not null,
|
||||
visible varchar(100) not null,
|
||||
constraint fk_timeline_relationships_timeline_id__id foreign key (timeline_id) references timelines (id) on delete cascade on update cascade,
|
||||
constraint fk_timeline_relationships_actor_id__id foreign key (actor_id) references actors (id) on delete cascade on update cascade
|
||||
|
||||
);
|
||||
|
||||
create table if not exists filters
|
||||
(
|
||||
id bigint primary key,
|
||||
user_id bigint not null,
|
||||
name varchar(255) not null,
|
||||
context varchar(500) not null,
|
||||
action varchar(255) not null,
|
||||
constraint fk_filters_user_id__id foreign key (user_id) references user_details (id) on delete cascade on update cascade
|
||||
);
|
||||
|
||||
create table if not exists filter_keywords
|
||||
(
|
||||
id bigint primary key,
|
||||
filter_id bigint not null,
|
||||
keyword varchar(1000) not null,
|
||||
mode varchar(100) not null,
|
||||
constraint fk_filter_keywords_filter_id__id foreign key (filter_id) references filters (id) on delete cascade on update cascade
|
||||
)
|
Loading…
Reference in New Issue