feat(ECR-011): 昵称、首页贴士与档案 Self 唯一/合盘交叉校验
ci / h5 (push) Canceled after 0s
ci / api (push) Canceled after 0s
ci / ess-docs (push) Canceled after 0s

每账号仅一条 self(migration 40902);合盘只选 TA;账号昵称可改;首页穿衣/颜色/养生贴士。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-12 22:05:00 +08:00
co-authored by Cursor
parent 5ceb3ce749
commit 13860bf1ef
67 changed files with 1936 additions and 275 deletions
@@ -30,6 +30,9 @@ type CreateInput struct {
BirthPlace *string
}
// ErrSelfExists is returned when creating a second self profile.
var ErrSelfExists = errors.New("self profile already exists")
// Create stores a profile for the user.
func (s *Service) Create(ctx context.Context, userID uuid.UUID, in CreateInput) (*model.Profile, error) {
if in.Relation != "self" && in.Relation != "other" {
@@ -38,6 +41,15 @@ func (s *Service) Create(ctx context.Context, userID uuid.UUID, in CreateInput)
if in.BirthDate.IsZero() {
return nil, errors.New("birth_date required")
}
if in.Relation == "self" {
n, err := s.Repo.CountActiveSelf(ctx, userID)
if err != nil {
return nil, err
}
if n > 0 {
return nil, ErrSelfExists
}
}
name := in.DisplayName
if name == "" {
if in.Relation == "self" {