package com.nisum.mytime.service.impl;

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

import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Role;
import com.nisum.mytime.repository.RoleInfoRepo;
import com.nisum.mytime.service.IRoleInfoService;

@Service
public class RoleInfoService implements IRoleInfoService {

	@Autowired
	RoleInfoRepo roleInfoRepo;

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

		return roleInfoRepo.save(roleInfo);
	}

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

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

}
