Git Product home page Git Product logo

micromango's People

Contributors

cl1ckname avatar

Stargazers

 avatar

Watchers

 avatar

micromango's Issues

2PC or Saga for registration route

There is a danger moment about user registration

func (s *service) Register(ctx context.Context, req *pb.RegisterRequest) (*pb.UserResponse, error) {
	u, err := findByEmail(s.db, req.Email)
	if err != nil {
		if !errors.Is(err, gorm.ErrRecordNotFound) {
			return nil, err
		}
	}
	u.Email = req.Email
	u.PasswordHash = hashString(req.Password, s.salt)
	savedU, err := saveUser(s.db, u)
	if err != nil {
		return nil, err
	}
	if _, err := s.profile.Create(ctx, &profile.CreateRequest{
		UserId:   savedU.UserId.String(),
		Username: req.Username,
	}); err != nil {
		return nil, err
	}
	return &pb.UserResponse{
		UserId:   savedU.UserId.String(),
		Username: req.Username,
	}, nil
}

If registered successes but profile creating failed user won't be able to register again and also won't be able to visit his profile. I suppose there should be an algorithm for distributed transactions (actually idk). Advice me smthng?

Документация по развертыванию

Привет ~ヾ(・ω・)

У проекта совсем нет инструкций и руководств по развертыванию хотя бы dev-окружения, что усложняет возможно как-то пощупать исходный код без сильного погружения в него. Было бы замечательно добавить хотя бы отдельную WIP ветку с таким руководством. Добавить .env.example с набором переменных и значений для простого тестирования, рекомендации по миграциям и т.п.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.