From ac60c1955195763fa0f4c97f8d4d718c62889109 Mon Sep 17 00:00:00 2001 From: Brian Wiborg Date: Sun, 28 Sep 2025 01:48:03 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Remove=20Model.Schema.many?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ohmyapi/db/model/model.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/ohmyapi/db/model/model.py b/src/ohmyapi/db/model/model.py index 2bbc557..d005e43 100644 --- a/src/ohmyapi/db/model/model.py +++ b/src/ohmyapi/db/model/model.py @@ -11,30 +11,18 @@ class ModelMeta(type(TortoiseModel)): class BoundSchema: @property - def one(self): + def model(self): """Return a Pydantic model class for 'one' results.""" include = getattr(schema_opts, "include", None) exclude = getattr(schema_opts, "exclude", None) return pydantic_model_creator( new_cls, - name=f"{new_cls.__name__}SchemaOne", + name=f"{new_cls.__name__}Schema", include=include, exclude=exclude, exclude_readonly=True, ) - @property - def many(self): - """Return a Pydantic queryset class for 'many' results.""" - include = getattr(schema_opts, "include", None) - exclude = getattr(schema_opts, "exclude", None) - return pydantic_queryset_creator( - new_cls, - name=f"{new_cls.__name__}SchemaMany", - include=include, - exclude=exclude, - ) - new_cls.Schema = BoundSchema() return new_cls