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


public Child insertaction(Child child	) {


	child.setUpdatedBy(getUser().getUserId());
		child.setCreatedBy(getUser().getUserId());
		child.setAccountId(getUser().getAccount().getAccount_id()); 
	final Child save = Repository.save(child);
		return save;
} 
public AppUser getUser() {
		AppUser user = userService.getLoggedInUser();
		return user;

	}}