Skip to content
Snippets Groups Projects
Commit f6dc40f2 authored by Tadeusz Miesiąc's avatar Tadeusz Miesiąc
Browse files

refactor(models): changed union with null to nullable to follow zod guidlines

parent f43cafb1
No related branches found
No related tags found
2 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!39Feature/connect bio entity endpoint
......@@ -18,7 +18,7 @@ export const bioEntitySchema = z.object({
references: z.array(referenceSchema),
z: z.number(),
notes: z.string(),
symbol: z.union([z.string(), z.null()]),
symbol: z.string().nullable(),
homodimer: z.number(),
nameX: z.number(),
nameY: z.number(),
......@@ -33,23 +33,23 @@ export const bioEntitySchema = z.object({
synonyms: z.array(z.string()),
formerSymbols: z.array(z.string()),
fullName: z.string(),
abbreviation: z.union([z.string(), z.null()]),
formula: z.union([z.string(), z.null()]),
glyph: z.union([glyphSchema, z.null()]),
abbreviation: z.string().nullable(),
formula: z.string().nullable(),
glyph: glyphSchema.nullable(),
activity: z.boolean(),
structuralState: z.union([structuralStateSchema, z.null()]),
hypothetical: z.union([z.boolean(), z.null()]),
structuralState: structuralStateSchema.nullable(),
hypothetical: z.boolean().nullable(),
boundaryCondition: z.boolean(),
constant: z.boolean(),
initialAmount: z.union([z.number(), z.null()]),
initialConcentration: z.union([z.number(), z.null()]),
charge: z.union([z.number(), z.null()]),
substanceUnits: z.union([z.string(), z.null()]),
initialAmount: z.number().nullable(),
initialConcentration: z.number().nullable(),
charge: z.number().nullable(),
substanceUnits: z.string().nullable(),
onlySubstanceUnits: z.boolean(),
modificationResidues: z.optional(z.array(modificationResiduesSchema)),
complex: z.union([z.number(), z.null()]),
compartment: z.union([z.number(), z.null()]),
submodel: z.union([submodelSchema, z.null()]),
complex: z.number().nullable(),
compartment: z.number().nullable(),
submodel: submodelSchema.nullable(),
x: z.number(),
y: z.number(),
lineWidth: z.number(),
......@@ -70,11 +70,11 @@ export const bioEntitySchema = z.object({
upperBound: z.optional(z.boolean()),
subsystem: z.optional(z.string()),
geneProteinReaction: z.optional(z.string()),
kinetics: z.union([z.null(), z.undefined()]),
products: z.union([z.array(productsSchema), z.undefined()]),
reactants: z.union([z.array(productsSchema), z.undefined()]),
modifiers: z.union([z.array(productsSchema), z.undefined()]),
processCoordinates: z.union([z.null(), z.undefined()]),
line: z.union([lineSchema, z.undefined()]),
operators: z.union([z.array(operatorSchema), z.undefined()]),
kinetics: z.optional(z.null()),
products: z.optional(z.array(productsSchema)),
reactants: z.optional(z.array(productsSchema)),
modifiers: z.optional(z.array(productsSchema)),
processCoordinates: z.optional(z.null()),
line: z.optional(lineSchema),
operators: z.optional(z.array(operatorSchema)),
});
......@@ -15,17 +15,17 @@ export const modelSchema = z.object({
/** size of the png tile used to visualize in frontend */
tileSize: z.number(),
/** default x center used in frontend visualization */
defaultCenterX: z.union([z.number(), z.null()]),
defaultCenterX: z.number().nullable(),
/** default y center used in frontend visualization */
defaultCenterY: z.union([z.number(), z.null()]),
defaultCenterY: z.number().nullable(),
/** default zoom level used in frontend visualization */
defaultZoomLevel: z.union([z.number(), z.null()]),
defaultZoomLevel: z.number().nullable(),
/** minimum zoom level availbale for the map */
minZoom: z.number(),
/** maximum zoom level available for the map */
maxZoom: z.number(),
authors: z.array(authorSchema),
references: z.array(referenceSchema),
creationDate: z.union([z.string(), z.null()]),
creationDate: z.string().nullable(),
modificationDates: z.array(z.string()),
});
......@@ -9,7 +9,7 @@ export const modificationResiduesSchema = z.object({
position: positionSchema,
z: z.number(),
borderColor: colorSchema,
state: z.union([z.string(), z.number(), z.null()]),
state: z.union([z.string(), z.number()]).nullable(),
size: z.number(),
elementId: z.string(),
});
......@@ -2,6 +2,6 @@ import { z } from 'zod';
export const productsSchema = z.object({
aliasId: z.number(),
stoichiometry: z.union([z.number(), z.null()]),
type: z.union([z.string(), z.undefined()]),
stoichiometry: z.number().nullable(),
type: z.optional(z.string()),
});
......@@ -2,7 +2,7 @@ import { z } from 'zod';
import { articleSchema } from './articleSchema';
export const referenceSchema = z.object({
link: z.union([z.string(), z.null()]),
link: z.string().nullable(),
article: articleSchema.optional(),
type: z.string(),
resource: z.string(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment