-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/week06 #6
Feat/week06 #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏅 🏅 🏅 Отличная работа! 🏅 🏅 🏅
internal/repositories/chats/api.go
Outdated
problem.ResolvedAtIsNil(), | ||
), | ||
). | ||
Order(chat.ByCreatedAt(sql.OrderDesc())). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, зацепился глаз: мы наоборот решили отсортировать, т.к. посчитали, что лучше первый обратившийся будет светиться первым в списке чатов у менеджера 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
func (r *Repo) GetOpenProblemChatsForManager(ctx context.Context, managerID types.UserID) ([]Chat, error) { | ||
chats, err := r.db.Chat(ctx).Query(). | ||
Where( | ||
chat.HasProblemsWith( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лайк 👍
@@ -53,3 +54,102 @@ func (s *ChatsRepoSuite) Test_CreateIfNotExists() { | |||
s.Equal(chat.ID, chatID) | |||
}) | |||
} | |||
|
|||
func (s *ChatsRepoSuite) Test_GetOpenProblemChatsForManager() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лайк
internal/repositories/chats/repo.go
Outdated
@@ -15,6 +17,18 @@ type Repo struct { | |||
Options | |||
} | |||
|
|||
func (r *Repo) GetClientIDByChatID(ctx context.Context, chatID types.ChatID) (types.UserID, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не туда затесался метод – его бы в api.go + тест
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил.
|
||
var managerID types.UserID | ||
for _, problemID := range problemIDs { | ||
managerID, err = s.mngrPool.Get(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
На всякий напоминаем про кейс с зомби-менеджером 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что за кейс? Менеджер, которому не досталось проблемы?
Добавил несколько тестов, теперь все описанные в задании случаи тестируются.
return fmt.Errorf("get manager from pool: %v", err) | ||
} | ||
|
||
problem, err := s.problemsRepo.AssignManagerToProblem(ctx, managerID, problemID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Академический интерес: а почему назначение проблемы на менеджера тоже не добавили в транзакцию?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил.
message.RequestID, | ||
canManagerTakeProblem, | ||
) | ||
err = j.eventStream.Publish(ctx, pl.ManagerID, newChatEvent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь тоже можно, как и в других джобах, распараллелить отправку
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил.
Manager Events
manager.events.swagger.yml
manager.events.swagger.yml
добавлен в debug servermanager.events.swagger.yml
добавлен в Swagger UINewMessageEvent
: обработана ситуация, когда клиент пишет в чат, но с другой стороны ещё нет менеджераNewChatEvent.CanTakeMoreProblems
выставляется с помощьюservices/manager-load
NewChatEvent.RequestID
равенinitial_request_id
первого видимого менеджеру сообщения в чатеmanagerevents.Adapter
покрыт юнит-тестамиManager Scheduling
services/manager-scheduler
Manager API
problems
добавлен индексValidation
required
Testing
"Manager Scheduling Smoke"
расширен двумя новыми шагами"Error Responses"
расширен новым шагомtask tests
)task tests:integration
)task tests:e2e
)