models
Models.
This module contains the data models for the tool inventory application. It includes models for creating, updating, and representing tools.
Tool
¶
Bases: SQLModel
Tool model.
Source code in src/tool_inventory/models.py
ToolCreate
pydantic-model
¶
Bases: BaseModel
Tool creation model.
Show JSON schema:
{
"description": "Tool creation model.",
"properties": {
"name": {
"minLength": 1,
"title": "Name",
"type": "string"
},
"quantity": {
"minimum": 0,
"title": "Quantity",
"type": "integer"
},
"description": {
"default": "",
"title": "Description",
"type": "string"
},
"image": {
"default": "",
"title": "Image",
"type": "string"
}
},
"required": [
"name",
"quantity"
],
"title": "ToolCreate",
"type": "object"
}
Fields:
-
name(str) -
quantity(int) -
description(str) -
image(str)
Source code in src/tool_inventory/models.py
ToolPatch
pydantic-model
¶
Bases: BaseModel
Tool patch model.
Show JSON schema:
{
"description": "Tool patch model.",
"properties": {
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"quantity": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Quantity"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Description"
},
"image": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Image"
}
},
"title": "ToolPatch",
"type": "object"
}
Fields:
-
name(str | None) -
quantity(int | None) -
description(str | None) -
image(str | None)
Source code in src/tool_inventory/models.py
patch
¶
Patch a tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool
|
Tool
|
The tool to patch. |
required |
Returns:
| Type | Description |
|---|---|
Tool
|
The patched tool. |