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