package com.nisum.mytime.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.RoleInfo;
import com.nisum.mytime.repository.RoleInfoRepo;

@Service
public class RoleInfoServiceImpl implements RoleInfoService {

	@Autowired
	RoleInfoRepo roleInfoRepo;

	@Override
	public RoleInfo addRole(RoleInfo roleInfo) throws MyTimeException {

		return roleInfoRepo.save(roleInfo);
	}

	@Override
	public String getRole(String roleName) throws MyTimeException {

		return roleInfoRepo.findByRoleName(roleName).getRoleId();
	}

}
