Skip to content

Commit c21ca6c

Browse files
jisazacjisazac
authored andcommitted
primer commit
1 parent e189da6 commit c21ca6c

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/app/modules/time-clock/services/entry.service.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ describe('EntryService', () => {
8484
});
8585

8686
it('stops an entry using POST', () => {
87-
service.urlInProduction = true;
87+
service.urlInProductionLegacy = true;
8888
service.stopEntryRunning('id').subscribe();
8989

9090
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id/stop`);
9191
expect(updateEntryRequest.request.method).toBe('POST');
9292
});
9393

9494
it('stops an entry using PUT', () => {
95-
service.urlInProduction = false;
95+
service.urlInProductionLegacy = false;
9696
service.stopEntryRunning('id').subscribe();
9797

9898
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/stop`);
@@ -105,7 +105,7 @@ describe('EntryService', () => {
105105
const pipe: DatePipe = new DatePipe('en');
106106
const timeRange: TimeEntriesTimeRange = {start_date: yesterday, end_date: today};
107107
const userId = '123';
108-
const reportsUrl = service.urlInProduction ? service.baseUrl : service.baseUrl + '/report';
108+
const reportsUrl = service.urlInProductionLegacy ? service.baseUrl : service.baseUrl + '/report';
109109
service.loadEntriesByTimeRange(timeRange, userId).subscribe();
110110

111111
const loadEntryRequest = httpMock.expectOne(req => req.method === 'GET' && req.url === reportsUrl);
@@ -120,7 +120,7 @@ describe('EntryService', () => {
120120
const today = moment(new Date());
121121
const timeRange: TimeEntriesTimeRange = { start_date: yesterday, end_date: today };
122122
const userId = '123';
123-
const reportsUrl = service.urlInProduction ? service.baseUrl : service.baseUrl + '/report';
123+
const reportsUrl = service.urlInProductionLegacy ? service.baseUrl : service.baseUrl + '/report';
124124
service.loadEntriesByTimeRange(timeRange, userId).subscribe();
125125

126126
const loadEntryRequest = httpMock.expectOne(req => req.method === 'GET' && req.url === reportsUrl);
@@ -132,7 +132,7 @@ describe('EntryService', () => {
132132
const today = moment(new Date());
133133
const timeRange: TimeEntriesTimeRange = { start_date: yesterday, end_date: today };
134134
const userId = '123';
135-
const reportsUrl = service.urlInProduction ? service.baseUrl : service.baseUrl + '/report';
135+
const reportsUrl = service.urlInProductionLegacy ? service.baseUrl : service.baseUrl + '/report';
136136

137137
service.loadEntriesByTimeRange(timeRange, userId).subscribe();
138138

src/app/modules/time-clock/services/entry.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class EntryService {
2020

2121
static TIME_ENTRIES_DATE_TIME_FORMAT = 'yyyy-MM-ddTHH:mm:ssZZZZZ';
2222
baseUrl = `${environment.timeTrackerApiUrl}/time-entries`;
23-
urlInProduction = environment.production === EnvironmentType.TT_PROD || environment.production === EnvironmentType.TT_PROD_LEGACY;
23+
urlInProductionLegacy = environment.production === EnvironmentType.TT_PROD_LEGACY;
2424

2525
loadActiveEntry(): Observable<any> {
2626
return this.http.get(`${this.baseUrl}/running`);
@@ -46,7 +46,7 @@ export class EntryService {
4646
}
4747

4848
stopEntryRunning(idEntry: string): Observable<any> {
49-
return (this.urlInProduction ? this.http.post(`${this.baseUrl}/${idEntry}/stop`, null) : this.http.put(`${this.baseUrl}/stop`, null) );
49+
return (this.urlInProductionLegacy ? this.http.post(`${this.baseUrl}/${idEntry}/stop`, null) : this.http.put(`${this.baseUrl}/stop`, null) );
5050
}
5151

5252
restartEntry(idEntry: string): Observable<Entry> {
@@ -69,7 +69,7 @@ export class EntryService {
6969

7070
loadEntriesByTimeRange(range: TimeEntriesTimeRange, userId: string): Observable<any> {
7171
const MAX_NUMBER_OF_ENTRIES_FOR_REPORTS = 9999;
72-
const loadEntriesByTimeRangeURL = this.urlInProduction ? this.baseUrl : this.baseUrl + '/report';
72+
const loadEntriesByTimeRangeURL = this.urlInProductionLegacy ? this.baseUrl : this.baseUrl + '/report';
7373
return this.http.get(loadEntriesByTimeRangeURL,
7474
{
7575
params: {

src/app/modules/users/services/users.service.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('UsersService', () => {
3535
it('grant role to a User', () => {
3636
const userId = 'userId';
3737
const roleId = 'admin';
38-
service.isProduction = true;
38+
service.isProductionLegacy = true;
3939

4040
service.grantRole(userId, roleId).subscribe();
4141

@@ -46,7 +46,7 @@ describe('UsersService', () => {
4646
it('grant role to a User locally', () => {
4747
const userId = 'userId';
4848
const roleId = 'admin';
49-
service.isProduction = false;
49+
service.isProductionLegacy = false;
5050

5151
service.grantRole(userId, roleId).subscribe();
5252

@@ -57,7 +57,7 @@ describe('UsersService', () => {
5757
it('revoke role to a User', () => {
5858
const userId = 'userId';
5959
const roleId = 'admin';
60-
service.isProduction = true;
60+
service.isProductionLegacy = true;
6161

6262
service.revokeRole(userId, roleId).subscribe();
6363

@@ -68,7 +68,7 @@ describe('UsersService', () => {
6868
it('revoke role to a User locally', () => {
6969
const userId = 'userId';
7070
const roleId = 'admin';
71-
service.isProduction = false;
71+
service.isProductionLegacy = false;
7272

7373
service.revokeRole(userId, roleId).subscribe();
7474

src/app/modules/users/services/users.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { EnvironmentType } from './../../../../environments/enum';
99
providedIn: 'root',
1010
})
1111
export class UsersService {
12-
isProduction = environment.production === EnvironmentType.TT_PROD || environment.production === EnvironmentType.TT_PROD_LEGACY;
12+
isProductionLegacy = environment.production === EnvironmentType.TT_PROD_LEGACY;
1313
constructor(private http: HttpClient) {}
1414

1515
baseUrl = `${environment.timeTrackerApiUrl}/users`;
@@ -19,13 +19,13 @@ export class UsersService {
1919
}
2020

2121
grantRole(userId: string, roleId: string): Observable<any> {
22-
const url = this.isProduction ? `${this.baseUrl}/${userId}/roles/${roleId}/grant`
22+
const url = this.isProductionLegacy ? `${this.baseUrl}/${userId}/roles/${roleId}/grant`
2323
: `${this.baseUrl}/${userId}/${roleId}/grant`;
2424
return this.http.post(url, null);
2525
}
2626

2727
revokeRole(userId: string, roleId: string): Observable<any> {
28-
const url = this.isProduction ? `${this.baseUrl}/${userId}/roles/${roleId}/revoke`
28+
const url = this.isProductionLegacy ? `${this.baseUrl}/${userId}/roles/${roleId}/revoke`
2929
: `${this.baseUrl}/${userId}/${roleId}/revoke`;
3030
return this.http.post(url, null);
3131
}

0 commit comments

Comments
 (0)