1
|
package cz.zcu.kiv.backendapi.type;
|
2
|
|
3
|
import lombok.RequiredArgsConstructor;
|
4
|
import org.springframework.stereotype.Service;
|
5
|
import org.springframework.transaction.annotation.Transactional;
|
6
|
|
7
|
import java.util.Optional;
|
8
|
|
9
|
/**
|
10
|
* Type service implementation
|
11
|
*/
|
12
|
@Service
|
13
|
@Transactional
|
14
|
@RequiredArgsConstructor
|
15
|
public class TypeServiceImpl implements ITypeService {
|
16
|
/**
|
17
|
* Type repository
|
18
|
*/
|
19
|
private final TypeRepository typeRepository;
|
20
|
|
21
|
@Override
|
22
|
public void saveType(Type type) {
|
23
|
typeRepository.save(type);
|
24
|
}
|
25
|
|
26
|
@Override
|
27
|
public Optional<Type> getTypeByName(String type) {
|
28
|
return typeRepository.findById(type);
|
29
|
}
|
30
|
|
31
|
|
32
|
}
|