2021-01-06 13:40:04 +01:00
|
|
|
package com.plannaplan.services;
|
|
|
|
|
2021-01-06 16:50:08 +01:00
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
import com.plannaplan.entities.Assignment;
|
2021-01-06 13:40:04 +01:00
|
|
|
import com.plannaplan.entities.Exchange;
|
2021-01-06 16:50:08 +01:00
|
|
|
import com.plannaplan.entities.Groups;
|
2021-01-06 13:40:04 +01:00
|
|
|
import com.plannaplan.repositories.ExchangeRepository;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
@Service
|
|
|
|
public class ExchangeService {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private ExchangeRepository repo;
|
|
|
|
|
2021-01-06 16:23:18 +01:00
|
|
|
/**
|
|
|
|
* @param exchange Instance to save in database
|
|
|
|
* @return Exchange Instance contains database id
|
|
|
|
*/
|
2021-01-06 13:40:04 +01:00
|
|
|
public Exchange save(Exchange exchange){
|
|
|
|
return this.repo.save(exchange);
|
|
|
|
}
|
2021-01-06 16:50:08 +01:00
|
|
|
|
|
|
|
public Optional<Exchange> checkForExchange(Assignment assignment, Groups group){
|
|
|
|
return this.repo.checkForExchange(assignment, group);
|
|
|
|
}
|
2021-01-06 13:40:04 +01:00
|
|
|
}
|