Commits
Mykhaylo authored b09de302722
67 67 | /** |
68 68 | * Get subscriptions for a given item or community or collection & eperson. |
69 69 | * |
70 70 | * @param eperson The eperson to search for |
71 71 | * @param uuid The uuid of the dsobjcet to search for |
72 72 | */ |
73 73 | getSubscriptionsByPersonDSO(eperson: string, uuid: string): Observable<RemoteData<PaginatedList<Subscription>>> { |
74 74 | |
75 75 | const optionsWithObject = Object.assign(new FindListOptions(), { |
76 76 | searchParams: [ |
77 - | new RequestParam('dspace_object_id', uuid), |
77 + | new RequestParam('resource', uuid), |
78 78 | new RequestParam('eperson_id', eperson) |
79 79 | ] |
80 80 | }); |
81 81 | |
82 82 | return this.searchData.searchBy('findByEPersonAndDso', optionsWithObject, false, true); |
83 83 | } |
84 84 | |
85 85 | /** |
86 86 | * Create a subscription for a given item or community or collection. |
87 87 | * |
88 88 | * @param subscription The subscription to create |
89 89 | * @param ePerson The ePerson to create for |
90 90 | * @param uuid The uuid of the dsobjcet to create for |
91 91 | */ |
92 92 | createSubscription(subscription: Subscription, ePerson: string, uuid: string): Observable<RemoteData<Subscription>> { |
93 93 | |
94 94 | return this.halService.getEndpoint(this.linkPath).pipe( |
95 95 | isNotEmptyOperator(), |
96 96 | take(1), |
97 - | map((endpointUrl: string) => `${endpointUrl}?dspace_object_id=${uuid}&eperson_id=${ePerson}`), |
97 + | map((endpointUrl: string) => `${endpointUrl}?resource=${uuid}&eperson_id=${ePerson}`), |
98 98 | map((endpointURL: string) => new CreateRequest(this.requestService.generateRequestId(), endpointURL, JSON.stringify(subscription))), |
99 99 | sendRequest(this.requestService), |
100 100 | switchMap((restRequest: RestRequest) => this.rdbService.buildFromRequestUUID(restRequest.uuid)), |
101 101 | getFirstCompletedRemoteData(), |
102 102 | ) as Observable<RemoteData<Subscription>>; |
103 103 | } |
104 104 | |
105 105 | /** |
106 106 | * Update a subscription for a given item or community or collection. |
107 107 | * |
108 108 | * @param subscription The subscription to update |
109 109 | * @param ePerson The ePerson to update for |
110 110 | * @param uuid The uuid of the dsobjcet to update for |
111 111 | */ |
112 112 | updateSubscription(subscription, ePerson: string, uuid: string) { |
113 113 | |
114 114 | return this.halService.getEndpoint(this.linkPath).pipe( |
115 115 | isNotEmptyOperator(), |
116 116 | take(1), |
117 - | map((endpointUrl: string) => `${endpointUrl}/${subscription.id}?dspace_object_id=${uuid}&eperson_id=${ePerson}`), |
117 + | map((endpointUrl: string) => `${endpointUrl}/${subscription.id}?resource=${uuid}&eperson_id=${ePerson}`), |
118 118 | map((endpointURL: string) => new PutRequest(this.requestService.generateRequestId(), endpointURL, JSON.stringify(subscription))), |
119 119 | sendRequest(this.requestService), |
120 120 | switchMap((restRequest: RestRequest) => this.rdbService.buildFromRequestUUID(restRequest.uuid)), |
121 121 | getFirstCompletedRemoteData(), |
122 122 | ) as Observable<RemoteData<Subscription>>; |
123 123 | } |
124 124 | |
125 125 | |
126 126 | /** |
127 127 | * Deletes the subscription with a give id |