user.ts 2.57 KB
Newer Older
Rosanny Sihombing's avatar
Rosanny Sihombing committed
1
class User {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
2
3
4
5
6
7
8
9
10
  id: number
  email: string
  salutation: string // should be enum
  title: string // should be enum
  firstName: string
  lastName: string
  industry: string
  organisation: string
  speciality: string
Rosanny Sihombing's avatar
Rosanny Sihombing committed
11
  isM4labIdp: number // 1 or 0
Rosanny Sihombing's avatar
Rosanny Sihombing committed
12
13
14
15
  verificationStatus: number // 1 or 0 - // should be boolean
  gitlabUserId?: number

  constructor (id: number, email: string, salutation: string, title: string, firstName: string, lastName: string, industry: string, organisation: string,
Rosanny Sihombing's avatar
Rosanny Sihombing committed
16
    speciality: string, isM4labIdp: number, verificationStatus: number, gitlabUserId?: number) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
17
18
19
20
21
22
23
24
25
    this.id = id
    this.email = email
    this.salutation = salutation
    this.title = title
    this.firstName = firstName
    this.lastName = lastName
    this.industry = industry
    this.organisation = organisation
    this.speciality = speciality
Rosanny Sihombing's avatar
Rosanny Sihombing committed
26
    this.isM4labIdp = isM4labIdp
Rosanny Sihombing's avatar
Rosanny Sihombing committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    this.verificationStatus = verificationStatus
    this.gitlabUserId = gitlabUserId
  }

  // getter
  getId () {
    return this.id
  }

  getEmail () {
    return this.email
  }

  getFullName () {
    return this.firstName + ' ' + this.lastName
  }

  getIdpStatus () {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
45
    return this.isM4labIdp
Rosanny Sihombing's avatar
Rosanny Sihombing committed
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  }

  getVerificationStatus () {
    return this.verificationStatus
  }

  getGitlabUserId () {
    return this.gitlabUserId
  }

  // setter
  setEmail (email: string) {
    this.email = email
  }

  setSalutation (salutation: string) {
    this.salutation = salutation
  }

  setTitle (title: string) {
    this.title = title
  }

  setFirstName (firstName: string) {
    this.firstName = firstName
  }

  setLastName (lastName: string) {
    this.lastName = lastName
  }

  setIndustry (industry: string) {
    this.industry = industry
  }

  setOrganisation (organisation: string) {
    this.organisation = organisation
  }

  setSpeciality (speciality: string) {
    this.speciality = speciality
  }

Rosanny Sihombing's avatar
Rosanny Sihombing committed
89
90
  setM4lab_idp (m4labIdp: number) {
    this.isM4labIdp = m4labIdp
Rosanny Sihombing's avatar
Rosanny Sihombing committed
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  }

  setVerificationStatus (verificationStatus: number) {
    this.verificationStatus = verificationStatus
  }

  setGitlabUserId (newGitlabUserId: number) {
    this.gitlabUserId = newGitlabUserId
  }

  updateProfile (newSalutation: string, newTitle: string, newFirstname: string, newLastname: string, newEmail: string, newOrganisation: string, newIndustry: string, newSpeciality: string) {
    this.salutation = newSalutation
    this.title = newTitle
    this.firstName = newFirstname
    this.lastName = newLastname
    this.email = newEmail
    this.organisation = newOrganisation
    this.industry = newIndustry
    this.speciality = newSpeciality
  }
Rosanny Sihombing's avatar
Rosanny Sihombing committed
111
112
}

Rosanny Sihombing's avatar
Rosanny Sihombing committed
113
export { User }