• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DaniSomoza / galactic-commander / 7141953215

08 Dec 2023 01:28PM UTC coverage: 91.579%. First build
7141953215

push

github

web-flow
Add Auth microservice (#1)

* Add activationCode and sendEmail

* Added prettier and linter

* added tests

* add test action

1 of 2 branches covered (0.0%)

Branch coverage included in aggregate %.

85 of 92 new or added lines in 14 files covered. (92.39%)

86 of 93 relevant lines covered (92.47%)

1.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.56
/packages/auth-microservice/src/repositories/userRepository.ts
1
import UserModel, { IUser } from '../models/UserModel'
1✔
2

3
// TODO: Add JSdoc for each function
4

5
async function findUserByUsername(username: string): Promise<IUser | null> {
NEW
6
  return UserModel.findOne({ username }).lean().exec()
×
7
}
8

9
async function findUserByEmail(email: string): Promise<IUser | null> {
NEW
10
  return UserModel.findOne({ email }).lean().exec()
×
11
}
12

13
async function createUser(userData: IUser): Promise<IUser> {
14
  const newUser = new UserModel(userData)
3✔
15
  return newUser.save()
3✔
16
}
17

18
async function findUserByActivationCode(activationCode: string): Promise<IUser | null> {
NEW
19
  return UserModel.findOne({ activationCode }).lean().exec()
×
20
}
21

22
async function updateUser(userId: string, updateData: Partial<IUser>): Promise<IUser | null> {
NEW
23
  return UserModel.findByIdAndUpdate(userId, updateData, { new: true }).lean().exec()
×
24
}
25

26
const userRepository = {
1✔
27
  findUserByUsername,
28
  findUserByEmail,
29
  createUser,
30
  findUserByActivationCode,
31
  updateUser
32
}
33

34
export default userRepository
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc