-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
local fields: allow librarian to add local fields
* Adds local fields on document, item and serial holding (serial type) * Adds holding informations on the detail screen Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
- Loading branch information
1 parent
8b19087
commit d9f004b
Showing
17 changed files
with
642 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2020 RERO | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { Injectable } from '@angular/core'; | ||
import { RecordService, RecordUiService } from '@rero/ng-core'; | ||
import { map } from 'rxjs/operators'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class LocalFieldApiService { | ||
|
||
/** | ||
* Constructor | ||
* @param _recordService - RecordService | ||
*/ | ||
constructor( | ||
private _recordService: RecordService, | ||
private _recordUiService: RecordUiService | ||
) { } | ||
|
||
/** | ||
* Get Local field for current resource and organisation user | ||
* @param resourceType - string, type of resource | ||
* @param resourcePid - string, pid of resource | ||
* @param organisationPid - string, pid of organisation | ||
* @return Observable | ||
*/ | ||
getByResourceTypeAndResourcePidAndOrganisationId( | ||
resourceType: string, | ||
resourcePid: string, | ||
organisationPid: string | ||
) { | ||
const query = [ | ||
`parent_ref.type:${resourceType}`, | ||
`parent_ref.pid:${resourcePid}`, | ||
`organisation.pid:${organisationPid}`, | ||
].join(' AND '); | ||
|
||
return this._recordService.getRecords('local_fields', query, 1, 1).pipe( | ||
map((result: any) => { | ||
return this._recordService.totalHits(result.hits.total) > 0 | ||
? result.hits.hits[0] | ||
: {}; | ||
}) | ||
); | ||
} | ||
|
||
/** | ||
* Delete local fields by resource pid | ||
* @param resourcePid - string, pid of resource | ||
* @return Observable | ||
*/ | ||
deleteByPid(resourcePid: string) { | ||
return this._recordUiService.deleteRecord('local_fields', resourcePid); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.