in space-slack-sync/src/main/kotlin/org/jetbrains/spaceSlackSync/storage/postgres/impl/SpaceAppInstancesStorageImpl.kt [31:44]
override suspend fun getById(clientId: String, slackTeamId: String?): SpaceAppInstance? {
return tx {
if (slackTeamId != null) {
(DB.SpaceAppInstance innerJoin DB.Slack2Space)
.slice(DB.SpaceAppInstance.columns)
.select { (DB.SpaceAppInstance.clientId eq clientId) and (DB.Slack2Space.slackTeamId eq slackTeamId) }
.firstOrNull()?.toSpaceOrg()
} else {
DB.SpaceAppInstance
.select { DB.SpaceAppInstance.clientId eq clientId }
.firstOrNull()?.toSpaceOrg()
}
}
}