Skip to content
Snippets Groups Projects
Commit 7a12332d authored by lotte's avatar lotte
Browse files

Edit and create communities

parent cd52c0cc
Branches
Tags
No related merge requests found
Showing
with 312 additions and 105 deletions
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
"head": "Collections of this Community" "head": "Collections of this Community"
}, },
"edit": { "edit": {
"head": "Edit collction",
"name": "Name", "name": "Name",
"description": "Short Description", "description": "Short Description",
"introductory": "Introductory text (HTML)", "introductory": "Introductory text (HTML)",
......
...@@ -38,7 +38,7 @@ export class CreateCollectionPageComponent { ...@@ -38,7 +38,7 @@ export class CreateCollectionPageComponent {
onSubmit(data: any) { onSubmit(data: any) {
this.parentUUID$.pipe(take(1)).subscribe((uuid: string) => { this.parentUUID$.pipe(take(1)).subscribe((uuid: string) => {
const collection = Object.assign(new NormalizedCollection(), { const collection = Object.assign(new Collection(), {
name: data.name, name: data.name,
metadata: [ metadata: [
{ key: 'dc.description', value: data.introductory }, { key: 'dc.description', value: data.introductory },
......
<form #form="ngForm" (ngSubmit)="onSubmit(form.value)" class="row" action="/"> <ds-form *ngIf="formModel" #formRef="formComponent"
<div class="col-12 form-group"> [formId]="'community-form-id'"
<label for="community-name" class="font-weight-bold">{{ 'community.edit.name' | translate }}</label> [formModel]="formModel" (submit)="onSubmit($event)"></ds-form>
<input type="text" [(ngModel)]="name" name="name" id="community-name" class="form-control" [ngClass]="{'is-invalid' : !name && nameRequiredError}" aria-label="Community Name" />
<div class="invalid-feedback">{{ 'community.edit.required.name' | translate }}</div>
</div>
<div class="col-12 form-group">
<label for="community-description" class="font-weight-bold">{{ 'community.edit.description' | translate }}</label>
<input type="text" [(ngModel)]="description" name="description" id="community-description" class="form-control" aria-label="Community Short Description" />
</div>
<div class="col-12 form-group">
<label for="community-introductory" class="font-weight-bold">{{ 'community.edit.introductory' | translate }}</label>
<textarea [(ngModel)]="introductory" name="introductory" id="community-introductory" class="form-control" aria-label="Community Introductory Text" rows="6" ></textarea>
</div>
<div class="col-12 form-group">
<label for="community-copyright" class="font-weight-bold">{{ 'community.edit.copyright' | translate }}</label>
<textarea [(ngModel)]="copyright" name="copyright" id="community-copyright" class="form-control" aria-label="Community Copyright Text" rows="6" ></textarea>
</div>
<div class="col-12 form-group">
<label for="community-news" class="font-weight-bold">{{ 'community.edit.news' | translate }}</label>
<textarea [(ngModel)]="news" name="news" id="community-news" class="form-control" aria-label="Community News" rows="6" ></textarea>
</div>
<div class="col-12 form-group">
<button type="button" class="btn btn-secondary" id="community-cancel" (click)="cancel()">{{ 'community.edit.cancel' | translate }}</button>
<button type="submit" class="btn btn-secondary" id="community-submit">{{ 'community.edit.submit' | translate }}</button>
</div>
</form>
import { Component, EventEmitter, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { isNotEmpty } from '../../shared/empty.util';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import {
DynamicFormService,
DynamicInputModel,
DynamicTextAreaModel
} from '@ng-dynamic-forms/core';
import { FormGroup } from '@angular/forms';
import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynamic-form-control.model';
import { Community } from '../../core/shared/community.model';
import { ResourceType } from '../../core/shared/resource-type';
import { hasValue, isNotEmpty } from '../../shared/empty.util';
@Component({ @Component({
selector: 'ds-community-form', selector: 'ds-community-form',
styleUrls: ['./community-form.component.scss'], styleUrls: ['./community-form.component.scss'],
templateUrl: './community-form.component.html' templateUrl: './community-form.component.html'
}) })
export class CommunityFormComponent { export class CommunityFormComponent implements OnInit {
name: string; @Input() community: Community = new Community();
description: string; formModel: DynamicFormControlModel[] = [
introductory: string; new DynamicInputModel({
copyright: string; id: 'title',
news: string; name: 'dc.title',
label: 'Name',
required: true,
validators: {
required: null
},
errorMessages: {
required: 'Please enter a name for this title'
}
}),
new DynamicTextAreaModel({
id: 'description',
name: 'dc.description',
label: 'Introductory text (HTML)',
}),
new DynamicTextAreaModel({
id: 'abstract',
name: 'dc.description.abstract',
label: 'Short Description',
}),
new DynamicTextAreaModel({
id: 'rights',
name: 'dc.rights',
label: 'Copyright text (HTML)',
}),
new DynamicTextAreaModel({
id: 'tableofcontents',
name: 'dc.description.tableofcontents',
label: 'News (HTML)',
}),
];
nameRequiredError = false; formGroup: FormGroup;
@Output() submitted: EventEmitter<any> = new EventEmitter(); @Output() submitForm: EventEmitter<any> = new EventEmitter();
public constructor(private location: Location) { public constructor(private location: Location, private formService: DynamicFormService) {
}
ngOnInit(): void {
this.formModel.forEach(
(fieldModel: DynamicInputModel) => {
fieldModel.value = this.community.findMetadata(fieldModel.name);
}
);
this.formGroup = this.formService.createFormGroup(this.formModel);
} }
onSubmit(data: any) { onSubmit(event: Event) {
if (isNotEmpty(data.name)) { event.stopPropagation();
this.submitted.emit(data); const metadata = this.formModel.map(
this.nameRequiredError = false; (fieldModel: DynamicInputModel) => {
} else { return { key: fieldModel.name, value: fieldModel.value }
this.nameRequiredError = true; }
} );
const filteredOldMetadata = this.community.metadata.filter((filter) => !metadata.map((md) => md.key).includes(filter.key));
const filteredNewMetadata = metadata.filter((md) => isNotEmpty(md.value));
const newMetadata = [...filteredOldMetadata, ...filteredNewMetadata];
const updatedCommunity = Object.assign({}, this.community, {
metadata: newMetadata,
type: ResourceType.Community
});
this.submitForm.emit(updatedCommunity);
} }
cancel() { cancel() {
this.location.back(); this.location.back();
} }
} }
...@@ -5,13 +5,23 @@ import { CommunityPageComponent } from './community-page.component'; ...@@ -5,13 +5,23 @@ import { CommunityPageComponent } from './community-page.component';
import { CommunityPageResolver } from './community-page.resolver'; import { CommunityPageResolver } from './community-page.resolver';
import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component'; import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: 'create', { path: 'create',
component: CreateCommunityPageComponent, component: CreateCommunityPageComponent,
canActivate: [AuthenticatedGuard] }, canActivate: [AuthenticatedGuard]
},
{ path: ':id/edit',
pathMatch: 'full',
component: EditCommunityPageComponent,
canActivate: [AuthenticatedGuard],
resolve: {
community: CommunityPageResolver
}
},
{ {
path: ':id', path: ':id',
component: CommunityPageComponent, component: CommunityPageComponent,
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
[community]="communityPayload"></ds-community-page-sub-collection-list> [community]="communityPayload"></ds-community-page-sub-collection-list>
</div> </div>
</div> </div>
<a [routerLink]="'edit'">Edit</a>
<ds-error *ngIf="communityRD?.hasFailed" message="{{'error.community' | translate}}"></ds-error> <ds-error *ngIf="communityRD?.hasFailed" message="{{'error.community' | translate}}"></ds-error>
<ds-loading *ngIf="communityRD?.isLoading" <ds-loading *ngIf="communityRD?.isLoading"
message="{{'loading.community' | translate}}"></ds-loading> message="{{'loading.community' | translate}}"></ds-loading>
......
...@@ -24,8 +24,6 @@ import { hasValue } from '../shared/empty.util'; ...@@ -24,8 +24,6 @@ import { hasValue } from '../shared/empty.util';
export class CommunityPageComponent implements OnInit, OnDestroy { export class CommunityPageComponent implements OnInit, OnDestroy {
communityRD$: Observable<RemoteData<Community>>; communityRD$: Observable<RemoteData<Community>>;
logoRD$: Observable<RemoteData<Bitstream>>; logoRD$: Observable<RemoteData<Bitstream>>;
private subs: Subscription[] = []; private subs: Subscription[] = [];
constructor( constructor(
...@@ -42,14 +40,9 @@ export class CommunityPageComponent implements OnInit, OnDestroy { ...@@ -42,14 +40,9 @@ export class CommunityPageComponent implements OnInit, OnDestroy {
map((rd: RemoteData<Community>) => rd.payload), map((rd: RemoteData<Community>) => rd.payload),
filter((community: Community) => hasValue(community)), filter((community: Community) => hasValue(community)),
mergeMap((community: Community) => community.logo)); mergeMap((community: Community) => community.logo));
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.subs.filter((sub) => hasValue(sub)).forEach((sub) => sub.unsubscribe()); this.subs.filter((sub) => hasValue(sub)).forEach((sub) => sub.unsubscribe());
} }
} }
...@@ -8,6 +8,7 @@ import { CommunityPageSubCollectionListComponent } from './sub-collection-list/c ...@@ -8,6 +8,7 @@ import { CommunityPageSubCollectionListComponent } from './sub-collection-list/c
import { CommunityPageRoutingModule } from './community-page-routing.module'; import { CommunityPageRoutingModule } from './community-page-routing.module';
import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component'; import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component';
import { CommunityFormComponent } from './community-form/community-form.component'; import { CommunityFormComponent } from './community-form/community-form.component';
import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component';
@NgModule({ @NgModule({
imports: [ imports: [
...@@ -19,6 +20,7 @@ import { CommunityFormComponent } from './community-form/community-form.componen ...@@ -19,6 +20,7 @@ import { CommunityFormComponent } from './community-form/community-form.componen
CommunityPageComponent, CommunityPageComponent,
CommunityPageSubCollectionListComponent, CommunityPageSubCollectionListComponent,
CreateCommunityPageComponent, CreateCommunityPageComponent,
EditCommunityPageComponent,
CommunityFormComponent CommunityFormComponent
] ]
}) })
......
...@@ -7,5 +7,5 @@ ...@@ -7,5 +7,5 @@
</ng-container> </ng-container>
</div> </div>
</div> </div>
<ds-community-form (submitted)="onSubmit($event)"></ds-community-form> <ds-community-form (submitForm)="onSubmit($event)"></ds-community-form>
</div> </div>
...@@ -8,12 +8,10 @@ import { Observable } from 'rxjs/Observable'; ...@@ -8,12 +8,10 @@ import { Observable } from 'rxjs/Observable';
import { RemoteData } from '../../core/data/remote-data'; import { RemoteData } from '../../core/data/remote-data';
import { Community } from '../../core/shared/community.model'; import { Community } from '../../core/shared/community.model';
import { DSOSuccessResponse, ErrorResponse } from '../../core/cache/response-cache.models'; import { DSOSuccessResponse, ErrorResponse } from '../../core/cache/response-cache.models';
import { BrowserModule } from '@angular/platform-browser';
import { SharedModule } from '../../shared/shared.module'; import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { CommunityFormComponent } from '../community-form/community-form.component'; import { CommunityFormComponent } from '../community-form/community-form.component';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { RequestError } from '../../core/data/request.models';
describe('CreateCommunityPageComponent', () => { describe('CreateCommunityPageComponent', () => {
let comp: CreateCommunityPageComponent; let comp: CreateCommunityPageComponent;
......
import { Component } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Community } from '../../core/shared/community.model'; import { Community } from '../../core/shared/community.model';
import { CommunityDataService } from '../../core/data/community-data.service'; import { CommunityDataService } from '../../core/data/community-data.service';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
...@@ -7,55 +7,46 @@ import { Router } from '@angular/router'; ...@@ -7,55 +7,46 @@ import { Router } from '@angular/router';
import { RemoteData } from '../../core/data/remote-data'; import { RemoteData } from '../../core/data/remote-data';
import { isNotEmpty } from '../../shared/empty.util'; import { isNotEmpty } from '../../shared/empty.util';
import { DSpaceObject } from '../../core/shared/dspace-object.model'; import { DSpaceObject } from '../../core/shared/dspace-object.model';
import { take } from 'rxjs/operators'; import { map, take } from 'rxjs/operators';
import { ResourceType } from '../../core/shared/resource-type'; import { getSucceededRemoteData } from '../../core/shared/operators';
import { NormalizedCommunity } from '../../core/cache/models/normalized-community.model';
@Component({ @Component({
selector: 'ds-create-community', selector: 'ds-create-community',
styleUrls: ['./create-community-page.component.scss'], styleUrls: ['./create-community-page.component.scss'],
templateUrl: './create-community-page.component.html' templateUrl: './create-community-page.component.html'
}) })
export class CreateCommunityPageComponent { export class CreateCommunityPageComponent implements OnInit {
public parentUUID$: Observable<string>; public parentUUID$: Observable<string>;
public communityRDObs: Observable<RemoteData<Community>>; public parentRD$: Observable<RemoteData<Community>>;
public constructor( public constructor(
private communityDataService: CommunityDataService, private communityDataService: CommunityDataService,
private routeService: RouteService, private routeService: RouteService,
private router: Router private router: Router
) { ) {
}
ngOnInit(): void {
this.parentUUID$ = this.routeService.getQueryParameterValue('parent'); this.parentUUID$ = this.routeService.getQueryParameterValue('parent');
this.parentUUID$.subscribe((uuid: string) => { this.parentUUID$.subscribe((parentID: string) => {
if (isNotEmpty(uuid)) { if (isNotEmpty(parentID)) {
this.communityRDObs = this.communityDataService.findById(uuid); this.parentRD$ = this.communityDataService.findById(parentID);
} }
}); });
} }
onSubmit(data: any) { onSubmit(community: Community) {
this.parentUUID$.pipe(take(1)).subscribe((uuid: string) => { this.parentUUID$.pipe(take(1)).subscribe((uuid: string) => {
const community = Object.assign(new NormalizedCommunity(), { this.communityDataService.create(community, uuid)
name: data.name, .pipe(getSucceededRemoteData())
metadata: [ .subscribe((communityRD: RemoteData<Community>) => {
{ key: 'dc.description', value: data.introductory }, const newUUID = communityRD.payload.uuid;
{ key: 'dc.description.abstract', value: data.description }, this.router.navigate(['/communities/' + newUUID]);
{ key: 'dc.rights', value: data.copyright }
// TODO: metadata for news
],
type: ResourceType.Community
});
this.communityDataService.create(community, uuid).pipe(take(1)).subscribe((rd: RemoteData<DSpaceObject>) => {
if (rd.hasSucceeded) {
if (uuid) {
this.router.navigate(['communities', uuid]);
} else {
this.router.navigate([]);
}
}
}); });
}); });
} }
} }
<div class="container">
<div class="row">
<div class="col-12 pb-4">
<ng-container *ngVar="(parentUUID$ | async)?.payload as parent">
<h2 *ngIf="!parent" id="header" class="border-bottom pb-2">{{ 'community.edit.head' | translate }}</h2>
<h2 *ngIf="parent" id="sub-header" class="border-bottom pb-2">{{ 'community.edit.sub-head' | translate:{ parent: parent.name } }}</h2>
</ng-container>
</div>
</div>
<ds-community-form (submitForm)="onSubmit($event)" [community]="(communityRD$ | async)?.payload"></ds-community-form>
</div>
import { CreateCommunityPageComponent } from './create-community-page.component';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CommunityDataService } from '../../core/data/community-data.service';
import { RouteService } from '../../shared/services/route.service';
import { Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { Observable } from 'rxjs/Observable';
import { RemoteData } from '../../core/data/remote-data';
import { Community } from '../../core/shared/community.model';
import { DSOSuccessResponse, ErrorResponse } from '../../core/cache/response-cache.models';
import { BrowserModule } from '@angular/platform-browser';
import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common';
import { CommunityFormComponent } from '../community-form/community-form.component';
import { RouterTestingModule } from '@angular/router/testing';
import { RequestError } from '../../core/data/request.models';
describe('CreateCommunityPageComponent', () => {
let comp: CreateCommunityPageComponent;
let fixture: ComponentFixture<CreateCommunityPageComponent>;
let communityDataService: CommunityDataService;
let routeService: RouteService;
let router: Router;
const community = Object.assign(new Community(), {
uuid: 'a20da287-e174-466a-9926-f66b9300d347',
name: 'test community'
});
const newCommunity = Object.assign(new Community(), {
uuid: '1ff59938-a69a-4e62-b9a4-718569c55d48',
name: 'new community'
});
const communityDataServiceStub = {
findById: (uuid) => Observable.of(new RemoteData(false, false, true, null, Object.assign(new Community(), {
uuid: uuid,
name: community.name
}))),
create: (com, uuid?) => Observable.of(new RemoteData(false, false, true, undefined, newCommunity))
};
const routeServiceStub = {
getQueryParameterValue: (param) => Observable.of(community.uuid)
};
const routerStub = {
navigate: (commands) => commands
};
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule],
declarations: [CreateCommunityPageComponent, CommunityFormComponent],
providers: [
{ provide: CommunityDataService, useValue: communityDataServiceStub },
{ provide: RouteService, useValue: routeServiceStub },
{ provide: Router, useValue: routerStub }
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CreateCommunityPageComponent);
comp = fixture.componentInstance;
fixture.detectChanges();
communityDataService = (comp as any).communityDataService;
routeService = (comp as any).routeService;
router = (comp as any).router;
});
describe('onSubmit', () => {
const data = {
name: 'test'
};
it('should navigate when successful', () => {
spyOn(router, 'navigate');
comp.onSubmit(data);
fixture.detectChanges();
expect(router.navigate).toHaveBeenCalled();
});
it('should not navigate on failure', () => {
spyOn(router, 'navigate');
spyOn(communityDataService, 'create').and.returnValue(Observable.of(new RemoteData(true, true, false, undefined, newCommunity)));
comp.onSubmit(data);
fixture.detectChanges();
expect(router.navigate).not.toHaveBeenCalled();
});
});
});
import { Component } from '@angular/core';
import { Community } from '../../core/shared/community.model';
import { CommunityDataService } from '../../core/data/community-data.service';
import { Observable } from 'rxjs';
import { RouteService } from '../../shared/services/route.service';
import { ActivatedRoute, Router } from '@angular/router';
import { RemoteData } from '../../core/data/remote-data';
import { isNotEmpty } from '../../shared/empty.util';
import { DSpaceObject } from '../../core/shared/dspace-object.model';
import { first, map, take, tap } from 'rxjs/operators';
import { ResourceType } from '../../core/shared/resource-type';
import { NormalizedCommunity } from '../../core/cache/models/normalized-community.model';
import { getSucceededRemoteData } from '../../core/shared/operators';
@Component({
selector: 'ds-edit-community',
styleUrls: ['./edit-community-page.component.scss'],
templateUrl: './edit-community-page.component.html'
})
export class EditCommunityPageComponent {
public parentUUID$: Observable<string>;
public parentRD$: Observable<RemoteData<Community>>;
public communityRD$: Observable<RemoteData<Community>>;
public constructor(
private communityDataService: CommunityDataService,
private routeService: RouteService,
private router: Router,
private route: ActivatedRoute
) {
}
ngOnInit(): void {
this.communityRD$ = this.route.data.pipe(first(), map((data) => data.community));
}
onSubmit(community: Community) {
this.communityDataService.update(community)
.pipe(getSucceededRemoteData())
.subscribe((communityRD: RemoteData<Community>) => {
const newUUID = communityRD.payload.uuid;
this.router.navigate(['/communities/' + newUUID]);
});
}
}
import { Injectable } from '@angular/core';
import { NormalizedObject } from '../models/normalized-object.model';
import { CacheableObject } from '../object-cache.reducer';
import { getRelationships } from './build-decorators';
import { NormalizedObjectFactory } from '../models/normalized-object-factory';
import { map, take } from 'rxjs/operators';
import { hasValue, isNotEmpty } from '../../../shared/empty.util';
import { PaginatedList } from '../../data/paginated-list';
export function isRestDataObject(halObj: any) {
return isNotEmpty(halObj._links) && hasValue(halObj._links.self);
}
export function isRestPaginatedList(halObj: any) {
return hasValue(halObj.page) && hasValue(halObj._embedded);
}
export function isPaginatedList(halObj: any) {
return hasValue(halObj.page) && hasValue(halObj.pageInfo);
}
@Injectable()
export class DataBuildService {
normalize<TDomain extends CacheableObject, TNormalized extends NormalizedObject>(domainModel: TDomain): TNormalized {
const normalizedConstructor = NormalizedObjectFactory.getConstructor(domainModel.type);
const relationships = getRelationships(normalizedConstructor) || [];
const normalizedModel = Object.assign({}, domainModel) as any;
relationships.forEach((key: string) => {
if (hasValue(domainModel[key])) {
domainModel[key] = undefined;
}
});
return normalizedModel;
}
}
...@@ -51,10 +51,7 @@ export class RemoteDataBuildService { ...@@ -51,10 +51,7 @@ export class RemoteDataBuildService {
const requestEntry$ = observableRace( const requestEntry$ = observableRace(
href$.pipe(getRequestFromRequestHref(this.requestService)), href$.pipe(getRequestFromRequestHref(this.requestService)),
requestUUID$.pipe(getRequestFromRequestUUID(this.requestService)), requestUUID$.pipe(getRequestFromRequestUUID(this.requestService)),
).pipe(
take(1)
); );
// always use self link if that is cached, only if it isn't, get it via the response. // always use self link if that is cached, only if it isn't, get it via the response.
const payload$ = const payload$ =
observableCombineLatest( observableCombineLatest(
......
import { autoserialize, inheritSerialization } from 'cerialize'; import { autoserialize, deserialize, inheritSerialization, serialize } from 'cerialize';
import { NormalizedDSpaceObject } from './normalized-dspace-object.model'; import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
import { Community } from '../../shared/community.model'; import { Community } from '../../shared/community.model';
...@@ -21,32 +21,32 @@ export class NormalizedCommunity extends NormalizedDSpaceObject { ...@@ -21,32 +21,32 @@ export class NormalizedCommunity extends NormalizedDSpaceObject {
/** /**
* The Bitstream that represents the logo of this Community * The Bitstream that represents the logo of this Community
*/ */
@autoserialize @deserialize
@relationship(ResourceType.Bitstream, false) @relationship(ResourceType.Bitstream, false)
logo: string; logo: string;
/** /**
* An array of Communities that are direct parents of this Community * An array of Communities that are direct parents of this Community
*/ */
@autoserialize @deserialize
@relationship(ResourceType.Community, true) @relationship(ResourceType.Community, true)
parents: string[]; parents: string[];
/** /**
* The Community that owns this Community * The Community that owns this Community
*/ */
@autoserialize @deserialize
@relationship(ResourceType.Community, false) @relationship(ResourceType.Community, false)
owner: string; owner: string;
/** /**
* List of Collections that are owned by this Community * List of Collections that are owned by this Community
*/ */
@autoserialize @deserialize
@relationship(ResourceType.Collection, true) @relationship(ResourceType.Collection, true)
collections: string[]; collections: string[];
@autoserialize @deserialize
@relationship(ResourceType.Community, true) @relationship(ResourceType.Community, true)
subcommunities: string[]; subcommunities: string[];
......
import { autoserialize, autoserializeAs } from 'cerialize'; import { autoserialize, autoserializeAs, deserialize, serialize } from 'cerialize';
import { DSpaceObject } from '../../shared/dspace-object.model'; import { DSpaceObject } from '../../shared/dspace-object.model';
import { Metadatum } from '../../shared/metadatum.model'; import { Metadatum } from '../../shared/metadatum.model';
...@@ -45,12 +45,6 @@ export class NormalizedDSpaceObject extends NormalizedObject { ...@@ -45,12 +45,6 @@ export class NormalizedDSpaceObject extends NormalizedObject {
@autoserialize @autoserialize
type: ResourceType; type: ResourceType;
/**
* The name for this DSpaceObject
*/
@autoserialize
name: string;
/** /**
* An array containing all metadata of this DSpaceObject * An array containing all metadata of this DSpaceObject
*/ */
...@@ -60,13 +54,13 @@ export class NormalizedDSpaceObject extends NormalizedObject { ...@@ -60,13 +54,13 @@ export class NormalizedDSpaceObject extends NormalizedObject {
/** /**
* An array of DSpaceObjects that are direct parents of this DSpaceObject * An array of DSpaceObjects that are direct parents of this DSpaceObject
*/ */
@autoserialize @deserialize
parents: string[]; parents: string[];
/** /**
* The DSpaceObject that owns this DSpaceObject * The DSpaceObject that owns this DSpaceObject
*/ */
@autoserialize @deserialize
owner: string; owner: string;
/** /**
...@@ -75,7 +69,7 @@ export class NormalizedDSpaceObject extends NormalizedObject { ...@@ -75,7 +69,7 @@ export class NormalizedDSpaceObject extends NormalizedObject {
* Repeated here to make the serialization work, * Repeated here to make the serialization work,
* inheritSerialization doesn't seem to work for more than one level * inheritSerialization doesn't seem to work for more than one level
*/ */
@autoserialize @deserialize
_links: { _links: {
[name: string]: string [name: string]: string
} }
......
...@@ -63,6 +63,8 @@ import { NotificationsService } from '../shared/notifications/notifications.serv ...@@ -63,6 +63,8 @@ import { NotificationsService } from '../shared/notifications/notifications.serv
import { UploaderService } from '../shared/uploader/uploader.service'; import { UploaderService } from '../shared/uploader/uploader.service';
import { BrowseItemsResponseParsingService } from './data/browse-items-response-parsing-service'; import { BrowseItemsResponseParsingService } from './data/browse-items-response-parsing-service';
import { DSpaceObjectDataService } from './data/dspace-object-data.service'; import { DSpaceObjectDataService } from './data/dspace-object-data.service';
import { DataBuildService } from './cache/builders/data-build.service';
import { DSOUpdateComparator } from './data/dso-update-comparator';
const IMPORTS = [ const IMPORTS = [
CommonModule, CommonModule,
...@@ -99,6 +101,7 @@ const PROVIDERS = [ ...@@ -99,6 +101,7 @@ const PROVIDERS = [
ObjectCacheService, ObjectCacheService,
PaginationComponentOptions, PaginationComponentOptions,
RegistryService, RegistryService,
DataBuildService,
RemoteDataBuildService, RemoteDataBuildService,
RequestService, RequestService,
EndpointMapResponseParsingService, EndpointMapResponseParsingService,
...@@ -126,6 +129,7 @@ const PROVIDERS = [ ...@@ -126,6 +129,7 @@ const PROVIDERS = [
UploaderService, UploaderService,
UUIDService, UUIDService,
DSpaceObjectDataService, DSpaceObjectDataService,
DSOUpdateComparator,
// register AuthInterceptor as HttpInterceptor // register AuthInterceptor as HttpInterceptor
{ {
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment