Small front corrections

This commit is contained in:
2025-04-20 13:58:32 +02:00
parent 2249791267
commit 8f950ed665
4 changed files with 9 additions and 8 deletions

View File

@@ -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:
await schema.validate_foreign_key(reg.db)
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")
async def read_one(record_id: PydanticObjectId, reg=Depends(get_authed_tenant_registry)) -> model_read:

View File

@@ -1,2 +1 @@
legacy-peer-deps=true
strict-peer-dependencies=false

View File

@@ -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 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>
) {
const { schema } = props;
if (schema.hasOwnProperty("foreign_key")) {
return (<ForeignKeyWidget {...props} />);
return <ForeignKeyWidget {...props} />;
} else if (schema.hasOwnProperty("const")) {
return <Typography >{schema.const as string}</Typography>;
} else {

View File

@@ -12,8 +12,6 @@ const Edit = <T,>(props: EditProps) => {
const { schemaName, resource, uiSchema } = props;
const { record_id } = useParams();
console.log(record_id);
return (
<CrudForm
schemaName={schemaName}