This commit is contained in:
2026-03-02 01:52:10 +07:00
parent 4280d5376a
commit a044093747
4 changed files with 29 additions and 11 deletions
+12 -9
View File
@@ -19,23 +19,26 @@ import (
)
type Services struct {
repository *Repository
storyService *story_service.StoryService
linkService link.ILinkService
clientHost string
repository *Repository
storyService *story_service.StoryService
linkService link.ILinkService
passwordGenerator password.IPasswordGenerator
clientHost string
}
func NewServices(
repository *Repository,
storyService *story_service.StoryService,
linkService link.ILinkService,
passwordGenerator password.IPasswordGenerator,
clientHost string,
) *Services {
return &Services{
repository: repository,
storyService: storyService,
linkService: linkService,
clientHost: clientHost,
repository: repository,
storyService: storyService,
linkService: linkService,
passwordGenerator: passwordGenerator,
clientHost: clientHost,
}
}
@@ -176,7 +179,7 @@ func (s *Services) AddTeams(ctx context.Context, req *proto.AddTeamsReq) (*proto
inTeams := make([]*models.Team, 0, len(req.Teams))
for _, team := range req.Teams {
t := mapProtoTeamsToTeam(team)
t.Password = password.GenPass(8)
t.Password = s.passwordGenerator.GeneratePassword(8)
inTeams = append(inTeams, t)
}
teams, err := s.repository.AddTeams(ctx, inTeams)