Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/production' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
daneryl committed Sep 26, 2024
2 parents 717600e + 21a515f commit 393c446
Show file tree
Hide file tree
Showing 13 changed files with 648 additions and 38 deletions.
88 changes: 88 additions & 0 deletions app/api/entities.v2/EntityInputDataSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { availableLanguagesISO6391 } from 'shared/languagesList';

const linkSchema = {
type: 'object',
additionalProperties: false,
required: ['label', 'url'],
properties: {
label: { oneOf: [{ type: 'string' }, { type: 'null' }] },
url: { oneOf: [{ type: 'string' }, { type: 'null' }] },
},
};

const dateRangeSchema = {
type: 'object',
additionalProperties: false,
required: ['from', 'to'],
properties: {
from: { oneOf: [{ type: 'number' }, { type: 'null' }] },
to: { oneOf: [{ type: 'number' }, { type: 'null' }] },
},
};

const latLonSchema = {
type: 'object',
required: ['lon', 'lat'],
additionalProperties: false,
properties: {
label: { type: 'string' },
lat: { type: 'number', minimum: -90, maximum: 90 },
lon: { type: 'number', minimum: -180, maximum: 180 },
},
};

const geolocationSchema = {
type: 'array',
items: latLonSchema,
};

const propertyValueSchema = {
definitions: { linkSchema, dateRangeSchema, latLonSchema },
oneOf: [
{ type: 'null' },
{ type: 'string' },
{ type: 'number' },
{ type: 'boolean' },
linkSchema,
dateRangeSchema,
latLonSchema,
geolocationSchema,
],
};

const metadataObjectSchema = {
type: 'object',
definitions: { propertyValueSchema },
required: ['value'],
properties: {
value: propertyValueSchema,
},
};

const metadataSchema = {
type: 'object',
definitions: { metadataObjectSchema },
additionalProperties: {
anyOf: [{ type: 'array', items: metadataObjectSchema }],
},
patternProperties: {
'^.*_nested$': { type: 'array', items: { type: 'object' } },
},
};

export const entityInputDataSchema = {
title: 'EntityInputData',
$schema: 'http://json-schema.org/schema#',
type: 'object',
required: ['_id', 'sharedId', 'language', 'title', 'template', 'metadata'],
properties: {
_id: { type: 'string' },
sharedId: { type: 'string', minLength: 1 },
language: { enum: availableLanguagesISO6391 },
title: { type: 'string', minLength: 1 },
template: { type: 'string' },
metadata: metadataSchema,
},
};

export const emitSchemaTypes = true;
227 changes: 227 additions & 0 deletions app/api/entities.v2/EntityInputDataType.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
/* eslint-disable */
/**AUTO-GENERATED. RUN yarn emit-types to update.*/

export interface EntityInputData {
_id: string;
sharedId: string;
language:
| 'ab'
| 'aa'
| 'af'
| 'ak'
| 'sq'
| 'am'
| 'ar'
| 'an'
| 'hy'
| 'as'
| 'av'
| 'ae'
| 'ay'
| 'az'
| 'bm'
| 'ba'
| 'eu'
| 'be'
| 'bn'
| 'bh'
| 'bi'
| 'bs'
| 'br'
| 'bg'
| 'my'
| 'ca'
| 'ch'
| 'ce'
| 'ny'
| 'zh'
| 'zh-Hans'
| 'zh-Hant'
| 'cv'
| 'kw'
| 'co'
| 'cr'
| 'hr'
| 'cs'
| 'da'
| 'dv'
| 'nl'
| 'dz'
| 'en'
| 'eo'
| 'et'
| 'ee'
| 'fo'
| 'fj'
| 'fi'
| 'fr'
| 'ff'
| 'gl'
| 'gd'
| 'gv'
| 'ka'
| 'de'
| 'el'
| 'gn'
| 'gu'
| 'ht'
| 'ha'
| 'he'
| 'hz'
| 'hi'
| 'ho'
| 'hu'
| 'is'
| 'io'
| 'ig'
| 'in'
| 'ia'
| 'ie'
| 'iu'
| 'ik'
| 'ga'
| 'it'
| 'ja'
| 'jv'
| 'kl'
| 'kn'
| 'kr'
| 'ks'
| 'kk'
| 'km'
| 'ki'
| 'rw'
| 'rn'
| 'ky'
| 'kv'
| 'kg'
| 'ko'
| 'ku'
| 'kj'
| 'lo'
| 'la'
| 'lv'
| 'li'
| 'ln'
| 'lt'
| 'lu'
| 'lg'
| 'lb'
| 'mk'
| 'mg'
| 'ms'
| 'ml'
| 'mt'
| 'mi'
| 'mr'
| 'mh'
| 'mn'
| 'na'
| 'nv'
| 'ng'
| 'nd'
| 'ne'
| 'no'
| 'nb'
| 'nn'
| 'oc'
| 'oj'
| 'cu'
| 'or'
| 'om'
| 'os'
| 'pi'
| 'ps'
| 'fa'
| 'pl'
| 'pt'
| 'pa'
| 'qu'
| 'rm'
| 'ro'
| 'ru'
| 'se'
| 'sm'
| 'sg'
| 'sa'
| 'sr'
| 'sh'
| 'st'
| 'tn'
| 'sn'
| 'ii'
| 'sd'
| 'si'
| 'ss'
| 'sk'
| 'sl'
| 'so'
| 'nr'
| 'es'
| 'su'
| 'sw'
| 'sv'
| 'tl'
| 'ty'
| 'tg'
| 'ta'
| 'tt'
| 'te'
| 'th'
| 'bo'
| 'ti'
| 'to'
| 'ts'
| 'tr'
| 'tk'
| 'tw'
| 'ug'
| 'uk'
| 'ur'
| 'uz'
| 've'
| 'vi'
| 'vo'
| 'wa'
| 'cy'
| 'wo'
| 'fy'
| 'xh'
| 'yi'
| 'yo'
| 'za'
| 'zu';
title: string;
template: string;
metadata: {
[k: string]:
| {
value:
| null
| string
| number
| boolean
| {
label: string | null;
url: string | null;
}
| {
from: number | null;
to: number | null;
}
| {
label?: string;
lat: number;
lon: number;
}
| {
label?: string;
lat: number;
lon: number;
}[];
[k: string]: unknown | undefined;
}[]
| undefined;
};
[k: string]: unknown | undefined;
}
Loading

0 comments on commit 393c446

Please sign in to comment.