Small front corrections
This commit is contained in:
@@ -21,7 +21,7 @@ def get_crud_router(model: CrudDocument, model_create: Writer, model_read: Reade
|
|||||||
async def create(schema: model_create, reg=Depends(get_authed_tenant_registry)) -> model_read:
|
async def create(schema: model_create, reg=Depends(get_authed_tenant_registry)) -> model_read:
|
||||||
await schema.validate_foreign_key(reg.db)
|
await schema.validate_foreign_key(reg.db)
|
||||||
record = await model.create(reg.db, schema)
|
record = await model.create(reg.db, schema)
|
||||||
return model_read.validate_model(record)
|
return model_read.from_model(record)
|
||||||
|
|
||||||
@router.get("/{record_id}", response_description=f"{model_name} record retrieved")
|
@router.get("/{record_id}", response_description=f"{model_name} record retrieved")
|
||||||
async def read_one(record_id: PydanticObjectId, reg=Depends(get_authed_tenant_registry)) -> model_read:
|
async def read_one(record_id: PydanticObjectId, reg=Depends(get_authed_tenant_registry)) -> model_read:
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
legacy-peer-deps=true
|
legacy-peer-deps=true
|
||||||
strict-peer-dependencies=false
|
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
import {FormContextType, getTemplate, RJSFSchema, StrictRJSFSchema, WidgetProps} from "@rjsf/utils";
|
import React from "react";
|
||||||
|
import { FormContextType, getTemplate, RJSFSchema, WidgetProps } from "@rjsf/utils";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import ForeignKeyWidget from "./foreign-key";
|
import ForeignKeyWidget from "./foreign-key";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
export default function CrudTextWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
export type CrudTextRJSFSchema = RJSFSchema & { props? : any };
|
||||||
|
|
||||||
|
export default function CrudTextWidget<T = any, S extends CrudTextRJSFSchema = CrudTextRJSFSchema, F extends FormContextType = any>(
|
||||||
props: WidgetProps<T, S, F>
|
props: WidgetProps<T, S, F>
|
||||||
) {
|
) {
|
||||||
const { schema } = props;
|
const { schema } = props;
|
||||||
if (schema.hasOwnProperty("foreign_key")) {
|
if (schema.hasOwnProperty("foreign_key")) {
|
||||||
return (<ForeignKeyWidget {...props} />);
|
return <ForeignKeyWidget {...props} />;
|
||||||
} else if (schema.hasOwnProperty("const")) {
|
} else if (schema.hasOwnProperty("const")) {
|
||||||
return <Typography >{schema.const as string}</Typography>;
|
return <Typography >{schema.const as string}</Typography>;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ const Edit = <T,>(props: EditProps) => {
|
|||||||
const { schemaName, resource, uiSchema } = props;
|
const { schemaName, resource, uiSchema } = props;
|
||||||
const { record_id } = useParams();
|
const { record_id } = useParams();
|
||||||
|
|
||||||
console.log(record_id);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CrudForm
|
<CrudForm
|
||||||
schemaName={schemaName}
|
schemaName={schemaName}
|
||||||
|
|||||||
Reference in New Issue
Block a user