Overview
TheFurnitureType model represents different categories of furniture products (e.g., tables, chairs, cabinets). It provides categorization for the furniture catalog.
Table Name: furniture_type
Fields
Primary Key
Unique identifier for the furniture type. Auto-incremented primary key.
Core Fields
Name of the furniture type (e.g., “Table”, “Chair”, “Cabinet”). Must be unique.Constraints:
- Maximum length: 50 characters
- Unique: true
- Nullable: false
Indicates whether the furniture type is active in the system.Default:
trueAudit Trail Fields
Timestamp when the furniture type was created.Default: Current timestamp (server-side)
Timestamp when the furniture type was last updated. Automatically updated on record modification.Default: Current timestamp (server-side)On Update: Automatically set to current timestamp
Timestamp when the furniture type was soft-deleted.
NULL if the record is not deleted.Username or identifier of the user who created the furniture type.
Username or identifier of the user who last updated the furniture type.
Username or identifier of the user who soft-deleted the furniture type.
Methods
to_dict()
Serializes the FurnitureType model instance to a dictionary format suitable for JSON responses. Returns:dict
The furniture type’s unique identifier
The furniture type name
Active status of the furniture type
ISO 8601 formatted creation timestamp
ISO 8601 formatted last update timestamp
Model Source Code
Notes
- The model implements soft delete functionality via the
deleted_atfield - Timestamps are managed automatically by the database
- The
to_dict()method excludes soft-delete audit fields from the response - Used for categorizing furniture products in the catalog