Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@strict_classproperty
@staticmethod
def __auto_table_args():
default_inheriting = 'not (is_default and protection_mode != {})'.format(ProtectionMode.inheriting.value)
return (db.CheckConstraint(default_inheriting, 'default_inheriting'),
db.CheckConstraint('is_default = (title IS NULL)', 'default_or_title'),
db.CheckConstraint('not (is_default and is_deleted)', 'default_not_deleted'),
db.CheckConstraint('not (is_hidden and is_always_visible)', 'is_hidden_not_is_always_visible'),
{'schema': 'attachments'})
@declared_attr
def __table_args__(cls):
return auto_table_args(cls)
#: The ID of the folder
id = db.Column(
db.Integer,
primary_key=True
)
#: The name of the folder (``None`` for the default folder)
title = db.Column(
db.String,
nullable=True
)
#: The description of the folder
description = db.Column(
db.Text,
nullable=False,
default=''
)
#: If the folder has been deleted
is_deleted = db.Column(
id = db.Column(
db.Integer,
primary_key=True
)
user_id = db.Column(
db.Integer,
db.ForeignKey('users.users.id'),
nullable=False,
index=True
)
type = db.Column(
db.String,
nullable=False
)
role = db.Column(
db.String,
nullable=False
)
data = db.Column(
JSON,
nullable=False
)
# relationship backrefs:
# - user (User.linked_objects)
@return_ascii
def __repr__(self):
return ''.format(self.id, self.user_id, self.type, self.role, self.data)
@cached_property
def object(self):
# - revisions (EditingRevision.tags)
@property
def verbose_title(self):
"""Properly formatted title, including tag code."""
return '{}: {}'.format(self.code, self.title)
@return_ascii
def __repr__(self):
return format_repr(self, 'id', 'event_id', system=False, _text=self.title)
db.Table(
'revision_tags',
db.metadata,
db.Column(
'revision_id',
db.ForeignKey('event_editing.revisions.id'),
primary_key=True,
autoincrement=False,
index=True
),
db.Column(
'tag_id',
db.ForeignKey('event_editing.tags.id'),
primary_key=True,
autoincrement=False,
index=True
),
schema='event_editing'
)
db.ForeignKey('roombooking.reservations.id'),
nullable=False,
primary_key=True
)
start_dt = db.Column(
db.DateTime,
nullable=False,
primary_key=True,
index=True
)
end_dt = db.Column(
db.DateTime,
nullable=False,
index=True
)
notification_sent = db.Column(
db.Boolean,
nullable=False,
default=False
)
state = db.Column(
PyIntEnum(ReservationOccurrenceState),
nullable=False,
default=ReservationOccurrenceState.valid
)
rejection_reason = db.Column(
db.String,
nullable=True
)
# relationship backrefs:
# - reservation (Reservation.occurrences)
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Indico;if not, see .
"""
Dates to skip in a reservation
"""
from indico.core.db import db
class ReservationExcludedDay(db.Model):
__tablename__ = 'reservation_excluded_days'
excluded_day = db.Column(
db.Date,
nullable=False,
primary_key=True
)
reservation_id = db.Column(
db.Integer,
db.ForeignKey('reservations.id'),
nullable=False,
primary_key=True
)
def __repr__(self):
return ''.format(
self.reservation_id,
self.excluded_day
default=False
)
#: Whether users must be logged in to register
require_login = db.Column(
db.Boolean,
nullable=False,
default=True
)
#: Whether registrations must be associated with an Indico account
require_user = db.Column(
db.Boolean,
nullable=False,
default=True
)
#: Maximum number of registrations allowed
registration_limit = db.Column(
db.Integer,
nullable=True
)
#: Whether registrations must be approved by a manager
moderation_enabled = db.Column(
db.Boolean,
nullable=False,
default=False
)
#: Whether the notifications for this event are enabled
notifications_enabled = db.Column(
db.Boolean,
nullable=False,
default=False
)
#: List of emails that should be notified on specific events
accepted = 1
rejected = 2
#: agreement accepted on behalf of the person
accepted_on_behalf = 3
#: agreement rejected on behalf of the person
rejected_on_behalf = 4
class Agreement(db.Model):
"""Agreements between a person and Indico"""
__tablename__ = 'agreements'
__table_args__ = (db.UniqueConstraint('event_id', 'type', 'identifier'),
{'schema': 'events'})
#: Entry ID
id = db.Column(
db.Integer,
primary_key=True
)
#: Entry universally unique ID
uuid = db.Column(
db.String,
nullable=False
)
#: ID of the event
event_id = db.Column(
db.Integer,
db.ForeignKey('events.events.id'),
nullable=False,
index=True
)
#: Type of agreement
}[input.__class__.__name__]
class OldPaymentTransaction(db.Model):
__tablename__ = 'payment_transactions_old'
__table_args__ = {'schema': 'events'}
id = db.Column(db.Integer, primary_key=True)
event_id = db.Column(db.Integer)
registrant_id = db.Column(db.Integer)
status = db.Column(PyIntEnum(TransactionStatus))
amount = db.Column(db.Numeric(8, 2))
currency = db.Column(db.String)
provider = db.Column(db.String)
timestamp = db.Column(UTCDateTime)
data = db.Column(JSON)
def __repr__(self):
return format_repr(self, 'id', 'registrant_id', 'status', 'provider', 'amount', 'currency', 'timestamp')
class RegformMigration(object):
def __init__(self, importer, event, old_regform):
self.importer = importer
self.event = event
self.old_regform = old_regform
self.regform = None
self.transactions = defaultdict(list)
self.section_map = {}
self.field_map = {}
self.status_map = {}
self.emails = set()
nullable=False
)
is_default = db.Column(
db.Boolean,
nullable=False,
default=False
)
top_left_latitude = db.Column(
db.Float,
nullable=False
)
top_left_longitude = db.Column(
db.Float,
nullable=False
)
bottom_right_latitude = db.Column(
db.Float,
nullable=False
)
bottom_right_longitude = db.Column(
db.Float,
nullable=False
)
@return_ascii
def __repr__(self):
return format_repr(self, 'id', 'name', is_default=False)
__table_args__ = (db.UniqueConstraint('date', 'location_id'),
{'schema': 'roombooking'})
id = db.Column(
db.Integer,
primary_key=True
)
date = db.Column(
db.Date,
nullable=False,
index=True
)
name = db.Column(
db.String
)
location_id = db.Column(
db.Integer,
db.ForeignKey('roombooking.locations.id'),
nullable=False
)
# relationship backrefs:
# - location (Location.holidays)
@return_ascii
def __repr__(self):
return u''.format(self.id, self.date, self.name or 'n/a', self.location.name)