package com.realnet.basicp1.Services;
import com.realnet.basicp1.Repository.FormaRepository;
import com.realnet.basicp1.Entity.Forma;
 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 FormaInsertService1 {
@Autowired
private FormaRepository Repository;
@Autowired
	private AppUserServiceImpl userService; 


public Forma insertaction(Forma forma	) {


	forma.setUpdatedBy(getUser().getUserId());
		forma.setCreatedBy(getUser().getUserId());
		forma.setAccountId(getUser().getAccount().getAccount_id()); 
	forma.setCalculated_field("calculated_field");
forma.setNumber2("number");
forma.setNumber1("number");
forma.setName("text");
final Forma save = Repository.save(forma);
		return save;
} 
public AppUser getUser() {
		AppUser user = userService.getLoggedInUser();
		return user;

	}}