mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 21:14:18 +00:00
19 lines
No EOL
610 B
Python
19 lines
No EOL
610 B
Python
"""
|
|
This module defines the Authorization database class.
|
|
"""
|
|
|
|
from ..base import ext
|
|
|
|
|
|
class Authorization(ext.Model):
|
|
rid = ext.Column(ext.Integer, ext.ForeignKey("repository.id", ondelete="CASCADE"), primary_key=True)
|
|
email = ext.Column(ext.String, ext.ForeignKey("user.email", ondelete="CASCADE"), primary_key=True)
|
|
# Relationships
|
|
repository = ext.relationship("Repository", back_populates="authorizations")
|
|
user = ext.relationship("User", back_populates="authorizations")
|
|
|
|
def to_json(self):
|
|
return {
|
|
"rid": self.rid,
|
|
"email": self.email,
|
|
} |