{ "version": 3, "sources": ["src/app/providers/user-service/user.service.ts"], "sourcesContent": ["import { inject, Injectable } from \"@angular/core\";\nimport { HttpClient, HttpHeaders } from \"@angular/common/http\";\nimport { Observable } from \"rxjs\";\nimport { ConstantsService } from \"../constants-service/constants.service\";\nimport { AuthenticationService } from \"../authentication-service/authentication.service\";\nimport { StressLevel } from \"../../models/stress-level.model\";\n\n@Injectable()\nexport class UserService {\n http = inject(HttpClient);\n constantsService = inject(ConstantsService);\n authenticationService = inject(AuthenticationService);\n\n public changePassword(oldPassword: string, newPassword: string): Observable {\n const url = this.constantsService.getServerUrl() + \"user/change\";\n const body = JSON.stringify({ oldPassword, newPassword });\n return this.http.put(url, body);\n }\n\n public resetPassword(userId: string, newPassword: string): Observable {\n const url = this.constantsService.getServerUrl() + \"user/\" + userId + \"/reset\";\n const body = JSON.stringify({ newPassword });\n return this.http.put(url, body);\n }\n\n public checkPassword(password: string): Observable {\n const url = this.constantsService.getServerUrl() + \"user/check\";\n const body = JSON.stringify({ password });\n return this.http.put(url, body);\n }\n\n public createUser(user): Observable {\n const url = this.constantsService.getServerUrl() + \"user/create\";\n const body = JSON.stringify(user.toJson());\n return this.http.post(url, body);\n }\n\n public updateUser(user): Observable {\n const url = this.constantsService.getServerUrl() + \"user/\" + user.email;\n const body = JSON.stringify(user.toJson());\n return this.http.put(url, body);\n }\n\n public updateOwnUser(user): Observable {\n const url = this.constantsService.getServerUrl() + \"user\";\n const body = JSON.stringify(user.toJson());\n return this.http.put(url, body);\n }\n\n public getUsers(): Observable {\n const url = this.constantsService.getServerUrl() + \"user\";\n return this.http.get(url);\n }\n\n public getRoles(): Observable {\n const url = this.constantsService.getServerUrl() + \"user/roles\";\n return this.http.get(url);\n }\n\n public getRegions(): Observable {\n const url = this.constantsService.getServerUrl() + \"user/regions\";\n return this.http.get(url);\n }\n\n public deleteUser(userId): Observable {\n const url = this.constantsService.getServerUrl() + \"user/\" + userId;\n return this.http.delete(url);\n }\n\n public postStressLevel(stressLevel: StressLevel): Observable {\n const url = this.constantsService.getServerUrl() + \"user/stress-level\";\n return this.http.post(url, stressLevel);\n }\n\n public getStressLevels(date: [Date, Date]): Observable {\n const url = this.constantsService.getServerUrl() + \"user/stress-level\";\n const params = {\n startDate: date[0].toISOString(),\n endDate: date[1].toISOString(),\n };\n return this.http.get(url, { params });\n }\n\n public getTeamStressLevels(date: [Date, Date]): Observable> {\n const url = this.constantsService.getServerUrl() + \"user/stress-level/team\";\n const params = {\n region: this.authenticationService.getActiveRegionId(),\n startDate: date[0].toISOString(),\n endDate: date[1].toISOString(),\n };\n return this.http.get>(url, { params });\n }\n}\n"], "mappings": "uEAQA,IAAaA,GAAW,IAAA,CAAlB,MAAOA,CAAW,CADxBC,aAAA,CAEE,KAAAC,KAAOC,EAAOC,CAAU,EACxB,KAAAC,iBAAmBF,EAAOG,CAAgB,EAC1C,KAAAC,sBAAwBJ,EAAOK,CAAqB,EAE7CC,eAAeC,EAAqBC,EAAmB,CAC5D,IAAMC,EAAM,KAAKP,iBAAiBQ,aAAY,EAAK,cAC7CC,EAAOC,KAAKC,UAAU,CAAEN,YAAAA,EAAaC,YAAAA,CAAW,CAAE,EACxD,OAAO,KAAKT,KAAKe,IAAcL,EAAKE,CAAI,CAC1C,CAEOI,cAAcC,EAAgBR,EAAmB,CACtD,IAAMC,EAAM,KAAKP,iBAAiBQ,aAAY,EAAK,QAAUM,EAAS,SAChEL,EAAOC,KAAKC,UAAU,CAAEL,YAAAA,CAAW,CAAE,EAC3C,OAAO,KAAKT,KAAKe,IAAcL,EAAKE,CAAI,CAC1C,CAEOM,cAAcC,EAAgB,CACnC,IAAMT,EAAM,KAAKP,iBAAiBQ,aAAY,EAAK,aAC7CC,EAAOC,KAAKC,UAAU,CAAEK,SAAAA,CAAQ,CAAE,EACxC,OAAO,KAAKnB,KAAKe,IAAcL,EAAKE,CAAI,CAC1C,CAEOQ,WAAWC,EAAI,CACpB,IAAMX,EAAM,KAAKP,iBAAiBQ,aAAY,EAAK,cA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AW,GAE9B,OAAO,KAAKvC,KAAK4B,IAAmBlB,EAAK,CAAE2B,OAAAA,CAAM,CAAE,CACrD,CAEOI,oBAAoBL,EAAkB,CAC3C,IAAM1B,EAAM,KAAKP,iBAAiBQ,aAAY,EAAK,yBAC7C0B,EAAS,CACbK,OAAQ,KAAKrC,sBAAsBsC,kBAAiB,EACpDL,UAAWF,EAAK,CAAC,EAAEG,YAAW,EAC9BC,QAASJ,EAAK,CAAC,EAAEG,YAAW,GAE9B,OAAO,KAAKvC,KAAK4B,IAAmClB,EAAK,CAAE2B,OAAAA,CAAM,CAAE,CACrE,iDAnFWvC,EAAW,CAAA,iCAAXA,EAAW8C,QAAX9C,EAAW+C,SAAA,CAAA,CAAA,SAAX/C,CAAW,GAAA", "names": ["UserService", "constructor", "http", "inject", "HttpClient", "constantsService", "ConstantsService", "authenticationService", "AuthenticationService", "changePassword", "oldPassword", "newPassword", "url", "getServerUrl", "body", "JSON", "stringify", "put", "resetPassword", "userId", "checkPassword", "password", "createUser", "user", "toJson", "post", "updateUser", "email", "updateOwnUser", "getUsers", "get", "getRoles", "getRegions", "deleteUser", "delete", "postStressLevel", "stressLevel", "getStressLevels", "date", "params", "startDate", "toISOString", "endDate", "getTeamStressLevels", "region", "getActiveRegionId", "factory", "\u0275fac"] }