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