mirror of https://github.com/usbharu/Hideout.git
refactor: 不要になった関数を削除
This commit is contained in:
parent
f616f72415
commit
0a19ef572c
|
@ -36,16 +36,6 @@ interface RelationshipRepository {
|
|||
|
||||
suspend fun findByTargetIdAndFollowing(targetId: Long, following: Boolean): List<Relationship>
|
||||
|
||||
@Suppress("LongParameterList", "FunctionMaxLength")
|
||||
suspend fun findByTargetIdAndFollowRequestAndIgnoreFollowRequest(
|
||||
maxId: Long?,
|
||||
sinceId: Long?,
|
||||
limit: Int,
|
||||
targetId: Long,
|
||||
followRequest: Boolean,
|
||||
ignoreFollowRequest: Boolean
|
||||
): List<Relationship>
|
||||
|
||||
suspend fun findByTargetIdAndFollowRequestAndIgnoreFollowRequest(
|
||||
targetIdLong: Long,
|
||||
followRequest: Boolean,
|
||||
|
@ -53,15 +43,6 @@ interface RelationshipRepository {
|
|||
page: Page.PageByMaxId
|
||||
): PaginationList<Relationship, Long>
|
||||
|
||||
@Suppress("FunctionMaxLength")
|
||||
suspend fun findByActorIdAntMutingAndMaxIdAndSinceId(
|
||||
actorId: Long,
|
||||
muting: Boolean,
|
||||
maxId: Long?,
|
||||
sinceId: Long?,
|
||||
limit: Int
|
||||
): List<Relationship>
|
||||
|
||||
suspend fun findByActorIdAndMuting(
|
||||
actorId: Long,
|
||||
muting: Boolean,
|
||||
|
|
|
@ -76,30 +76,6 @@ class RelationshipRepositoryImpl : RelationshipRepository, AbstractRepository()
|
|||
.map { it.toRelationships() }
|
||||
}
|
||||
|
||||
override suspend fun findByTargetIdAndFollowRequestAndIgnoreFollowRequest(
|
||||
maxId: Long?,
|
||||
sinceId: Long?,
|
||||
limit: Int,
|
||||
targetId: Long,
|
||||
followRequest: Boolean,
|
||||
ignoreFollowRequest: Boolean
|
||||
): List<Relationship> = query {
|
||||
val query = Relationships.select {
|
||||
Relationships.targetActorId.eq(targetId).and(Relationships.followRequest.eq(followRequest))
|
||||
.and(Relationships.ignoreFollowRequestFromTarget.eq(ignoreFollowRequest))
|
||||
}.limit(limit)
|
||||
|
||||
if (maxId != null) {
|
||||
query.andWhere { Relationships.id lessEq maxId }
|
||||
}
|
||||
|
||||
if (sinceId != null) {
|
||||
query.andWhere { Relationships.id greaterEq sinceId }
|
||||
}
|
||||
|
||||
return@query query.map { it.toRelationships() }
|
||||
}
|
||||
|
||||
override suspend fun findByTargetIdAndFollowRequestAndIgnoreFollowRequest(
|
||||
targetId: Long,
|
||||
followRequest: Boolean,
|
||||
|
@ -120,28 +96,6 @@ class RelationshipRepositoryImpl : RelationshipRepository, AbstractRepository()
|
|||
)
|
||||
}
|
||||
|
||||
override suspend fun findByActorIdAntMutingAndMaxIdAndSinceId(
|
||||
actorId: Long,
|
||||
muting: Boolean,
|
||||
maxId: Long?,
|
||||
sinceId: Long?,
|
||||
limit: Int
|
||||
): List<Relationship> = query {
|
||||
val query = Relationships.select {
|
||||
Relationships.actorId.eq(actorId).and(Relationships.muting.eq(muting))
|
||||
}.limit(limit)
|
||||
|
||||
if (maxId != null) {
|
||||
query.andWhere { Relationships.id lessEq maxId }
|
||||
}
|
||||
|
||||
if (sinceId != null) {
|
||||
query.andWhere { Relationships.id greaterEq sinceId }
|
||||
}
|
||||
|
||||
return@query query.map { it.toRelationships() }
|
||||
}
|
||||
|
||||
override suspend fun findByActorIdAndMuting(
|
||||
actorId: Long,
|
||||
muting: Boolean,
|
||||
|
|
|
@ -52,13 +52,6 @@ interface AccountApiService {
|
|||
suspend fun unfollow(userid: Long, target: Long): Relationship
|
||||
suspend fun removeFromFollowers(userid: Long, target: Long): Relationship
|
||||
suspend fun updateProfile(userid: Long, updateCredentials: UpdateCredentials?): Account
|
||||
suspend fun followRequests(
|
||||
loginUser: Long,
|
||||
maxId: Long?,
|
||||
sinceId: Long?,
|
||||
limit: Int = 20,
|
||||
withIgnore: Boolean
|
||||
): List<Account>
|
||||
|
||||
suspend fun followRequests(
|
||||
loginUser: Long,
|
||||
|
@ -70,7 +63,6 @@ interface AccountApiService {
|
|||
suspend fun rejectFollowRequest(loginUser: Long, target: Long): Relationship
|
||||
suspend fun mute(userid: Long, target: Long): Relationship
|
||||
suspend fun unmute(userid: Long, target: Long): Relationship
|
||||
suspend fun mutesAccount(userid: Long, maxId: Long?, sinceId: Long?, limit: Int): List<Account>
|
||||
suspend fun mutesAccount(userid: Long, pageByMaxId: Page.PageByMaxId): PaginationList<Account, Long>
|
||||
}
|
||||
|
||||
|
@ -224,27 +216,6 @@ class AccountApiServiceImpl(
|
|||
accountService.findById(userid)
|
||||
}
|
||||
|
||||
override suspend fun followRequests(
|
||||
loginUser: Long,
|
||||
maxId: Long?,
|
||||
sinceId: Long?,
|
||||
limit: Int,
|
||||
withIgnore: Boolean
|
||||
): List<Account> = transaction.transaction {
|
||||
val actorIdList = relationshipRepository
|
||||
.findByTargetIdAndFollowRequestAndIgnoreFollowRequest(
|
||||
maxId = maxId,
|
||||
sinceId = sinceId,
|
||||
limit = limit,
|
||||
targetId = loginUser,
|
||||
followRequest = true,
|
||||
ignoreFollowRequest = withIgnore
|
||||
)
|
||||
.map { it.actorId }
|
||||
|
||||
return@transaction accountService.findByIds(actorIdList)
|
||||
}
|
||||
|
||||
override suspend fun followRequests(
|
||||
loginUser: Long,
|
||||
withIgnore: Boolean,
|
||||
|
@ -286,13 +257,6 @@ class AccountApiServiceImpl(
|
|||
return@transaction fetchRelationship(userid, target)
|
||||
}
|
||||
|
||||
override suspend fun mutesAccount(userid: Long, maxId: Long?, sinceId: Long?, limit: Int): List<Account> {
|
||||
val mutedAccounts =
|
||||
relationshipRepository.findByActorIdAntMutingAndMaxIdAndSinceId(userid, true, maxId, sinceId, limit)
|
||||
|
||||
return accountService.findByIds(mutedAccounts.map { it.targetActorId })
|
||||
}
|
||||
|
||||
override suspend fun mutesAccount(userid: Long, pageByMaxId: Page.PageByMaxId): PaginationList<Account, Long> {
|
||||
val mutedAccounts = relationshipRepository.findByActorIdAndMuting(userid, true, pageByMaxId)
|
||||
|
||||
|
|
Loading…
Reference in New Issue