Skip to content

Спринт 12 - Промежуточное задание. Схема БД - #3

Merged
milayadasha merged 2 commits into
mainfrom
add-database
Feb 16, 2026
Merged

milayadasha merged 2 commits into
mainfrom
add-database

Conversation

@milayadasha

@milayadasha milayadasha commented Jan 14, 2026 •

Copy link
Copy Markdown
Owner

В схеме БД важные моменты:

  1. На семинаре сказано, что не надо добавлять статус для дружбы. Просто должна быть таблица для пар пользователей
  2. Составные ключи решила не делать. Мне удобнее автоинкрементирующиеся id
  3. На схеме опечаталась в названиях (в единственном числе сущности). При реализации сделала во множественном

По заданию 12 спринта:

  1. Добавлен dao слой с хранилищами
  2. Добавлены новые сущности - Жанр и Рейтинг МПА
  3. Добавлены контроллеры и сервисы для новых сущностей
  4. Добавлены соответствующие тесты

@maks-avilow maks-avilow left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

добрый день Дарья! все основные пункты, которые требует от нас тз имеются. работа принята

Comment thread database_scheme.png

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

наличие картинки соответствует тз

@Primary
@Repository("userDbStorage")
public class UserDbStorage extends BaseStorage<User> implements UserStorage {
private static final Logger log = LoggerFactory.getLogger(UserDbStorage.class);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

лучше использовать sl4fj

private static final String ADD_USER_FRIEND = "INSERT INTO users_friendship (user_id, friend_id) VALUES (?, ?);";
private static final String DELETE_USER_FRIEND = "DELETE FROM users_friendship WHERE user_id = ? " +
"AND friend_id = ?;";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

наличие репозиторных слоев с указанными методами - соответствует тз

public User getUserById(int id) {
User user = findOne(GET_USER_BY_ID_QUERY, id).orElseThrow(() -> {
String userNotFound = "Пользователь с id = " + id + " не найден";
log.error(userNotFound);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

обычно логи пишутся более подробно

DELETE FROM genres;
DELETE FROM mpa_ratings;

ALTER TABLE mpa_ratings ALTER COLUMN id RESTART WITH 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

наличие скрипта как требует того тз плюс

@milayadasha
milayadasha merged commit 8d4c779 into main Feb 16, 2026
2 checks passed
@milayadasha
milayadasha deleted the add-database branch February 16, 2026 11:35
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