diff --git a/src/app/core/data-services-map.ts b/src/app/core/data-services-map.ts index 7a4b258abc..12fc91b678 100644 --- a/src/app/core/data-services-map.ts +++ b/src/app/core/data-services-map.ts @@ -27,6 +27,7 @@ import { WORKSPACEITEM } from './eperson/models/workspaceitem.resource-type'; import { FEEDBACK } from './feedback/models/feedback.resource-type'; import { METADATA_FIELD } from './metadata/metadata-field.resource-type'; import { METADATA_SCHEMA } from './metadata/metadata-schema.resource-type'; +import { SUGGESTION } from './notifications/models/suggestion-objects.resource-type'; import { SUGGESTION_SOURCE } from './notifications/models/suggestion-source-object.resource-type'; import { SUGGESTION_TARGET } from './notifications/models/suggestion-target-object.resource-type'; import { QUALITY_ASSURANCE_EVENT_OBJECT } from './notifications/qa/models/quality-assurance-event-object.resource-type'; @@ -130,6 +131,7 @@ export const LAZY_DATA_SERVICES: LazyDataServicesMap = { [QUALITY_ASSURANCE_EVENT_OBJECT.value]: () => import('./notifications/qa/events/quality-assurance-event-data.service').then(m => m.QualityAssuranceEventDataService), [QUALITY_ASSURANCE_SOURCE_OBJECT.value]: () => import('./notifications/qa/source/quality-assurance-source-data.service').then(m => m.QualityAssuranceSourceDataService), [QUALITY_ASSURANCE_TOPIC_OBJECT.value]: () => import('./notifications/qa/topics/quality-assurance-topic-data.service').then(m => m.QualityAssuranceTopicDataService), + [SUGGESTION.value]: () => import('./notifications/suggestions-data.service').then(m => m.SuggestionsDataService), [SUGGESTION_SOURCE.value]: () => import('./notifications/source/suggestion-source-data.service').then(m => m.SuggestionSourceDataService), [SUGGESTION_TARGET.value]: () => import('./notifications/target/suggestion-target-data.service').then(m => m.SuggestionTargetDataService), [DUPLICATE.value]: () => import('./submission/submission-duplicate-data.service').then(m => m.SubmissionDuplicateDataService), diff --git a/src/app/core/notifications/suggestions-data.service.ts b/src/app/core/notifications/suggestions-data.service.ts index d39d270bdf..1f4c2b9a5b 100644 --- a/src/app/core/notifications/suggestions-data.service.ts +++ b/src/app/core/notifications/suggestions-data.service.ts @@ -6,11 +6,11 @@ import { Observable } from 'rxjs'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { RequestParam } from '../cache/models/request-param.model'; import { ObjectCacheService } from '../cache/object-cache.service'; import { CoreState } from '../core-state.model'; +import { IdentifiableDataService } from '../data/base/identifiable-data.service'; import { ChangeAnalyzer } from '../data/change-analyzer'; import { DefaultChangeAnalyzer } from '../data/default-change-analyzer.service'; import { FindListOptions } from '../data/find-list-options.model'; @@ -21,7 +21,6 @@ import { UpdateDataServiceImpl } from '../data/update-data.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { NoContent } from '../shared/NoContent.model'; import { Suggestion } from './models/suggestion.model'; -import { SUGGESTION } from './models/suggestion-objects.resource-type'; import { SuggestionSource } from './models/suggestion-source.model'; import { SuggestionTarget } from './models/suggestion-target.model'; import { SuggestionSourceDataService } from './source/suggestion-source-data.service'; @@ -65,8 +64,7 @@ export class SuggestionDataServiceImpl extends UpdateDataServiceImpl * The service handling all Suggestion Target REST requests. */ @Injectable({ providedIn: 'root' }) -@dataService(SUGGESTION) -export class SuggestionsDataService { +export class SuggestionsDataService extends IdentifiableDataService { protected searchFindBySourceMethod = 'findBySource'; protected searchFindByTargetAndSourceMethod = 'findByTargetAndSource'; @@ -85,12 +83,11 @@ export class SuggestionsDataService { */ private suggestionTargetsDataService: SuggestionTargetDataService; - private responseMsToLive = 10 * 1000; - /** * Initialize service variables * @param {RequestService} requestService * @param {RemoteDataBuildService} rdbService + * @param {Store} store * @param {ObjectCacheService} objectCache * @param {HALEndpointService} halService * @param {NotificationsService} notificationsService @@ -102,6 +99,7 @@ export class SuggestionsDataService { constructor( protected requestService: RequestService, protected rdbService: RemoteDataBuildService, + protected store: Store, protected objectCache: ObjectCacheService, protected halService: HALEndpointService, protected notificationsService: NotificationsService, @@ -110,6 +108,7 @@ export class SuggestionsDataService { protected comparatorSources: DefaultChangeAnalyzer, protected comparatorTargets: DefaultChangeAnalyzer, ) { + super('suggestions', requestService, rdbService, objectCache, halService); this.suggestionsDataService = new SuggestionDataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparatorSuggestions, this.responseMsToLive); this.suggestionSourcesDataService = new SuggestionSourceDataService(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparatorSources); this.suggestionTargetsDataService = new SuggestionTargetDataService(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparatorTargets);