mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
54472: Create method in comcol-data-service intermediate commit
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Community } from '../../core/shared/community.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-create-community',
|
||||
@@ -8,7 +9,9 @@ import { Component } from '@angular/core';
|
||||
export class CreateCommunityPageComponent {
|
||||
|
||||
onSubmit(data: any) {
|
||||
console.log('yay, made it with name: ' + data.name);
|
||||
Object.assign(new Community(), {
|
||||
// TODO: Create community object to add to rest
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { isEmpty, isNotEmpty } from '../../shared/empty.util';
|
||||
import { isEmpty, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
||||
import { NormalizedCommunity } from '../cache/models/normalized-community.model';
|
||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
@@ -8,9 +8,14 @@ import { ResponseCacheEntry } from '../cache/response-cache.reducer';
|
||||
import { CommunityDataService } from './community-data.service';
|
||||
|
||||
import { DataService } from './data.service';
|
||||
import { FindByIDRequest } from './request.models';
|
||||
import { FindByIDRequest, PutRequest } from './request.models';
|
||||
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { Community } from '../shared/community.model';
|
||||
import { Collection } from '../shared/collection.model';
|
||||
import { distinctUntilChanged, map } from 'rxjs/operators';
|
||||
import { configureRequest } from '../shared/operators';
|
||||
|
||||
export abstract class ComColDataService<TNormalized extends NormalizedObject, TDomain> extends DataService<TNormalized, TDomain> {
|
||||
protected abstract cds: CommunityDataService;
|
||||
@@ -56,4 +61,14 @@ export abstract class ComColDataService<TNormalized extends NormalizedObject, TD
|
||||
).distinctUntilChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public create(comcol: TDomain) {
|
||||
this.halService.getEndpoint(this.linkPath).pipe(
|
||||
isNotEmptyOperator(),
|
||||
distinctUntilChanged(),
|
||||
map((endpointURL: string) => new PutRequest(this.requestService.generateRequestId(), endpointURL, comcol)),
|
||||
configureRequest(this.requestService)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user