- Partner model additions

- menu changes to allow for partners
- partner views and forms now in partner_forms.py and partner_views.py
- Introduction of services layer
- Allow all configuration to handle partner configurations, and adaptation of caching to allow for this
This commit is contained in:
Josako
2025-05-02 13:10:59 +02:00
parent 9652d0bff9
commit 6ef025363d
72 changed files with 1342 additions and 228 deletions

View File

@@ -211,7 +211,8 @@ class Partner(db.Model):
'type': service.type,
'type_version': service.type_version,
'active': service.active,
'configuration': service.configuration
'configuration': service.configuration,
'permissions': service.permissions,
})
return {
'id': self.id,
@@ -250,15 +251,16 @@ class PartnerService(db.Model):
system_metadata = db.Column(db.JSON, nullable=True)
user_metadata = db.Column(db.JSON, nullable=True)
# Relationships
partner = db.relationship('Partner', back_populates='services')
# Versioning Information
created_at = db.Column(db.DateTime, nullable=False, server_default=db.func.now())
created_by = db.Column(db.Integer, db.ForeignKey('public.user.id'), nullable=True)
updated_at = db.Column(db.DateTime, nullable=False, server_default=db.func.now(), onupdate=db.func.now())
updated_by = db.Column(db.Integer, db.ForeignKey('public.user.id'), nullable=True)
# Relationships
partner = db.relationship('Partner', back_populates='services')
license_tiers = db.relationship('PartnerServiceLicenseTier', back_populates='partner_service')
class PartnerTenant(db.Model):
__bind_key__ = 'public'
@@ -267,9 +269,6 @@ class PartnerTenant(db.Model):
partner_service_id = db.Column(db.Integer, db.ForeignKey('public.partner_service.id'), primary_key=True)
tenant_id = db.Column(db.Integer, db.ForeignKey('public.tenant.id'), primary_key=True)
# Relationship type
relationship_type = db.Column(db.String(20), nullable=False) # REFERRED, MANAGED, WHITE_LABEL
# JSONB for flexible configuration specific to this relationship
configuration = db.Column(db.JSON, nullable=True)