Skip to content

Commit ba2b099

Browse files
committed
fix: TT-508 update endpoints in the UI
1 parent fb304c0 commit ba2b099

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

src/app/modules/activities-management/services/activity.service.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('Activity Service', () => {
5656
});
5757

5858
it('activities are delete using DELETE from baseUrl', () => {
59-
const url = `${service.baseUrl}/1`;
59+
const url = `${service.baseUrl}/id:1`;
6060
service.deleteActivity(activities[0].id).subscribe((activitiesInResponse) => {
6161
expect(activitiesInResponse.filter((activity) => activity.id !== activities[0].id)).toEqual([activities[1]]);
6262
});
@@ -73,7 +73,7 @@ describe('Activity Service', () => {
7373
service.updateActivity(activity).subscribe((response) => {
7474
expect(response.name).toBe('aaa');
7575
});
76-
const updateActivitiesRequest = httpMock.expectOne(`${service.baseUrl}/${activity.id}`);
76+
const updateActivitiesRequest = httpMock.expectOne(`${service.baseUrl}/id:${activity.id}`);
7777
expect(updateActivitiesRequest.request.method).toBe('PUT');
7878
updateActivitiesRequest.flush(activity);
7979
});

src/app/modules/activities-management/services/activity.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ export class ActivityService {
2727
}
2828

2929
deleteActivity(acitivityId: string): Observable<any> {
30-
const url = `${this.baseUrl}/${acitivityId}`;
30+
const url = `${this.baseUrl}/id:${acitivityId}`;
3131
return this.http.delete(url);
3232
}
3333

3434
updateActivity(activityData): Observable<any> {
35-
const url = `${this.baseUrl}/${activityData.id}`;
35+
const url = `${this.baseUrl}/id:${activityData.id}`;
3636

3737
const body = {
3838
...activityData,

src/app/modules/customer-management/components/projects-type/services/project-type.service.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('Activity Service', () => {
5656
});
5757

5858
it('ProjectTypes are delete using DELETE from baseUrl', () => {
59-
const url = `${service.baseUrl}/1`;
59+
const url = `${service.baseUrl}/id:1`;
6060
service.deleteProjectType(projectTypes[0].id).subscribe((projectTypesInResponse) => {
6161
expect(projectTypesInResponse.filter((activity) => activity.id !== projectTypes[0].id)).toEqual([
6262
projectTypes[1],
@@ -70,12 +70,12 @@ describe('Activity Service', () => {
7070
it('update activity using PUT from baseUrl', () => {
7171
const projectType = { id: '1', name: 'aaa', description: 'bbb' };
7272

73-
service.baseUrl = 'project-type' + '/' + projectType.id;
73+
service.baseUrl = 'project-type' + '/id:' + projectType.id;
7474

7575
service.updateProjectType(projectType).subscribe((response) => {
7676
expect(response.name).toBe('aaa');
7777
});
78-
const updateProjectTypeRequest = httpMock.expectOne(`${service.baseUrl}/${projectType.id}`);
78+
const updateProjectTypeRequest = httpMock.expectOne(`${service.baseUrl}/id:${projectType.id}`);
7979
expect(updateProjectTypeRequest.request.method).toBe('PUT');
8080
updateProjectTypeRequest.flush(projectType);
8181
});

src/app/modules/customer-management/components/projects-type/services/project-type.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ export class ProjectTypeService {
2323
}
2424

2525
deleteProjectType(projectTypeId: string): Observable<any> {
26-
const url = `${this.baseUrl}/${projectTypeId}`;
26+
const url = `${this.baseUrl}/id:${projectTypeId}`;
2727
return this.http.delete(url);
2828
}
2929

3030
updateProjectType(projectTypeData): Observable<any> {
31-
const url = `${this.baseUrl}/${projectTypeData.id}`;
31+
const url = `${this.baseUrl}/id:${projectTypeData.id}`;
3232
return this.http.put(url, projectTypeData);
3333
}
3434
}

src/app/modules/customer-management/components/projects/components/services/project.service.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('ProjectService', () => {
8686
service.updateProject(project).subscribe((response) => {
8787
expect(response.name).toBe('new name');
8888
});
89-
const updateProjectRequest = httpMock.expectOne(`${service.url}/${project.id}`);
89+
const updateProjectRequest = httpMock.expectOne(`${service.url}/id:${project.id}`);
9090
expect(updateProjectRequest.request.method).toBe('PUT');
9191
updateProjectRequest.flush(project);
9292
});
@@ -98,7 +98,7 @@ describe('ProjectService', () => {
9898
service.updateProject(project).subscribe((response) => {
9999
expect(response.name).toBe('new name');
100100
});
101-
const updateProjectRequest = httpMock.expectOne(`${service.url}/${project.id}`);
101+
const updateProjectRequest = httpMock.expectOne(`${service.url}/id:${project.id}`);
102102
expect(updateProjectRequest.request.method).toBe('PUT');
103103
updateProjectRequest.flush(project);
104104
});
@@ -115,7 +115,7 @@ describe('ProjectService', () => {
115115
});
116116

117117
it('update status project using PUT from baseUrl locally', () => {
118-
const url = `${service.url}/1`;
118+
const url = `${service.url}/id:1`;
119119
service.isDevelopment = true;
120120
service.deleteProject(projectsList[0].id).subscribe((projectsInResponse) => {
121121
expect(projectsInResponse.filter((project) => project.id !== projectsList[0].id).length).toEqual(2);

src/app/modules/customer-management/components/projects/components/services/project.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ export class ProjectService {
3838
projectData.status = 1;
3939
}
4040
}
41-
return this.http.put(`${this.url}/${id}`, projectData);
41+
return this.http.put(`${this.url}/id:${id}`, projectData);
4242
}
4343

4444
deleteProject(projectId: string): Observable<any> {
4545
return this.isDevelopment
46-
? this.http.put(`${this.url}/${projectId}`, { status: 0 })
46+
? this.http.put(`${this.url}/id:${projectId}`, { status: 0 })
4747
: this.http.delete(`${this.url}/${projectId}`);
4848
}
4949
}

src/app/modules/customer-management/services/customer.service.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('CustomerService', () => {
4545
{ name: 'aa', description: 'bb', tenant_id: 'cc', id: '1' },
4646
{ name: 'xx', description: 'yy', tenant_id: 'zz', id: '2' },
4747
];
48-
const url = `${service.baseUrl}/1`;
48+
const url = `${service.baseUrl}/id:1`;
4949
service.deleteCustomer(customer[0].id).subscribe();
5050
const getCustomerRequest = httpMock.expectOne(url);
5151

@@ -55,13 +55,13 @@ describe('CustomerService', () => {
5555

5656
it('update customer using PUT from baseUrl', () => {
5757
const customer = { id: '1', name: 'aaa', description: 'bbb' };
58-
service.baseUrl = 'customers' + '/' + customer.id;
58+
service.baseUrl = 'customers' + '/id:' + customer.id;
5959

6060
service.updateCustomer(customer).subscribe((response) => {
6161
expect(response.name).toBe('aaa');
6262
});
6363

64-
const updateCustomerRequest = httpMock.expectOne(`${service.baseUrl}/${customer.id}`);
64+
const updateCustomerRequest = httpMock.expectOne(`${service.baseUrl}/id:${customer.id}`);
6565

6666
expect(updateCustomerRequest.request.method).toBe('PUT');
6767
updateCustomerRequest.flush(customer);

src/app/modules/customer-management/services/customer.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ export class CustomerService {
2121
}
2222

2323
deleteCustomer(customerId: string): Observable<any> {
24-
const url = `${this.baseUrl}/${customerId}`;
24+
const url = `${this.baseUrl}/id:${customerId}`;
2525
return this.http.delete(url);
2626
}
2727

2828
updateCustomer(customerData): Observable<any> {
29-
const url = `${this.baseUrl}/${customerData.id}`;
29+
const url = `${this.baseUrl}/id:${customerData.id}`;
3030
return this.http.put(url, customerData);
3131
}
3232
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('EntryService', () => {
7070

7171
service.updateEntry(updatedEntry).subscribe();
7272

73-
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id`);
73+
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id:id`);
7474
expect(updateEntryRequest.request.method).toBe('PUT');
7575
});
7676

@@ -79,7 +79,7 @@ describe('EntryService', () => {
7979

8080
service.deleteEntry(entry).subscribe();
8181

82-
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/${entry}`);
82+
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id:${entry}`);
8383
expect(updateEntryRequest.request.method).toBe('DELETE');
8484
});
8585

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ export class EntryService {
3636

3737
updateEntry(entryData): Observable<any> {
3838
const {id} = entryData;
39-
return this.http.put(`${this.baseUrl}/${id}`, entryData);
39+
return this.http.put(`${this.baseUrl}/id:${id}`, entryData);
4040
}
4141

4242
deleteEntry(entryId: string): Observable<any> {
43-
const url = `${this.baseUrl}/${entryId}`;
43+
const url = `${this.baseUrl}/id:${entryId}`;
4444
return this.http.delete(url);
4545
}
4646

0 commit comments

Comments
 (0)