Importing RJSF lib with first application
This commit is contained in:
28
api/rpk-api/hub/firm/__init__.py
Normal file
28
api/rpk-api/hub/firm/__init__.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from beanie import PydanticObjectId
|
||||
from pydantic import Field, BaseModel
|
||||
from pymongo import IndexModel
|
||||
|
||||
from hub import CrudDocument
|
||||
|
||||
class Firm(CrudDocument):
|
||||
name: str = Field()
|
||||
instance: str = Field()
|
||||
owner: PydanticObjectId = Field()
|
||||
|
||||
def compute_label(self) -> str:
|
||||
return self.name
|
||||
|
||||
class Settings:
|
||||
indexes = [
|
||||
IndexModel(["name", "instance"], unique=True),
|
||||
]
|
||||
|
||||
class FirmRead(BaseModel):
|
||||
instance: str = Field()
|
||||
name: str = Field()
|
||||
|
||||
class FirmCreate(FirmRead):
|
||||
pass
|
||||
|
||||
class FirmUpdate(FirmRead):
|
||||
pass
|
||||
Reference in New Issue
Block a user