Added createdAt, updatedAt, updatedBy to collectibles and pages
This commit is contained in:
parent
858ef1ba69
commit
03baffdc3c
|
@ -19,6 +19,7 @@ import {
|
||||||
import { convertAudioToEndpointAudio } from "../../Audios/endpoints/getByID";
|
import { convertAudioToEndpointAudio } from "../../Audios/endpoints/getByID";
|
||||||
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
||||||
import { convertPageToEndpointPage } from "../../Pages/endpoints/getBySlugEndpoint";
|
import { convertPageToEndpointPage } from "../../Pages/endpoints/getBySlugEndpoint";
|
||||||
|
import { convertRecorderToEndpointRecorder } from "../../Recorders/endpoints/getByUsername";
|
||||||
import { convertVideoToEndpointVideo } from "../../Videos/endpoints/getByID";
|
import { convertVideoToEndpointVideo } from "../../Videos/endpoints/getByID";
|
||||||
|
|
||||||
export const getBySlugEndpoint = createGetByEndpoint({
|
export const getBySlugEndpoint = createGetByEndpoint({
|
||||||
|
@ -52,9 +53,13 @@ export const convertCollectibleToEndpointCollectible = ({
|
||||||
languages,
|
languages,
|
||||||
scans: rawScans,
|
scans: rawScans,
|
||||||
tags,
|
tags,
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
scansEnabled,
|
||||||
|
updatedBy,
|
||||||
}: Collectible): EndpointCollectible => {
|
}: Collectible): EndpointCollectible => {
|
||||||
const gallery = handleGallery(rawGallery);
|
const gallery = handleGallery(rawGallery);
|
||||||
const scans = handleScans(rawScans);
|
const scans = scansEnabled ? handleScans(rawScans) : undefined;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
slug,
|
slug,
|
||||||
|
@ -80,7 +85,6 @@ export const convertCollectibleToEndpointCollectible = ({
|
||||||
...(gallery ? { gallery } : {}),
|
...(gallery ? { gallery } : {}),
|
||||||
...(scans ? { scans } : {}),
|
...(scans ? { scans } : {}),
|
||||||
nature: nature === "Physical" ? CollectibleNature.Physical : CollectibleNature.Digital,
|
nature: nature === "Physical" ? CollectibleNature.Physical : CollectibleNature.Digital,
|
||||||
parentPages: convertSourceToEndpointSource({ collectibles: parentItems, folders }),
|
|
||||||
subitems: isPayloadArrayType(subitems)
|
subitems: isPayloadArrayType(subitems)
|
||||||
? subitems.filter(isPublished).map(convertCollectibleToEndpointCollectible)
|
? subitems.filter(isPublished).map(convertCollectibleToEndpointCollectible)
|
||||||
: [],
|
: [],
|
||||||
|
@ -89,6 +93,12 @@ export const convertCollectibleToEndpointCollectible = ({
|
||||||
...handleSize(size, sizeEnabled),
|
...handleSize(size, sizeEnabled),
|
||||||
...handlePageInfo(pageInfo, pageInfoEnabled),
|
...handlePageInfo(pageInfo, pageInfoEnabled),
|
||||||
...handlePrice(price, priceEnabled),
|
...handlePrice(price, priceEnabled),
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
...(isPayloadType(updatedBy)
|
||||||
|
? { updatedBy: convertRecorderToEndpointRecorder(updatedBy) }
|
||||||
|
: {}),
|
||||||
|
parentPages: convertSourceToEndpointSource({ collectibles: parentItems, folders }),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
convertTagsEndpointTagsGroups,
|
convertTagsEndpointTagsGroups,
|
||||||
} from "../../../utils/endpoints";
|
} from "../../../utils/endpoints";
|
||||||
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
||||||
|
import { convertRecorderToEndpointRecorder } from "../../Recorders/endpoints/getByUsername";
|
||||||
|
|
||||||
export const getBySlugEndpoint = createGetByEndpoint({
|
export const getBySlugEndpoint = createGetByEndpoint({
|
||||||
collection: Collections.Pages,
|
collection: Collections.Pages,
|
||||||
|
@ -32,6 +33,9 @@ export const convertPageToEndpointPage = ({
|
||||||
slug,
|
slug,
|
||||||
tags,
|
tags,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
updatedBy,
|
||||||
}: Page): EndpointPage => ({
|
}: Page): EndpointPage => ({
|
||||||
slug,
|
slug,
|
||||||
...(isValidPayloadImage(thumbnail) ? { thumbnail: convertImageToEndpointImage(thumbnail) } : {}),
|
...(isValidPayloadImage(thumbnail) ? { thumbnail: convertImageToEndpointImage(thumbnail) } : {}),
|
||||||
|
@ -52,6 +56,9 @@ export const convertPageToEndpointPage = ({
|
||||||
credits: convertCreditsToEndpointCredits(credits),
|
credits: convertCreditsToEndpointCredits(credits),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
...(isPayloadType(updatedBy) ? { updatedBy: convertRecorderToEndpointRecorder(updatedBy) } : {}),
|
||||||
parentPages: convertSourceToEndpointSource({ collectibles, folders }),
|
parentPages: convertSourceToEndpointSource({ collectibles, folders }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -215,6 +215,9 @@ export type EndpointPage = {
|
||||||
credits: EndpointCredit[];
|
credits: EndpointCredit[];
|
||||||
toc: TableOfContentEntry[];
|
toc: TableOfContentEntry[];
|
||||||
}[];
|
}[];
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
updatedBy?: EndpointRecorder;
|
||||||
parentPages: EndpointSource[];
|
parentPages: EndpointSource[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -295,6 +298,9 @@ export type EndpointCollectible = {
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
}[];
|
}[];
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
updatedBy?: EndpointRecorder;
|
||||||
parentPages: EndpointSource[];
|
parentPages: EndpointSource[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue