fix(SW-190): added imageVaultAsset schema

This commit is contained in:
Erik Tiekstra
2024-08-15 14:19:52 +02:00
parent 4f2bd0c2d6
commit 771338cc80
15 changed files with 164 additions and 149 deletions

View File

@@ -0,0 +1,95 @@
import { z } from "zod"
const metaData = z.object({
DefinitionType: z.number().nullable().optional(),
Description: z.string().nullable(),
LanguageId: z.number().nullable(),
MetadataDefinitionId: z.number(),
Name: z.string(),
Value: z.string().nullable(),
})
/**
* Defines a media asset, original or conversion
*/
const mediaConversion = z.object({
/**
* Aspect ratio of the conversion
*/
AspectRatio: z.number(),
/**
* Content type of the conversion
*/
ContentType: z.string(),
/**
* Aspect ratio of the selected/requested format
*/
FormatAspectRatio: z.number(),
/**
* Height of the selected/requested format
*/
FormatHeight: z.number(),
/**
* Width of the selected/requested format
*/
FormatWidth: z.number(),
/**
* Height, in pixels, of the conversion
*/
Height: z.number(),
/**
* Html representing the conversion
*/
Html: z.string(),
/**
* Id of the selected media format
*/
MediaFormatId: z.number(),
/**
* Name of the media format
*/
MediaFormatName: z.string(),
/**
* Name of the conversion
*/
Name: z.string(),
/**
* The url to the conversion
*/
Url: z.string(),
/**
* Width, in pixels, of the conversion
*/
Width: z.number(),
})
/**
* The response from ImageVault when inserting an asset
*/
export const imageVaultAssetSchema = z.object({
/**
* The media item id of the asset
*/
Id: z.number(),
/**
* The id of the vault where the asset resides
*/
VaultId: z.number(),
/**
* The name of the asset
*/
Name: z.string(),
/**
* The conversion selected by the user. Is an array but will only contain one object
*/
MediaConversions: z.array(mediaConversion),
Metadata: z.array(metaData),
/**
* Date when the asset was added to ImageVault
*/
DateAdded: z.string(),
/**
* Name of the user that added the asset to ImageVault
*/
AddedBy: z.string(),
})