mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 19:22:51 +00:00
fix: daia availability
This commit is contained in:
committed by
Rainer Killinger
parent
b38a96996a
commit
13cee2d426
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {groupBy, groupByProperty} from './group-by';
|
||||
import {groupBy, groupByStable, groupByProperty} from './group-by';
|
||||
|
||||
describe('groupBy', () => {
|
||||
it('should group an array by a key', () => {
|
||||
@@ -77,6 +77,29 @@ describe('groupBy', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('groupByStable', () => {
|
||||
const array = [
|
||||
{id: 2, name: 'two'},
|
||||
{id: 4, name: 'three'},
|
||||
{id: 3, name: 'three'},
|
||||
{id: 1, name: 'one'},
|
||||
];
|
||||
const result = groupByStable(array, it => it.name);
|
||||
|
||||
it('should group an array by keys', () => {
|
||||
expect(result.get('one')).toEqual([{id: 1, name: 'one'}]);
|
||||
expect(result.get('two')).toEqual([{id: 2, name: 'two'}]);
|
||||
expect(result.get('three')).toEqual([
|
||||
{id: 4, name: 'three'},
|
||||
{id: 3, name: 'three'},
|
||||
]);
|
||||
});
|
||||
|
||||
it('should provide ordered keys', () => {
|
||||
expect([...result.keys()]).toEqual(['two', 'three', 'one']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('groupByProperty', function () {
|
||||
it('should group by property', () => {
|
||||
const array = [
|
||||
|
||||
@@ -28,6 +28,21 @@ export function groupBy<T>(
|
||||
}, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Group an array by a function (returns a Map, whose keys keep order info of items entry)
|
||||
*/
|
||||
export function groupByStable<T>(
|
||||
collection: T[],
|
||||
group: (item: T) => string | undefined,
|
||||
): Map<string, T[]> {
|
||||
return collection.reduce((accumulator: Map<string, T[]>, item) => {
|
||||
const key = group(item) ?? '';
|
||||
accumulator.set(key, accumulator.get(key) ?? []);
|
||||
accumulator.get(key)?.push(item);
|
||||
return accumulator;
|
||||
}, new Map<string, T[]>());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -113,7 +113,7 @@ describe('DaiaAvailabilityComponent', () => {
|
||||
dataProvider.daiaServiceUrl = workingDAIAurl;
|
||||
translateService = TestBed.inject(TranslateService);
|
||||
spyOn(dataProvider, 'getAvailability' as any).and.returnValue(
|
||||
Promise.resolve(sampleThing),
|
||||
Promise.resolve([]),
|
||||
);
|
||||
spyOn(
|
||||
DaiaAvailabilityComponent.prototype,
|
||||
|
||||
@@ -20,8 +20,9 @@ import {FavoritesService} from '../../favorites/favorites.service';
|
||||
import {DataProvider} from '../../data/data.provider';
|
||||
import {DataDetailComponent} from '../../data/detail/data-detail.component';
|
||||
import {DaiaDataProvider} from '../daia-data.provider';
|
||||
import {SCDaiaHolding} from '../protocol/response';
|
||||
import {DaiaHolding} from '../protocol/response';
|
||||
import {ModalController} from '@ionic/angular';
|
||||
import {groupByStable} from '../../../_helpers/collections/group-by';
|
||||
|
||||
/**
|
||||
* A Component to display an SCThing detailed
|
||||
@@ -35,7 +36,9 @@ export class DaiaAvailabilityComponent
|
||||
extends DataDetailComponent
|
||||
implements OnInit
|
||||
{
|
||||
holdings: SCDaiaHolding[] | undefined;
|
||||
holdings?: DaiaHolding[];
|
||||
|
||||
holdingsByDepartments?: Map<DaiaHolding['department']['id'], DaiaHolding[]>;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -80,7 +83,13 @@ export class DaiaAvailabilityComponent
|
||||
*/
|
||||
async getAvailability(uid: SCUuid) {
|
||||
this.daiaDataProvider.getAvailability(uid).then(holdings => {
|
||||
if (typeof holdings !== 'undefined') {
|
||||
this.holdings = holdings;
|
||||
this.holdingsByDepartments = groupByStable(
|
||||
holdings,
|
||||
holding => holding.department.id,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
<ion-card>
|
||||
<ng-container>
|
||||
<ion-card>
|
||||
<ion-card-header>
|
||||
{{ 'hebisSearch.daia.availability' | translate }}
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
<ng-container *ngFor="let holding of holdings">
|
||||
<ng-container *ngIf="holdingsByDepartments">
|
||||
<ng-container
|
||||
*ngFor="let holdingsByDepartment of holdingsByDepartments | keyvalue"
|
||||
>
|
||||
<ion-label>
|
||||
<stapps-external-link
|
||||
*ngIf="holdingsByDepartment.value[0].department.href"
|
||||
[text]="holdingsByDepartment.value[0].department.content"
|
||||
[link]="holdingsByDepartment.value[0].department.href"
|
||||
>
|
||||
</stapps-external-link>
|
||||
</ion-label>
|
||||
<ng-container *ngFor="let holding of holdingsByDepartment.value">
|
||||
<stapps-daia-holding [holding]="holding"></stapps-daia-holding>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
<ion-label *ngIf="!holdings">
|
||||
{{ 'hebisSearch.daia.unavailableAvailability' | translate }}
|
||||
</ion-label>
|
||||
@@ -13,4 +28,5 @@
|
||||
{{ 'hebisSearch.daia.unknownAvailability' | translate }}
|
||||
</ion-label>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
</ion-card>
|
||||
</ng-container>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {SCDaiaHolding} from '../protocol/response';
|
||||
import {DaiaHolding} from '../protocol/response';
|
||||
import {DaiaDataProvider} from '../daia-data.provider';
|
||||
|
||||
@Component({
|
||||
@@ -23,14 +23,13 @@ import {DaiaDataProvider} from '../daia-data.provider';
|
||||
styleUrls: ['./daia-holding.scss'],
|
||||
})
|
||||
export class DaiaHoldingComponent implements OnInit {
|
||||
@Input() holding: SCDaiaHolding;
|
||||
@Input() holding: DaiaHolding;
|
||||
|
||||
constructor(private daiaDataProvider: DaiaDataProvider) {}
|
||||
|
||||
resourceLink?: string;
|
||||
|
||||
ngOnInit(): void {
|
||||
console.log(this.holding);
|
||||
this.resourceLink = this.daiaDataProvider.getHoldingLink(this.holding);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,15 +12,6 @@
|
||||
~ You should have received a copy of the GNU General Public License along with
|
||||
~ this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<ion-label>
|
||||
<stapps-external-link
|
||||
*ngIf="holding.label"
|
||||
[text]="holding.label"
|
||||
[link]="holding.href"
|
||||
>
|
||||
</stapps-external-link>
|
||||
</ion-label>
|
||||
<ion-grid>
|
||||
<ion-row *ngIf="holding.storage && holding.storage.content">
|
||||
<ion-col size="3">{{ 'hebisSearch.daia.location' | translate }}</ion-col>
|
||||
@@ -30,6 +21,10 @@
|
||||
<ion-col size="3">{{ 'hebisSearch.daia.signature' | translate }}</ion-col>
|
||||
<ion-col size="9">{{ holding.signature }}</ion-col>
|
||||
</ion-row>
|
||||
<ion-row *ngIf="holding.holdings">
|
||||
<ion-col size="3">{{ 'hebisSearch.daia.holdings' | translate }}</ion-col>
|
||||
<ion-col size="9">{{ holding.holdings }}</ion-col>
|
||||
</ion-row>
|
||||
<ion-row *ngIf="holding.about">
|
||||
<ion-col size="3">{{ 'hebisSearch.daia.comment' | translate }}</ion-col>
|
||||
<ion-col size="9" [innerHTML]="holding.about"></ion-col>
|
||||
@@ -69,7 +64,10 @@
|
||||
</ion-icon>
|
||||
{{ 'hebisSearch.daia.status_states' + '.' + holding.status | translate }}
|
||||
<stapps-external-link
|
||||
*ngIf="holding.status === 'available' && holding.available.href"
|
||||
*ngIf="
|
||||
['available', 'library_only'].indexOf(holding.status) > -1 &&
|
||||
holding.available.href
|
||||
"
|
||||
[text]="'hebisSearch.daia.order' | translate"
|
||||
[link]="holding.available.href"
|
||||
>
|
||||
|
||||
@@ -21,6 +21,7 @@ ion-label a {
|
||||
}
|
||||
ion-grid {
|
||||
padding: 0;
|
||||
margin: 5px 5px;
|
||||
|
||||
ion-row {
|
||||
background-color: var(--ion-color-light);
|
||||
|
||||
@@ -23,7 +23,7 @@ import {LoggerConfig, LoggerModule, NGXLogger} from 'ngx-logger';
|
||||
import {MapModule} from '../map/map.module';
|
||||
import {HttpClientModule} from '@angular/common/http';
|
||||
import {StorageModule} from '../storage/storage.module';
|
||||
import {SCDaiaHolding, SCDaiaService} from './protocol/response';
|
||||
import {DaiaHolding, DaiaService} from './protocol/response';
|
||||
import {Observable, of} from 'rxjs';
|
||||
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
|
||||
|
||||
@@ -69,9 +69,9 @@ describe('DaiaDataProvider', () => {
|
||||
});
|
||||
describe('getResourceLink', () => {
|
||||
it('should return undefined when available not defined', () => {
|
||||
const holding: SCDaiaHolding = {
|
||||
const holding: DaiaHolding = {
|
||||
department: {id: '', content: ''},
|
||||
id: '',
|
||||
label: '',
|
||||
online: false,
|
||||
signature: '',
|
||||
};
|
||||
@@ -80,16 +80,16 @@ describe('DaiaDataProvider', () => {
|
||||
});
|
||||
|
||||
it('should return the resource link without proxy when service is openaccess', () => {
|
||||
const available: SCDaiaService = {
|
||||
const available: DaiaService = {
|
||||
delay: '',
|
||||
expected: '',
|
||||
href: 'https://some-url.com',
|
||||
limitations: [],
|
||||
service: 'openaccess',
|
||||
};
|
||||
const holding: SCDaiaHolding = {
|
||||
const holding: DaiaHolding = {
|
||||
department: {id: '', content: ''},
|
||||
id: '',
|
||||
label: '',
|
||||
online: false,
|
||||
signature: '',
|
||||
available: available,
|
||||
@@ -99,16 +99,16 @@ describe('DaiaDataProvider', () => {
|
||||
});
|
||||
|
||||
it('should return the resource link with proxy when service is not openaccess', () => {
|
||||
const available: SCDaiaService = {
|
||||
const available: DaiaService = {
|
||||
delay: '',
|
||||
expected: '',
|
||||
href: 'https://some-url.com',
|
||||
limitations: [],
|
||||
service: 'other',
|
||||
};
|
||||
const holding: SCDaiaHolding = {
|
||||
const holding: DaiaHolding = {
|
||||
department: {id: '', content: ''},
|
||||
id: '',
|
||||
label: '',
|
||||
online: false,
|
||||
signature: '',
|
||||
available: available,
|
||||
@@ -124,51 +124,51 @@ describe('DaiaDataProvider', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
// let available, unavalable: SCDaiaService[];
|
||||
|
||||
const checkedOut: SCDaiaService = {
|
||||
const checkedOut: DaiaService = {
|
||||
expected: '2022-09-01',
|
||||
limitations: [],
|
||||
service: 'loan',
|
||||
};
|
||||
|
||||
const notYetAvailableOnBuy: SCDaiaService = {
|
||||
const notYetAvailableOnBuy: DaiaService = {
|
||||
limitations: [{id: 'OnBuy', content: ''}],
|
||||
service: 'loan',
|
||||
};
|
||||
|
||||
const notYetAvailableJustReturned: SCDaiaService = {
|
||||
const notYetAvailableJustReturned: DaiaService = {
|
||||
limitations: [{id: 'JustReturned', content: ''}],
|
||||
service: 'loan',
|
||||
};
|
||||
|
||||
const notAvailableCopyIsMissing: SCDaiaService = {
|
||||
const notAvailableCopyIsMissing: DaiaService = {
|
||||
limitations: [{id: 'CopyIsMissing', content: ''}],
|
||||
service: 'loan',
|
||||
};
|
||||
|
||||
const notAvailableCanceled: SCDaiaService = {
|
||||
const notAvailableCanceled: DaiaService = {
|
||||
limitations: [{id: 'Canceled', content: ''}],
|
||||
service: 'loan',
|
||||
};
|
||||
|
||||
const libraryOnlyOnlyInHouse: SCDaiaService = {
|
||||
const libraryOnlyOnlyInHouse: DaiaService = {
|
||||
limitations: [{id: 'OnlyInHouse', content: ''}],
|
||||
service: 'loan',
|
||||
};
|
||||
|
||||
const libraryOnlyExternalLoan: SCDaiaService = {
|
||||
const libraryOnlyExternalLoan: DaiaService = {
|
||||
limitations: [{id: 'ExternalLoan', content: ''}],
|
||||
service: 'loan',
|
||||
};
|
||||
|
||||
const libraryOnlyNoLimitations: SCDaiaService = {
|
||||
const libraryOnlyPresentation: DaiaService = {
|
||||
service: 'presentation',
|
||||
};
|
||||
|
||||
const availableLimitationsUndefined: DaiaService = {
|
||||
service: 'loan',
|
||||
};
|
||||
|
||||
const availableLimitationsUndefined: SCDaiaService = {
|
||||
service: 'loan',
|
||||
};
|
||||
|
||||
const availableLimitationsEmpty: SCDaiaService = {
|
||||
const availableLimitationsEmpty: DaiaService = {
|
||||
limitations: [],
|
||||
service: 'loan',
|
||||
};
|
||||
@@ -205,21 +205,27 @@ describe('DaiaDataProvider', () => {
|
||||
daiaDataProvider.getHoldingStatus([libraryOnlyExternalLoan], []),
|
||||
).toEqual('library_only');
|
||||
expect(
|
||||
daiaDataProvider.getHoldingStatus([], [libraryOnlyNoLimitations]),
|
||||
daiaDataProvider.getHoldingStatus([libraryOnlyPresentation], []),
|
||||
).toEqual('library_only');
|
||||
});
|
||||
|
||||
it('should return available', () => {
|
||||
expect(
|
||||
daiaDataProvider.getHoldingStatus([availableLimitationsUndefined], []),
|
||||
daiaDataProvider.getHoldingStatus(
|
||||
[availableLimitationsUndefined, libraryOnlyPresentation],
|
||||
[],
|
||||
),
|
||||
).toEqual('available');
|
||||
expect(
|
||||
daiaDataProvider.getHoldingStatus([availableLimitationsEmpty], []),
|
||||
daiaDataProvider.getHoldingStatus(
|
||||
[availableLimitationsEmpty, libraryOnlyPresentation],
|
||||
[],
|
||||
),
|
||||
).toEqual('available');
|
||||
});
|
||||
|
||||
it('should return unknown otherwise', () => {
|
||||
const withoutLoan: SCDaiaService = {
|
||||
const withoutLoan: DaiaService = {
|
||||
limitations: [],
|
||||
service: 'anything else',
|
||||
};
|
||||
@@ -230,6 +236,12 @@ describe('DaiaDataProvider', () => {
|
||||
expect(daiaDataProvider.getHoldingStatus([], [withoutLoan])).toEqual(
|
||||
'unknown',
|
||||
);
|
||||
expect(
|
||||
daiaDataProvider.getHoldingStatus([], [availableLimitationsUndefined]),
|
||||
).toEqual('unknown');
|
||||
expect(
|
||||
daiaDataProvider.getHoldingStatus([], [availableLimitationsEmpty]),
|
||||
).toEqual('unknown');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,10 +14,9 @@
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
SCDaiaAvailabilityResponse,
|
||||
SCDaiaHolding,
|
||||
SCDaiaService,
|
||||
SCDaiaSimpleContent,
|
||||
DaiaAvailabilityResponse,
|
||||
DaiaHolding,
|
||||
DaiaService,
|
||||
} from './protocol/response';
|
||||
import {StorageProvider} from '../storage/storage.provider';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
@@ -73,7 +72,7 @@ export class DaiaDataProvider {
|
||||
);
|
||||
}
|
||||
|
||||
async getAvailability(id: string): Promise<SCDaiaHolding[] | undefined> {
|
||||
async getAvailability(id: string): Promise<DaiaHolding[] | undefined> {
|
||||
if (typeof this.daiaServiceUrl === 'undefined') {
|
||||
try {
|
||||
const features = this.configProvider.getValue(
|
||||
@@ -99,12 +98,12 @@ export class DaiaDataProvider {
|
||||
|
||||
return new Promise(resolve =>
|
||||
this.httpClient
|
||||
.get<SCDaiaAvailabilityResponse>(this.daiaServiceUrl as string, {
|
||||
.get<DaiaAvailabilityResponse>(this.daiaServiceUrl as string, {
|
||||
params: {id, lang: this.translateService.currentLang},
|
||||
})
|
||||
.subscribe(
|
||||
(response: SCDaiaAvailabilityResponse) => {
|
||||
const holdings: SCDaiaHolding[] = [];
|
||||
(response: DaiaAvailabilityResponse) => {
|
||||
const holdings: DaiaHolding[] = [];
|
||||
if (response && Array.isArray(response.document)) {
|
||||
response.document.map(document => {
|
||||
Array.isArray(document.item) &&
|
||||
@@ -120,13 +119,9 @@ export class DaiaDataProvider {
|
||||
about,
|
||||
available,
|
||||
storage,
|
||||
chronology,
|
||||
unavailable,
|
||||
} = element;
|
||||
const holdingIndex = holdings.findIndex(
|
||||
holding => holding.id === departmentId,
|
||||
);
|
||||
|
||||
if (holdingIndex === -1) {
|
||||
const holdingStatus = this.holdingHasStatus(
|
||||
available || [],
|
||||
)
|
||||
@@ -141,14 +136,17 @@ export class DaiaDataProvider {
|
||||
? (
|
||||
unavailable.find(
|
||||
item => item.service === 'loan',
|
||||
) as SCDaiaService
|
||||
) as DaiaService
|
||||
).expected
|
||||
: undefined;
|
||||
|
||||
holdings.push({
|
||||
id: element.id,
|
||||
department: {
|
||||
id: departmentId,
|
||||
label: departmentLabel,
|
||||
content: departmentLabel,
|
||||
href: departmentLink,
|
||||
},
|
||||
signature: label,
|
||||
status: holdingStatus,
|
||||
dueDate: dueDate,
|
||||
@@ -159,12 +157,11 @@ export class DaiaDataProvider {
|
||||
) !== 'undefined',
|
||||
available:
|
||||
(Array.isArray(available) &&
|
||||
(available.find(
|
||||
item => item.service === 'openaccess',
|
||||
) ||
|
||||
available.find(
|
||||
item => item.service === 'loan',
|
||||
))) ||
|
||||
available.find(item =>
|
||||
['openaccess', 'loan', 'presentation'].includes(
|
||||
item.service,
|
||||
),
|
||||
)) ||
|
||||
undefined,
|
||||
unavailable:
|
||||
(Array.isArray(unavailable) &&
|
||||
@@ -174,8 +171,8 @@ export class DaiaDataProvider {
|
||||
undefined,
|
||||
storage,
|
||||
about,
|
||||
holdings: chronology?.about,
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// No element available
|
||||
}
|
||||
@@ -194,7 +191,7 @@ export class DaiaDataProvider {
|
||||
);
|
||||
}
|
||||
|
||||
getHoldingLink(holding: SCDaiaHolding) {
|
||||
getHoldingLink(holding: DaiaHolding) {
|
||||
if (typeof this.hebisProxyUrl === 'undefined') {
|
||||
this.logger.error('HeBIS proxy url undefined');
|
||||
|
||||
@@ -212,18 +209,25 @@ export class DaiaDataProvider {
|
||||
return `${this.hebisProxyUrl}${resourceLink}`;
|
||||
}
|
||||
|
||||
holdingHasStatus(available: SCDaiaService[]): boolean {
|
||||
holdingHasStatus(available: DaiaService[]): boolean {
|
||||
return !available.some(item => item.service === 'remote');
|
||||
}
|
||||
|
||||
getHoldingStatus(
|
||||
available: SCDaiaService[],
|
||||
unavailable: SCDaiaService[],
|
||||
): SCDaiaHolding['status'] {
|
||||
available: DaiaService[],
|
||||
unavailable: DaiaService[],
|
||||
): DaiaHolding['status'] {
|
||||
const loan: {available: number; unavailable: number} = {
|
||||
available: available.findIndex(item => item.service === 'loan'),
|
||||
unavailable: unavailable.findIndex(item => item.service === 'loan'),
|
||||
};
|
||||
const presentation: {available: number; unavailable: number} = {
|
||||
available: available.findIndex(item => item.service === 'presentation'),
|
||||
unavailable: unavailable.findIndex(
|
||||
item => item.service === 'presentation',
|
||||
),
|
||||
};
|
||||
|
||||
if (
|
||||
loan.unavailable !== -1 &&
|
||||
typeof unavailable[loan.unavailable].expected !== 'undefined'
|
||||
@@ -249,16 +253,16 @@ export class DaiaDataProvider {
|
||||
|
||||
if (
|
||||
(loan.unavailable !== -1 &&
|
||||
(!Array.isArray(unavailable[loan.unavailable].limitations) ||
|
||||
(unavailable[loan.unavailable].limitations as SCDaiaSimpleContent[])
|
||||
.length === 0 ||
|
||||
unavailable[loan.unavailable].limitations?.some(limitation =>
|
||||
['OnlyInHouse'].includes(limitation.id),
|
||||
))) ||
|
||||
)) ||
|
||||
(loan.available !== -1 &&
|
||||
available[loan.available].limitations?.some(limitation =>
|
||||
['ExternalLoan'].includes(limitation.id),
|
||||
))
|
||||
)) ||
|
||||
(loan.available === -1 &&
|
||||
presentation.available !== -1 &&
|
||||
presentation.unavailable === -1)
|
||||
)
|
||||
return 'library_only';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Client} from '@openstapps/api/lib/client';
|
||||
import {SCHebisSearchRequest} from './protocol/request';
|
||||
import {SCHebisSearchResponse} from './protocol/response';
|
||||
import {HebisSearchResponse} from './protocol/response';
|
||||
import {StorageProvider} from '../storage/storage.provider';
|
||||
import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
@@ -80,7 +80,7 @@ export class HebisDataProvider extends DataProvider {
|
||||
async hebisSearch(
|
||||
searchRequest: SCHebisSearchRequest,
|
||||
options?: {addPrefix: boolean},
|
||||
): Promise<SCHebisSearchResponse> {
|
||||
): Promise<HebisSearchResponse> {
|
||||
if (options?.addPrefix) {
|
||||
searchRequest.query = [HEBIS_PREFIX, searchRequest.query].join('');
|
||||
}
|
||||
@@ -89,7 +89,7 @@ export class HebisDataProvider extends DataProvider {
|
||||
|
||||
if (typeof page === 'undefined') {
|
||||
const preFlightResponse =
|
||||
await this.client.invokeRoute<SCHebisSearchResponse>(
|
||||
await this.client.invokeRoute<HebisSearchResponse>(
|
||||
this.hebisSearchRoute,
|
||||
undefined,
|
||||
{
|
||||
@@ -101,7 +101,7 @@ export class HebisDataProvider extends DataProvider {
|
||||
page = preFlightResponse.pagination.total;
|
||||
}
|
||||
|
||||
return this.client.invokeRoute<SCHebisSearchResponse>(
|
||||
return this.client.invokeRoute<HebisSearchResponse>(
|
||||
this.hebisSearchRoute,
|
||||
undefined,
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ import {HebisDataProvider} from '../hebis-data.provider';
|
||||
import {FavoritesService} from '../../favorites/favorites.service';
|
||||
import {DataProvider} from '../../data/data.provider';
|
||||
import {DataDetailComponent} from '../../data/detail/data-detail.component';
|
||||
import {SCDaiaHolding} from '../protocol/response';
|
||||
import {DaiaHolding} from '../protocol/response';
|
||||
import {ModalController} from '@ionic/angular';
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ import {ModalController} from '@ionic/angular';
|
||||
templateUrl: 'hebis-detail.html',
|
||||
})
|
||||
export class HebisDetailComponent extends DataDetailComponent {
|
||||
holdings: SCDaiaHolding[];
|
||||
holdings: DaiaHolding[];
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
SCSearchResultPagination,
|
||||
} from '@openstapps/core';
|
||||
|
||||
export interface SCHebisSearchResponse {
|
||||
export interface HebisSearchResponse {
|
||||
/**
|
||||
* Response Array of SCBook type or Object
|
||||
*/
|
||||
@@ -17,48 +17,51 @@ export interface SCHebisSearchResponse {
|
||||
pagination: SCSearchResultPagination;
|
||||
}
|
||||
|
||||
export interface SCDaiaAvailabilityResponse {
|
||||
export interface DaiaAvailabilityResponse {
|
||||
document: Array<{
|
||||
item: Array<{
|
||||
id: string;
|
||||
label: string;
|
||||
department: SCDaiaSimpleContent;
|
||||
available: SCDaiaService[];
|
||||
unavailable: SCDaiaService[];
|
||||
chronology?: {
|
||||
about?: string;
|
||||
};
|
||||
department: DaiaSimpleContent;
|
||||
available: DaiaService[];
|
||||
unavailable: DaiaService[];
|
||||
debugInfo: string;
|
||||
about?: string;
|
||||
storage?: SCDaiaSimpleContent;
|
||||
storage?: DaiaSimpleContent;
|
||||
}>;
|
||||
}>;
|
||||
institution: SCDaiaSimpleContent;
|
||||
institution: DaiaSimpleContent;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface SCDaiaSimpleContent {
|
||||
export interface DaiaSimpleContent {
|
||||
id: string;
|
||||
content: string;
|
||||
href?: string;
|
||||
}
|
||||
|
||||
export interface SCDaiaService {
|
||||
export interface DaiaService {
|
||||
delay?: string;
|
||||
href?: string;
|
||||
service: string;
|
||||
expected?: string;
|
||||
limitations?: SCDaiaSimpleContent[];
|
||||
limitations?: DaiaSimpleContent[];
|
||||
}
|
||||
|
||||
export interface SCDaiaHolding {
|
||||
export interface DaiaHolding {
|
||||
id: string;
|
||||
label: string;
|
||||
href?: string;
|
||||
department: DaiaSimpleContent;
|
||||
signature: string;
|
||||
storage?: SCDaiaSimpleContent;
|
||||
available?: SCDaiaService;
|
||||
unavailable?: SCDaiaService;
|
||||
storage?: DaiaSimpleContent;
|
||||
available?: DaiaService;
|
||||
unavailable?: DaiaService;
|
||||
about?: string;
|
||||
online: boolean;
|
||||
dueDate?: string;
|
||||
holdings?: string;
|
||||
status?:
|
||||
| 'checked_out'
|
||||
| 'not_yet_available'
|
||||
|
||||
@@ -34,7 +34,7 @@ import {AuthHelperService} from '../../auth/auth-helper.service';
|
||||
import {ConfigProvider} from '../../config/config.provider';
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
import {AlertController} from '@ionic/angular';
|
||||
import {SCHebisSearchResponse} from '../../hebis/protocol/response';
|
||||
import {HebisSearchResponse} from '../../hebis/protocol/response';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -141,7 +141,7 @@ export class LibraryAccountService {
|
||||
return;
|
||||
}
|
||||
|
||||
let response: SCHebisSearchResponse;
|
||||
let response: HebisSearchResponse;
|
||||
|
||||
try {
|
||||
response = await this.hebisDataProvider.hebisSearch(
|
||||
|
||||
@@ -370,7 +370,8 @@
|
||||
"ejournal": "ejournal",
|
||||
"unknownAvailability": "Keine Information vorhanden",
|
||||
"unavailableAvailability": "System nicht erreichbar",
|
||||
"fulltext": "Zum Volltext"
|
||||
"fulltext": "Zum Volltext",
|
||||
"holdings": "Bestand"
|
||||
}
|
||||
},
|
||||
"schedule": {
|
||||
|
||||
@@ -358,7 +358,7 @@
|
||||
"not_available": "not available",
|
||||
"library_only": "for use in library only",
|
||||
"available": "available",
|
||||
"unknown": "not available"
|
||||
"unknown": "unknown"
|
||||
},
|
||||
"dueDate": "Due date",
|
||||
"location": "Location",
|
||||
@@ -370,7 +370,8 @@
|
||||
"ejournal": "ejournal",
|
||||
"unknownAvailability": "No information available",
|
||||
"unavailableAvailability": "System unreachable",
|
||||
"fulltext": "Full text"
|
||||
"fulltext": "Full text",
|
||||
"holdings": "Holdings"
|
||||
}
|
||||
},
|
||||
"schedule": {
|
||||
|
||||
Reference in New Issue
Block a user