mirror of https://github.com/usbharu/Hideout.git
fix: フォロワー一覧取得のSQL修正
This commit is contained in:
parent
b470b4f5d5
commit
f0eef274fc
|
@ -80,15 +80,18 @@ class UserRepository(private val database: Database) : IUserRepository {
|
||||||
|
|
||||||
override suspend fun findFollowersById(id: Long): List<UserEntity> {
|
override suspend fun findFollowersById(id: Long): List<UserEntity> {
|
||||||
return query {
|
return query {
|
||||||
val followers = Users.alias("followers")
|
val followers = Users.alias("FOLLOWERS")
|
||||||
Users.leftJoin(
|
Users.innerJoin(
|
||||||
otherTable = UsersFollowers,
|
otherTable = UsersFollowers,
|
||||||
onColumn = { Users.id },
|
onColumn = { Users.id },
|
||||||
otherColumn = { UsersFollowers.userId })
|
otherColumn = { UsersFollowers.userId })
|
||||||
.leftJoin(
|
|
||||||
|
.innerJoin(
|
||||||
otherTable = followers,
|
otherTable = followers,
|
||||||
onColumn = { UsersFollowers.followerId },
|
onColumn = { UsersFollowers.followerId },
|
||||||
otherColumn = { followers[Users.id] })
|
otherColumn = { followers[Users.id] })
|
||||||
|
|
||||||
|
.slice(followers.get(Users.id), followers.get(Users.name), followers.get(Users.domain), followers.get(Users.screenName), followers.get(Users.description))
|
||||||
.select { Users.id eq id }
|
.select { Users.id eq id }
|
||||||
.map {
|
.map {
|
||||||
UserEntity(
|
UserEntity(
|
||||||
|
|
Loading…
Reference in New Issue