class GroupMemberController {

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ServiceResult<String> add(@Validated(AddMember.class) @RequestBody UserGroup userGroup, @CurrentUser LoginUser user, Errors errors) throws Exception {
        userGroup.setUpdate_user_no(user.getUserNo());
        ValidateResult validateRes = groupMemberService.validatePermisionAdd(user, userGroup, errors)
                .addAssert(() -> !groupMemberService.isUserInGroup(userGroup.getUser_id(), userGroup.getGroup_id()), message.group_message_user_ingroup)
                .addAssert(() -> userGroupDao.insertUserGroup(userGroup) > 0, message.db_message_add_operation_failed).validate();
        if (!validateRes.isValid()) {
            return ServiceResult.fail(validateRes.getSummarize());
        }
        return ServiceResult.success();
    }

}