Skip to content
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

use dependency injection User/LastActivity #90

Merged
merged 32 commits into from
Feb 19, 2024
Merged

Conversation

banshiAnton
Copy link
Collaborator

@banshiAnton banshiAnton commented Jan 19, 2024

SK-80
SK-83

@banshiAnton banshiAnton changed the title WIP: try use ServiceLocatorContainertry use ServiceLocatorContainer WIP: try use dependency injection Feb 2, 2024
const u = await User.findOne({ _id: id })
!!u && recipients.push(id)
for (const userId of recipients_ids) {
const user = await userService.userRepo.findById(userId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use findByIds and do it in a single request?

return user
}

async findExisted(login, email, phone) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rename to findWhere

and use it like this:


findWhere({$or: [{login}]})

findWhere({$or: [{login}, {email}]})

findWhere({$or: [{login}, {email}, {phone}]})


import { ERROR_STATUES } from '../../../../constants/errors.js'

class UserAuthOperation {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be UserAuthService ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or even this can be a part of UserService

@banshiAnton banshiAnton changed the title WIP: try use dependency injection use dependency injection User/LastActivity Feb 14, 2024
@artem-yatchenko artem-yatchenko merged commit c69e034 into main Feb 19, 2024
@Oleksandr1414 Oleksandr1414 deleted the dep-injection branch October 24, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants