добавлены: класс исключения, сущность фильма, репозиторий и сервис

This commit is contained in:
ekallin 2024-03-17 01:27:26 +04:00
parent 6e33c25912
commit ef0baec61b
4 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,7 @@
package com.example.backend.core.errors;
public class NotFoundException extends RuntimeException {
public NotFoundException(Integer id) {
super(String.format("Сущность с айдишником <[%s]> не найден, либо его не существует", id));
}
}

View File

@ -0,0 +1,89 @@
package com.example.backend.movies.model;
import java.util.Objects;
import com.example.backend.categories.model.CategorieEntity;
import com.example.backend.core.model.BaseEntity;
public class MovieEntity extends BaseEntity {
private CategorieEntity Categorie;
private String Name;
private String Description;
private String Duration;
private String Image;
public MovieEntity() {
super();
}
public MovieEntity(Integer id, String name, String description, String duration, String image) {
super(id);
Name = name;
Description = description;
Duration = duration;
Image = image;
}
public CategorieEntity getCategorie() {
return Categorie;
}
public void setCategorie(CategorieEntity categorie) {
Categorie = categorie;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
public String getDuration() {
return Duration;
}
public void setDuration(String duration) {
Duration = duration;
}
public String getImage() {
return Image;
}
public void setImage(String image) {
Image = image;
}
@Override
public int hashCode() {
return Objects.hash(Id, Categorie, Name, Description, Duration, Image);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
final MovieEntity other = (MovieEntity) obj;
return Objects.equals(other.getId(), Id)
&& Objects.equals(other.getCategorie(), Categorie)
&& Objects.equals(other.getName(), Name)
&& Objects.equals(other.getDescription(), Description)
&& Objects.equals(other.getDuration(), Duration)
&& Objects.equals(other.getImage(), Image);
}
}

View File

@ -0,0 +1,8 @@
package com.example.backend.movies.repository;
import com.example.backend.core.repository.MapRepository;
import com.example.backend.movies.model.MovieEntity;
public class MovieRepository extends MapRepository<MovieEntity> {
}

View File

@ -0,0 +1,8 @@
package com.example.backend.movies.service;
import org.springframework.stereotype.Service;
@Service
public class MovieService {
}