fix: add Employee model for lane_op

with abstract common base schema
This commit is contained in:
Lance Edgar 2025-01-24 19:21:00 -06:00
parent 97fb0b28cb
commit c3b639390d
3 changed files with 71 additions and 27 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# pyCOREPOS -- Python Interface to CORE POS
# Copyright © 2018-2024 Lance Edgar
# Copyright © 2018-2025 Lance Edgar
#
# This file is part of pyCOREPOS.
#
@ -31,6 +31,8 @@ import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.ext.associationproxy import association_proxy
from corepos.db.common import op as common
log = logging.getLogger(__name__)
@ -991,35 +993,12 @@ class ProductPhysicalLocation(Base):
location = sa.Column(sa.SmallInteger(), nullable=True, default=0)
class Employee(Base):
class Employee(common.EmployeeBase, Base):
"""
Represents an employee within the organization.
Data model for ``employees`` table.
"""
__tablename__ = 'employees'
number = sa.Column('emp_no', sa.SmallInteger(), primary_key=True, autoincrement=False, nullable=False)
cashier_password = sa.Column('CashierPassword', sa.String(length=50), nullable=True)
admin_password = sa.Column('AdminPassword', sa.String(length=50), nullable=True)
first_name = sa.Column('FirstName', sa.String(length=255), nullable=True)
last_name = sa.Column('LastName', sa.String(length=255), nullable=True)
job_title = sa.Column('JobTitle', sa.String(length=255), nullable=True)
active = sa.Column('EmpActive', sa.Boolean(), nullable=True)
frontend_security = sa.Column('frontendsecurity', sa.SmallInteger(), nullable=True)
backend_security = sa.Column('backendsecurity', sa.SmallInteger(), nullable=True)
birth_date = sa.Column('birthdate', sa.DateTime(), nullable=True)
def __str__(self):
return ' '.join([self.first_name or '', self.last_name or '']).strip()
class MemberType(Base):
"""