Passed
Pull Request — development (#102)
by Karl
12:26
created

backend/src/database/seeds/user-data.seed.ts   A

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 82
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 69
dl 0
loc 82
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2
mnd 1
bc 1
fnc 1
bpm 1
cpm 2
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
B UserDataSeeder.run 0 72 2
1
import { DataSource } from 'typeorm';
2 7
import { User } from '../../users/entities/user.entity';
3
4 7
export default class UserDataSeeder {
5
  async run(connection: DataSource): Promise<void> {
6 9
    if (true) {//process.env.NODE_ENV !== 'production') {
0 ignored issues
show
introduced by
Insert ⏎······
Loading history...
7 9
      const userRepo = connection.getRepository(User);
8
9
      // Add example admin and test users
10 9
      await userRepo.save([
11
        {
12
          githubId: '149484382',
13
          username: 'Pbris',
14
          email: '[email protected]',
15
          roles: ['admin'],
16
          hasAcceptedTerms: true,
17
          isMonthlyPayment: false,
18
          accumulatedCost: 0,
19
          balance: 100,
20
        },
21
        {
22
          githubId: '149296874',
23
          username: 'airhelios',
24
          email: '[email protected]',
25
          roles: ['admin'],
26
          hasAcceptedTerms: true,
27
          isMonthlyPayment: true,
28
          accumulatedCost: 0,
29
        },
30
        {
31
          githubId: '13668660',
32
          username: 'KarlComSe',
33
          email: '[email protected]',
34
          roles: ['admin'],
35
          hasAcceptedTerms: true,
36
          isMonthlyPayment: true,
37
          accumulatedCost: 0,
38
        },
39
        {
40
          githubId: '149683406',
41
          username: 'gumme1',
42
          email: '[email protected]',
43
          roles: ['admin'],
44
          hasAcceptedTerms: true,
45
          isMonthlyPayment: true,
46
          accumulatedCost: 0,
47
        },
48
        {
49
          githubId: '123456789',
50
          username: 'johndoe',
51
          email: '[email protected]',
52
          roles: ['user'],
53
          hasAcceptedTerms: true,
54
          avatarUrl: 'https://example.com/john.jpg',
55
          isMonthlyPayment: true,
56
          accumulatedCost: 0,
57
        },
58
        {
59
          githubId: '234567890',
60
          username: 'janedoe',
61
          email: '[email protected]',
62
          roles: ['user', 'admin'],
63
          hasAcceptedTerms: true,
64
          avatarUrl: 'https://example.com/jane.jpg',
65
          isMonthlyPayment: true,
66
          accumulatedCost: 0,
67
        },
68
        {
69
          githubId: '345678901',
70
          username: 'bobsmith',
71
          email: '[email protected]',
72
          roles: ['user'],
73
          hasAcceptedTerms: false,
74
          avatarUrl: 'https://example.com/bob.jpg',
75
          isMonthlyPayment: true,
76
          accumulatedCost: 0,
77
        },
78
      ]);
79
    }
80
  }
81
}
82