Skip to content
Snippets Groups Projects
Commit f1817685a9fb authored by François Ferry's avatar François Ferry
Browse files

feat(schema): remove yams and make schema simpler

parent 96f22069787a
No related branches found
No related tags found
1 merge request!13Topic/default/form helper
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
EntitiesSchemas, EntitiesSchemas,
RelationDefinition, RelationDefinition,
Schema, Schema,
yams,
} from "ra-cubicweb/dist/Schema"; } from "ra-cubicweb/dist/Schema";
function makeSchema< function makeSchema<
...@@ -19,9 +18,9 @@ ...@@ -19,9 +18,9 @@
export const [schema, types] = makeSchema({ export const [schema, types] = makeSchema({
entities: { entities: {
Museum: { Museum: {
name: yams.String(), name: { type: "String", required: true },
latitude: yams.Float(), latitude: { type: "Float" },
longitude: yams.Float(), longitude: { type: "Float" },
postal_address: yams.String(), postal_address: { type: "String" },
}, },
City: { City: {
...@@ -26,6 +25,6 @@ ...@@ -26,6 +25,6 @@
}, },
City: { City: {
name: yams.String(), name: { type: "String" },
zip_code: yams.Int(), zip_code: { type: "Int" },
}, },
Person: { Person: {
...@@ -30,7 +29,7 @@ ...@@ -30,7 +29,7 @@
}, },
Person: { Person: {
name: yams.String(), name: { type: "String" },
email: yams.String(), email: { type: "String" },
}, },
}, },
relationsDefinitions: [ relationsDefinitions: [
......
export const yams = { export type BuildObj = {
String: () => ({ type: "String" } as const), type: "String" | "Date" | "Float" | "Int" | "Boolean";
Date: () => ({ type: "Date" } as const), required?: boolean;
Float: () => ({ type: "Float" } as const), };
Int: () => ({ type: "Int" } as const),
Boolean: () => ({ type: "Boolean" } as const),
} as const;
export type BuildObj = ReturnType<typeof yams[keyof typeof yams]>;
export type Cardinality = "*" | "1" | "?" | "+"; export type Cardinality = "*" | "1" | "?" | "+";
......
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