package com.realnet.basicp1.Services;
import com.realnet.basicp1.Repository.TestbRepository;
import com.realnet.basicp1.Entity.Testb;
 import java.util.List;
import com.realnet.users.entity1.AppUser;
import com.realnet.users.service1.AppUserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
	import org.springframework.stereotype.Service;

@Service
 public class TestbInsertService1 {
@Autowired
private TestbRepository Repository;
@Autowired
	private AppUserServiceImpl userService; 


public Testb insertaction(Testb testb	) {


	testb.setUpdatedBy(getUser().getUserId());
		testb.setCreatedBy(getUser().getUserId());
		testb.setAccountId(getUser().getAccount().getAccount_id()); 
	testb.setActive("toggle_switch");
testb.setDescription("textarea");
testb.setName("text");
final Testb save = Repository.save(testb);
		return save;
} 
public AppUser getUser() {
		AppUser user = userService.getLoggedInUser();
		return user;

	}}