注册时不要求填写性别与头像。

This commit is contained in:
zhouxy108 2022-12-30 17:51:25 +08:00
parent 90da53bf2b
commit 2c967a4c0d
2 changed files with 4 additions and 12 deletions

View File

@ -16,6 +16,7 @@ import xyz.zhouxy.plusone.system.domain.model.account.AccountStatus;
import xyz.zhouxy.plusone.system.domain.model.account.Email; import xyz.zhouxy.plusone.system.domain.model.account.Email;
import xyz.zhouxy.plusone.system.domain.model.account.MobilePhone; import xyz.zhouxy.plusone.system.domain.model.account.MobilePhone;
import xyz.zhouxy.plusone.system.domain.model.account.Password; import xyz.zhouxy.plusone.system.domain.model.account.Password;
import xyz.zhouxy.plusone.system.domain.model.account.Sex;
import xyz.zhouxy.plusone.system.domain.model.account.Username; import xyz.zhouxy.plusone.system.domain.model.account.Username;
import xyz.zhouxy.plusone.validator.InvalidInputException; import xyz.zhouxy.plusone.validator.InvalidInputException;
@ -78,10 +79,10 @@ public class RegisterAccountService {
Username.of(username), Username.of(username),
email, email,
mobilePhone, mobilePhone,
Password.newPassword(command.getPassword(), command.getPasswordConfirmation()), Password.newPassword(command.getPassword(), command.getReenteredPassword()),
AccountStatus.AVAILABLE, AccountStatus.AVAILABLE,
Set.of(DEFAULT_ROLE_ID), Set.of(DEFAULT_ROLE_ID),
AccountInfo.of(command.getNickname(), command.getAvatar(), command.getSex())); AccountInfo.of(command.getNickname(), null, Sex.UNSET));
accountRepository.save(accountToSave); accountRepository.save(accountToSave);
} }

View File

@ -3,12 +3,9 @@ package xyz.zhouxy.plusone.system.application.service.command;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import org.hibernate.validator.constraints.URL;
import lombok.Data; import lombok.Data;
import xyz.zhouxy.plusone.constant.RegexConsts; import xyz.zhouxy.plusone.constant.RegexConsts;
import xyz.zhouxy.plusone.domain.ICommand; import xyz.zhouxy.plusone.domain.ICommand;
import xyz.zhouxy.plusone.system.domain.model.account.Sex;
/** /**
* 注册账号命令 * 注册账号命令
@ -32,14 +29,8 @@ public class RegisterAccountCommand implements ICommand {
@NotBlank @NotBlank
@Pattern(regexp = RegexConsts.PASSWORD) @Pattern(regexp = RegexConsts.PASSWORD)
String password; String password;
String passwordConfirmation; String reenteredPassword;
@Pattern(regexp = RegexConsts.NICKNAME) @Pattern(regexp = RegexConsts.NICKNAME)
String nickname; String nickname;
@NotBlank
@URL
String avatar;
Sex sex;
} }