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 @@
EntitiesSchemas,
RelationDefinition,
Schema,
yams,
} from "ra-cubicweb/dist/Schema";
function makeSchema<
......@@ -19,9 +18,9 @@
export const [schema, types] = makeSchema({
entities: {
Museum: {
name: yams.String(),
latitude: yams.Float(),
longitude: yams.Float(),
postal_address: yams.String(),
name: { type: "String", required: true },
latitude: { type: "Float" },
longitude: { type: "Float" },
postal_address: { type: "String" },
},
City: {
......@@ -26,6 +25,6 @@
},
City: {
name: yams.String(),
zip_code: yams.Int(),
name: { type: "String" },
zip_code: { type: "Int" },
},
Person: {
......@@ -30,7 +29,7 @@
},
Person: {
name: yams.String(),
email: yams.String(),
name: { type: "String" },
email: { type: "String" },
},
},
relationsDefinitions: [
......
export const yams = {
String: () => ({ type: "String" } as const),
Date: () => ({ type: "Date" } as const),
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 BuildObj = {
type: "String" | "Date" | "Float" | "Int" | "Boolean";
required?: boolean;
};
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