Some fixes
This commit is contained in:
		
							parent
							
								
									fdf6655183
								
							
						
					
					
						commit
						92266834f4
					
				| @ -75,7 +75,6 @@ export const convertFolderToEndpointFolder = ({ | ||||
|           ]; | ||||
|         case Collections.Pages: | ||||
|           return [{ relationTo: Collections.Pages, value: convertPageToEndpointPage(value) }]; | ||||
|         // TODO: handle media type files
 | ||||
|         case Collections.Images: | ||||
|           if (!isImage(value)) return []; | ||||
|           return [{ relationTo: Collections.Images, value: convertImageToEndpointImage(value) }]; | ||||
|  | ||||
| @ -3,6 +3,7 @@ import { ArrayField } from "payload/types"; | ||||
| import { Collections } from "../../constants"; | ||||
| import { Credits } from "../../types/collections"; | ||||
| import { hasDuplicates, isDefined, isPayloadType, isUndefined } from "../../utils/asserts"; | ||||
| import { rowField } from "../rowField/rowField"; | ||||
| 
 | ||||
| type Props = Omit<ArrayField, "type" | "fields">; | ||||
| 
 | ||||
| @ -31,13 +32,15 @@ export const creditsField = ({ validate, admin, ...props }: Props): ArrayField = | ||||
|     return true; | ||||
|   }, | ||||
|   fields: [ | ||||
|     { name: "role", type: "relationship", relationTo: Collections.CreditsRole, required: true }, | ||||
|     { | ||||
|       name: "recorders", | ||||
|       type: "relationship", | ||||
|       relationTo: Collections.Recorders, | ||||
|       required: true, | ||||
|       hasMany: true, | ||||
|     }, | ||||
|     rowField([ | ||||
|       { name: "role", type: "relationship", relationTo: Collections.CreditsRole, required: true }, | ||||
|       { | ||||
|         name: "recorders", | ||||
|         type: "relationship", | ||||
|         relationTo: Collections.Recorders, | ||||
|         required: true, | ||||
|         hasMany: true, | ||||
|       }, | ||||
|     ]), | ||||
|   ], | ||||
| }); | ||||
|  | ||||
| @ -232,7 +232,7 @@ const convertAttributeToEndpointAttribute = ( | ||||
|       const { slug, icon, translations } = name; | ||||
|       return { | ||||
|         slug, | ||||
|         icon: icon ?? "material-symbols:category-outline", | ||||
|         icon: icon ?? "material-symbols:category", | ||||
|         translations: translations.map(({ language, name }) => ({ | ||||
|           language: isPayloadType(language) ? language.id : language, | ||||
|           name, | ||||
| @ -249,7 +249,7 @@ const convertAttributeToEndpointAttribute = ( | ||||
|       const { slug, icon, translations } = name; | ||||
|       return { | ||||
|         slug, | ||||
|         icon: icon ?? "material-symbols:category-outline", | ||||
|         icon: icon ?? "material-symbols:category", | ||||
|         translations: translations.map(({ language, name }) => ({ | ||||
|           language: isPayloadType(language) ? language.id : language, | ||||
|           name, | ||||
| @ -268,7 +268,7 @@ const convertAttributeToEndpointAttribute = ( | ||||
| 
 | ||||
|       return { | ||||
|         slug, | ||||
|         icon: icon ?? "material-symbols:category-outline", | ||||
|         icon: icon ?? "material-symbols:category", | ||||
|         translations: translations.map(({ language, name }) => ({ | ||||
|           language: isPayloadType(language) ? language.id : language, | ||||
|           name, | ||||
| @ -286,7 +286,6 @@ export const convertSizesToPayloadImages = ( | ||||
|   sizes: (Nullable<PayloadImage> | undefined)[], | ||||
|   targetSizes: number[] | ||||
| ): PayloadImage[] => { | ||||
|   if (!sizes) return []; | ||||
|   const processedSizes = sizes.filter(isPayloadImage); | ||||
| 
 | ||||
|   const images: PayloadImage[] = []; | ||||
| @ -308,6 +307,7 @@ export const convertSizesToPayloadImages = ( | ||||
|     images.push(smallestImage); | ||||
|   } | ||||
| 
 | ||||
| 
 | ||||
|   return images; | ||||
| }; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 DrMint
						DrMint