MediaObject.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /** This file is generated based on JSON schema. Do not modify. */
  2. import * as Yup from 'yup';
  3. import { EntityCodec } from '@joystream/types/lib/versioned-store/EntityCodec';
  4. export const MediaObjectValidationSchema = Yup.object().shape({
  5. value: Yup.string()
  6. .required('This field is required')
  7. .max(66, 'Text is too long. Maximum length is 66 chars.')
  8. });
  9. export type MediaObjectFormValues = {
  10. value: string
  11. };
  12. export type MediaObjectType = {
  13. classId: number
  14. inClassSchemaIndexes: number[]
  15. id: number
  16. value: string
  17. };
  18. export class MediaObjectCodec extends EntityCodec<MediaObjectType> { }
  19. export function MediaObjectToFormValues(entity?: MediaObjectType): MediaObjectFormValues {
  20. return {
  21. value: entity && entity.value || ''
  22. }
  23. }
  24. export type MediaObjectPropId =
  25. 'value'
  26. ;
  27. export type MediaObjectGenericProp = {
  28. id: MediaObjectPropId,
  29. type: string,
  30. name: string,
  31. description?: string,
  32. required?: boolean,
  33. maxItems?: number,
  34. maxTextLength?: number,
  35. classId?: any
  36. };
  37. type MediaObjectClassType = {
  38. [id in MediaObjectPropId]: MediaObjectGenericProp
  39. };
  40. export const MediaObjectClass: MediaObjectClassType = {
  41. value: {
  42. "id": "value",
  43. "name": "Value",
  44. "description": "Content id of object in the data directory.",
  45. "type": "Text",
  46. "required": true,
  47. "maxTextLength": 48
  48. }
  49. };