Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Матвеева Виктория: HW with DataBase #152

Open
wants to merge 1 commit into
base: lecture07
Choose a base branch
from

Conversation

santamoniya
Copy link

No description provided.

Copy link
Owner

@rybalkinsd rybalkinsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Две транзакции (см комментарии)
  2. Мало тестов
  3. Остальное хорошо
  4. Всегда думай как можно написать меньше кода не теряя читабельность

}

override fun findById(id: Int): Message? {
val resultRow = transaction { Messages.select { Messages.id eq id }.firstOrNull() }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val resultRow = transaction { Messages.select { Messages.id eq id }.firstOrNull() }
val resultRow = transaction { Messages.select { Messages.id eq id }.firstOrNull() } ?: return

и дальше с nn работаешь

val resultRow = transaction { Messages.select { Messages.id eq id }.firstOrNull() }
return resultRow?.let { Message(
resultRow[Messages.id],
UserDao().findById(resultRow[Messages.user])!!,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

этот вызов будет в другой транзакции - что делать?

class MessageDaoTest {

@Test
fun `add massage`() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а можешь этот typo fix отдельным PR добавить? )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants