Skip to content

Commit

Permalink
Add PUT to notification service
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasCwy committed Mar 21, 2022
1 parent cd795f6 commit db70ee6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/web/services/notification.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { NotificationUpdateRequest } from './../types/api-request';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { ResourceEndpoints } from '../types/api-const';
import { Notification, Notifications } from '../types/api-output';
import { CreateNotificationRequest } from '../types/api-request';
import { NotificationCreateRequest} from '../types/api-request';
import { HttpRequestService } from './http-request.service';

/**
Expand All @@ -18,7 +19,7 @@ export class NotificationService {
/**
* Creates a notification by calling API.
*/
createNotification(request: CreateNotificationRequest): Observable<Notification> {
createNotification(request: NotificationCreateRequest): Observable<Notification> {
return this.httpRequestService.post(ResourceEndpoints.NOTIFICATION, {}, request);
}

Expand All @@ -28,4 +29,14 @@ export class NotificationService {
getNotifications(): Observable<Notifications> {
return this.httpRequestService.get(ResourceEndpoints.NOTIFICATION);
}

/**
* Updates a notification by calling API.
*/
updateNotification(request: NotificationUpdateRequest, notificationId: string): Observable<Notification> {
const paramsMap: { [key: string]: string } = {
notificationid: notificationId,
};
return this.httpRequestService.put(ResourceEndpoints.NOTIFICATION, paramsMap, request);
}
}

0 comments on commit db70ee6

Please sign in to comment.