Skip to content

Commit

Permalink
add-friends-likes 5
Browse files Browse the repository at this point in the history
  • Loading branch information
TriAndres committed May 7, 2024
1 parent 567092a commit f59468a
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import ru.yandex.practicum.filmorate.exCeption.FilmDoesNotExistException;
import ru.yandex.practicum.filmorate.exCeption.UserDoesNotException;
import ru.yandex.practicum.filmorate.exCeption.ValidationException;
import ru.yandex.practicum.filmorate.exseption.FilmDoesNotExistException;
import ru.yandex.practicum.filmorate.exseption.UserDoesNotException;
import ru.yandex.practicum.filmorate.exseption.ValidationException;

@Slf4j
@RestControllerAdvice(basePackages = "ru.yandex.practicum.filmorate")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ru.yandex.practicum.filmorate.exCeption;
package ru.yandex.practicum.filmorate.exseption;

public class FilmDoesNotExistException extends RuntimeException{
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ru.yandex.practicum.filmorate.exCeption;
package ru.yandex.practicum.filmorate.exseption;

public class LikesDoesNotException extends RuntimeException{
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ru.yandex.practicum.filmorate.exCeption;
package ru.yandex.practicum.filmorate.exseption;

public class UserDoesNotException extends RuntimeException{
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ru.yandex.practicum.filmorate.exCeption;
package ru.yandex.practicum.filmorate.exseption;

public class ValidationException extends RuntimeException{
public ValidationException(String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import ru.yandex.practicum.filmorate.exCeption.FilmDoesNotExistException;
import ru.yandex.practicum.filmorate.exseption.FilmDoesNotExistException;
import ru.yandex.practicum.filmorate.model.Film;
import ru.yandex.practicum.filmorate.storege.film.FilmStorage;
import ru.yandex.practicum.filmorate.validation.ValidationFilm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import ru.yandex.practicum.filmorate.exCeption.UserDoesNotException;
import ru.yandex.practicum.filmorate.exseption.UserDoesNotException;
import ru.yandex.practicum.filmorate.model.User;
import ru.yandex.practicum.filmorate.storege.film.FilmStorage;
import ru.yandex.practicum.filmorate.storege.user.UserStorage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package ru.yandex.practicum.filmorate.storege.film;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import ru.yandex.practicum.filmorate.model.Film;
import ru.yandex.practicum.filmorate.storege.user.UserStorage;

import java.util.HashMap;
import java.util.Map;

@Slf4j
@Component("inMemoryFilmStorage")
public class InMemoryFilmStorage implements FilmStorage {
private final UserStorage userStorage;
Expand Down Expand Up @@ -47,6 +48,8 @@ public void addLike(long filmId, long userId) {
Film film = findFilmById(filmId);
if (film != null && userStorage.findUserById(userId) != null) {
findFilmById(filmId).getLikes().add(userId);
} else {
log.info("Пользователь с id {} не поставил фильму с id {} лайк", userId, filmId);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ru.yandex.practicum.filmorate.validation;

import lombok.extern.slf4j.Slf4j;
import ru.yandex.practicum.filmorate.exCeption.ValidationException;
import ru.yandex.practicum.filmorate.exseption.ValidationException;
import ru.yandex.practicum.filmorate.model.Film;

import java.time.LocalDate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ru.yandex.practicum.filmorate.validation;

import lombok.extern.slf4j.Slf4j;
import ru.yandex.practicum.filmorate.exCeption.ValidationException;
import ru.yandex.practicum.filmorate.exseption.ValidationException;
import ru.yandex.practicum.filmorate.model.User;

import java.time.LocalDate;
Expand Down

0 comments on commit f59468a

Please sign in to comment.