mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-09 19:13:08 +00:00
Added distinct ids and uuids to the mock data
This commit is contained in:
@@ -48,11 +48,6 @@ export class CollectionDataEffects {
|
|||||||
@Effect() findById$ = this.actions$
|
@Effect() findById$ = this.actions$
|
||||||
.ofType(CollectionFindSingleActionTypes.FIND_BY_ID_REQUEST)
|
.ofType(CollectionFindSingleActionTypes.FIND_BY_ID_REQUEST)
|
||||||
.switchMap(action => {
|
.switchMap(action => {
|
||||||
if (this.cache.has(action.payload)) {
|
|
||||||
return this.cache.get<Collection>(action.payload)
|
|
||||||
.map(collection => new CollectionFindByIdSuccessAction(collection.uuid));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return this.restApi.get(`/collections/${action.payload}`)
|
return this.restApi.get(`/collections/${action.payload}`)
|
||||||
.map((data: DSpaceRESTV2Response) => new DSpaceRESTv2Serializer(Collection).deserialize(data))
|
.map((data: DSpaceRESTV2Response) => new DSpaceRESTv2Serializer(Collection).deserialize(data))
|
||||||
.do((collection: Collection) => {
|
.do((collection: Collection) => {
|
||||||
@@ -60,7 +55,6 @@ export class CollectionDataEffects {
|
|||||||
})
|
})
|
||||||
.map((collection: Collection) => new CollectionFindByIdSuccessAction(collection.uuid))
|
.map((collection: Collection) => new CollectionFindByIdSuccessAction(collection.uuid))
|
||||||
.catch((errorMsg: string) => Observable.of(new CollectionFindByIdErrorAction(errorMsg)));
|
.catch((errorMsg: string) => Observable.of(new CollectionFindByIdErrorAction(errorMsg)));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -48,11 +48,6 @@ export class ItemDataEffects {
|
|||||||
@Effect() findById$ = this.actions$
|
@Effect() findById$ = this.actions$
|
||||||
.ofType(ItemFindSingleActionTypes.FIND_BY_ID_REQUEST)
|
.ofType(ItemFindSingleActionTypes.FIND_BY_ID_REQUEST)
|
||||||
.switchMap(action => {
|
.switchMap(action => {
|
||||||
if (this.cache.has(action.payload)) {
|
|
||||||
return this.cache.get<Item>(action.payload)
|
|
||||||
.map(item => new ItemFindByIdSuccessAction(item.uuid));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return this.restApi.get(`/items/${action.payload}`)
|
return this.restApi.get(`/items/${action.payload}`)
|
||||||
.map((data: DSpaceRESTV2Response) => new DSpaceRESTv2Serializer(Item).deserialize(data))
|
.map((data: DSpaceRESTV2Response) => new DSpaceRESTv2Serializer(Item).deserialize(data))
|
||||||
.do((item: Item) => {
|
.do((item: Item) => {
|
||||||
@@ -60,7 +55,6 @@ export class ItemDataEffects {
|
|||||||
})
|
})
|
||||||
.map((item: Item) => new ItemFindByIdSuccessAction(item.uuid))
|
.map((item: Item) => new ItemFindByIdSuccessAction(item.uuid))
|
||||||
.catch((errorMsg: string) => Observable.of(new ItemFindByIdErrorAction(errorMsg)));
|
.catch((errorMsg: string) => Observable.of(new ItemFindByIdErrorAction(errorMsg)));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -9,11 +9,17 @@ import { CacheableObject } from "../data-services/cache/cache.reducer";
|
|||||||
export abstract class DSpaceObject implements CacheableObject {
|
export abstract class DSpaceObject implements CacheableObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of this DSpaceObject
|
* The human-readable identifier of this DSpaceObject
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The universally unique identifier of this DSpaceObject
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
uuid: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string representing the kind of DSpaceObject, e.g. community, item, …
|
* A string representing the kind of DSpaceObject, e.g. community, item, …
|
||||||
*/
|
*/
|
||||||
@@ -65,12 +71,4 @@ export abstract class DSpaceObject implements CacheableObject {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get uuid(): string {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
set uuid(val: string) {
|
|
||||||
this.id = val;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,8 @@ export const BITSTREAMS = [
|
|||||||
"bundle": { "href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9" },
|
"bundle": { "href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9" },
|
||||||
"retrieve": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa/retrieve" }
|
"retrieve": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa/retrieve" }
|
||||||
},
|
},
|
||||||
"id": "43c57c2b-206f-4645-8c8f-5f10c84b09fa",
|
"id": "3678",
|
||||||
|
"uuid": "43c57c2b-206f-4645-8c8f-5f10c84b09fa",
|
||||||
"name": "do_open_access_CRL.pdf",
|
"name": "do_open_access_CRL.pdf",
|
||||||
"size": 636626,
|
"size": 636626,
|
||||||
"checksum": {
|
"checksum": {
|
||||||
@@ -25,7 +26,8 @@ export const BITSTREAMS = [
|
|||||||
"bundle": { "href": "/bundles/a469c57a-abcf-45c3-83e4-b187ebd708fd" },
|
"bundle": { "href": "/bundles/a469c57a-abcf-45c3-83e4-b187ebd708fd" },
|
||||||
"retrieve": { "href": "/rest/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632/retrieve" }
|
"retrieve": { "href": "/rest/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632/retrieve" }
|
||||||
},
|
},
|
||||||
"id": "1a013ecc-fb25-4689-a44f-f1383ad26632",
|
"id": "8842",
|
||||||
|
"uuid": "1a013ecc-fb25-4689-a44f-f1383ad26632",
|
||||||
"name": "do_open_access_CRL.pdf.jpg",
|
"name": "do_open_access_CRL.pdf.jpg",
|
||||||
"size": 41183,
|
"size": 41183,
|
||||||
"checksum": {
|
"checksum": {
|
||||||
|
@@ -3,14 +3,15 @@ export const BUNDLES = [
|
|||||||
"_links": {
|
"_links": {
|
||||||
"self": { "href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9" },
|
"self": { "href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9" },
|
||||||
"items": [
|
"items": [
|
||||||
{ "href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78" }
|
{ "href": "/items/8871" }
|
||||||
],
|
],
|
||||||
"bitstreams": [
|
"bitstreams": [
|
||||||
{ "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa" },
|
{ "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa" },
|
||||||
],
|
],
|
||||||
"primaryBitstream": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa" }
|
"primaryBitstream": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa" }
|
||||||
},
|
},
|
||||||
"id": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9",
|
"id": "2355",
|
||||||
|
"uuid": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9",
|
||||||
"name": "ORIGINAL",
|
"name": "ORIGINAL",
|
||||||
"metadata": [
|
"metadata": [
|
||||||
{ "key": "dc.title", "value": "ORIGINAL", "language": "en" }
|
{ "key": "dc.title", "value": "ORIGINAL", "language": "en" }
|
||||||
@@ -20,14 +21,15 @@ export const BUNDLES = [
|
|||||||
"_links": {
|
"_links": {
|
||||||
"self": { "href": "/bundles/a469c57a-abcf-45c3-83e4-b187ebd708fd" },
|
"self": { "href": "/bundles/a469c57a-abcf-45c3-83e4-b187ebd708fd" },
|
||||||
"items": [
|
"items": [
|
||||||
{ "href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78" }
|
{ "href": "/items/8871" }
|
||||||
],
|
],
|
||||||
"bitstreams": [
|
"bitstreams": [
|
||||||
{ "href": "/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632" },
|
{ "href": "/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632" },
|
||||||
],
|
],
|
||||||
"primaryBitstream": { "href": "/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632" }
|
"primaryBitstream": { "href": "/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632" }
|
||||||
},
|
},
|
||||||
"id": "a469c57a-abcf-45c3-83e4-b187ebd708fd",
|
"id": "5687",
|
||||||
|
"uuid": "a469c57a-abcf-45c3-83e4-b187ebd708fd",
|
||||||
"name": "THUMBNAIL",
|
"name": "THUMBNAIL",
|
||||||
"metadata": [
|
"metadata": [
|
||||||
{ "key": "dc.title", "value": "THUMBNAIL", "language": "en" }
|
{ "key": "dc.title", "value": "THUMBNAIL", "language": "en" }
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
export const COLLECTIONS = [
|
export const COLLECTIONS = [
|
||||||
{
|
{
|
||||||
"_links": {
|
"_links": {
|
||||||
"self": { "href": "/collections/9e32a2e2-6b91-4236-a361-995ccdc14c60" },
|
"self": { "href": "/collections/5179" },
|
||||||
"items": [
|
"items": [
|
||||||
{ "href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78" },
|
{ "href": "/items/8871" },
|
||||||
{ "href": "/items/be8325f7-243b-49f4-8a4b-df2b793ff3b5" }
|
{ "href": "/items/9978" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"id": "9e32a2e2-6b91-4236-a361-995ccdc14c60",
|
"id": "5179",
|
||||||
|
"uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60",
|
||||||
"name": "A Test Collection",
|
"name": "A Test Collection",
|
||||||
"handle": "123456789/5179",
|
"handle": "123456789/5179",
|
||||||
"metadata": [
|
"metadata": [
|
||||||
@@ -35,13 +36,14 @@ export const COLLECTIONS = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_links": {
|
"_links": {
|
||||||
"self": { "href": "/collections/598ce822-c357-46f3-ab70-63724d02d6ad" },
|
"self": { "href": "/collections/6547" },
|
||||||
"items": [
|
"items": [
|
||||||
{ "href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78" },
|
{ "href": "/items/8871" },
|
||||||
{ "href": "/items/be8325f7-243b-49f4-8a4b-df2b793ff3b5" }
|
{ "href": "/items/9978" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"id": "598ce822-c357-46f3-ab70-63724d02d6ad",
|
"id": "6547",
|
||||||
|
"uuid": "598ce822-c357-46f3-ab70-63724d02d6ad",
|
||||||
"name": "Another Test Collection",
|
"name": "Another Test Collection",
|
||||||
"handle": "123456789/6547",
|
"handle": "123456789/6547",
|
||||||
"metadata": [
|
"metadata": [
|
||||||
|
@@ -2,14 +2,14 @@ export const ITEMS = [
|
|||||||
{
|
{
|
||||||
"_links": {
|
"_links": {
|
||||||
"self": {
|
"self": {
|
||||||
"href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78"
|
"href": "/items/8871"
|
||||||
},
|
},
|
||||||
"collections": [
|
"collections": [
|
||||||
{
|
{
|
||||||
"href": "/collections/9e32a2e2-6b91-4236-a361-995ccdc14c60"
|
"href": "/collections/5179"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"href": "/collections/598ce822-c357-46f3-ab70-63724d02d6ad"
|
"href": "/collections/6547"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bundles": [
|
"bundles": [
|
||||||
@@ -21,7 +21,8 @@ export const ITEMS = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"id": "21539b1d-9ef1-4eda-9c77-49565b5bfb78",
|
"id": "8871",
|
||||||
|
"uuid": "21539b1d-9ef1-4eda-9c77-49565b5bfb78",
|
||||||
"name": "Do Open-Access Articles Have a Greater Research Impact?",
|
"name": "Do Open-Access Articles Have a Greater Research Impact?",
|
||||||
"handle": "123456789/8871",
|
"handle": "123456789/8871",
|
||||||
"lastModified": "2016-10-14 10:41:12.886",
|
"lastModified": "2016-10-14 10:41:12.886",
|
||||||
@@ -93,14 +94,14 @@ export const ITEMS = [
|
|||||||
{
|
{
|
||||||
"_links": {
|
"_links": {
|
||||||
"self": {
|
"self": {
|
||||||
"href": "/items/be8325f7-243b-49f4-8a4b-df2b793ff3b5"
|
"href": "/items/9978"
|
||||||
},
|
},
|
||||||
"collections": [
|
"collections": [
|
||||||
{
|
{
|
||||||
"href": "/collections/9e32a2e2-6b91-4236-a361-995ccdc14c60"
|
"href": "/collections/5179"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"href": "/collections/598ce822-c357-46f3-ab70-63724d02d6ad"
|
"href": "/collections/6547"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bundles": [
|
"bundles": [
|
||||||
@@ -112,7 +113,8 @@ export const ITEMS = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"id": "be8325f7-243b-49f4-8a4b-df2b793ff3b5",
|
"id": "9978",
|
||||||
|
"uuid": "be8325f7-243b-49f4-8a4b-df2b793ff3b5",
|
||||||
"name": "Another Test Item",
|
"name": "Another Test Item",
|
||||||
"handle": "123456789/9978",
|
"handle": "123456789/9978",
|
||||||
"lastModified": "2016-05-27 03:00:20.063",
|
"lastModified": "2016-05-27 03:00:20.063",
|
||||||
|
Reference in New Issue
Block a user