| 1 | '''
|
|---|
| 2 | Copyright (C) 2019 - 2020 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| 3 |
|
|---|
| 4 | This program is free software: you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation, either version 3 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 16 | '''
|
|---|
| 17 | import flask
|
|---|
| 18 | from flask_sqlalchemy import SQLAlchemy
|
|---|
| 19 | from sqlalchemy import inspect, text, Enum, event, select, func
|
|---|
| 20 | from sqlalchemy.orm.attributes import get_history
|
|---|
| 21 | from geoalchemy2 import Geometry
|
|---|
| 22 | from geoalchemy2.shape import to_shape
|
|---|
| 23 | from sqlalchemy_utc import UtcDateTime
|
|---|
| 24 | from sqlalchemy_utils import create_view, database_exists, create_database
|
|---|
| 25 | import hashlib
|
|---|
| 26 | import datetime
|
|---|
| 27 | import enum
|
|---|
| 28 | import connexion
|
|---|
| 29 | from pathlib import Path
|
|---|
| 30 | import sys
|
|---|
| 31 | import os
|
|---|
| 32 |
|
|---|
| 33 | db = SQLAlchemy()
|
|---|
| 34 |
|
|---|
| 35 | class OsmType(enum.Enum):
|
|---|
| 36 | Node = 1
|
|---|
| 37 | Way = 2
|
|---|
| 38 | Relation = 3
|
|---|
| 39 |
|
|---|
| 40 | def wkb_to_dict(wkbelement):
|
|---|
| 41 | point = to_shape(wkbelement)
|
|---|
| 42 | return {'longitude': point.x, 'latitude': point.y}
|
|---|
| 43 |
|
|---|
| 44 | class User(db.Model):
|
|---|
| 45 | __tablename__ = "users"
|
|---|
| 46 |
|
|---|
| 47 | id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|---|
| 48 | username = db.Column(db.String(255), nullable=False, unique=True)
|
|---|
| 49 | password = db.Column(db.String(50), nullable=False)
|
|---|
| 50 | salt = db.Column(db.String(50), nullable=False)
|
|---|
| 51 | email = db.Column(db.String(255), nullable=False)
|
|---|
| 52 | first_name = db.Column(db.String(255))
|
|---|
| 53 | last_name = db.Column(db.String(255))
|
|---|
| 54 | activated = db.Column(db.Boolean(), default=False)
|
|---|
| 55 | activation_code = db.Column(db.String(255), default='1234')
|
|---|
| 56 | #activation_code = db.Column(db.String(255), server_default=text('LEFT(MD5(NOW()), 50)'))
|
|---|
| 57 | license_accepted = db.Column(db.Boolean(), default=False)
|
|---|
| 58 |
|
|---|
| 59 | def to_dict(user):
|
|---|
| 60 | result = {
|
|---|
| 61 | 'username': user.username,
|
|---|
| 62 | 'password': user.password,
|
|---|
| 63 | 'salt': user.salt,
|
|---|
| 64 | 'email': user.email,
|
|---|
| 65 | 'firstName': "",
|
|---|
| 66 | 'lastName': "",
|
|---|
| 67 | 'activated': user.activated,
|
|---|
| 68 | 'licenseAccepted': user.license_accepted
|
|---|
| 69 | }
|
|---|
| 70 | if user.first_name is not None:
|
|---|
| 71 | result['firstName'] = user.first_name
|
|---|
| 72 | if user.last_name is not None:
|
|---|
| 73 | result['lastName'] = user.last_name
|
|---|
| 74 | if user.activation_code is not None:
|
|---|
| 75 | result['activationCode'] = user.activation_code
|
|---|
| 76 |
|
|---|
| 77 | return result
|
|---|
| 78 |
|
|---|
| 79 | def factory(username, password, email):
|
|---|
| 80 | salt = hashlib.md5('{}{}'.format(username, datetime.datetime.utcnow().strftime('%Y%m%d%H%M%S')).encode()).hexdigest()
|
|---|
| 81 | password = hashlib.md5('{}{}'.format(password, salt).encode()).hexdigest()
|
|---|
| 82 | activation_code = hashlib.md5('{}'.format(datetime.datetime.utcnow().strftime('%Y%m%d%H%M%S')).encode()).hexdigest()
|
|---|
| 83 | return User(username=username, password=password, email=email, salt=salt, activated=False, activation_code=activation_code)
|
|---|
| 84 |
|
|---|
| 85 | def password_verify(self, password):
|
|---|
| 86 | return hashlib.md5("{}{}".format(password, self.salt).encode()).hexdigest() == self.password
|
|---|
| 87 |
|
|---|
| 88 | @staticmethod
|
|---|
| 89 | def loggedin_username():
|
|---|
| 90 | if not 'user' in connexion.context:
|
|---|
| 91 | return None
|
|---|
| 92 | return connexion.context['user']
|
|---|
| 93 |
|
|---|
| 94 | @staticmethod
|
|---|
| 95 | def loggedin_user():
|
|---|
| 96 | username = User.loggedin_username()
|
|---|
| 97 | if username is None:
|
|---|
| 98 | return None
|
|---|
| 99 | user = User.query.filter_by(username=username).all()
|
|---|
| 100 | if len(user) != 1:
|
|---|
| 101 | return None
|
|---|
| 102 | return user[0]
|
|---|
| 103 |
|
|---|
| 104 | class ApiKey(db.Model):
|
|---|
| 105 | __tablename__ = "apikeys"
|
|---|
| 106 |
|
|---|
| 107 | id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|---|
| 108 | user_id = db.Column(db.BigInteger, db.ForeignKey('users.id'))
|
|---|
| 109 | key = db.Column(db.String(255), nullable=False, unique=True)
|
|---|
| 110 | user = db.relationship("User", backref=db.backref("apikeys"), lazy=True)
|
|---|
| 111 |
|
|---|
| 112 | class Water(db.Model):
|
|---|
| 113 | __tablename__ = "waters"
|
|---|
| 114 |
|
|---|
| 115 | id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|---|
| 116 | name = db.Column(db.String(255), nullable=False)
|
|---|
| 117 | manager_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
|---|
| 118 | osm_id = db.Column(db.Integer)
|
|---|
| 119 | osm_type = db.Column(Enum(OsmType))
|
|---|
| 120 | manager = db.relationship("User", backref=db.backref("waters"), lazy=True)
|
|---|
| 121 |
|
|---|
| 122 | def to_dict(obj):
|
|---|
| 123 | result = { 'waterId': obj.id, 'name': obj.name }
|
|---|
| 124 | if obj.manager:
|
|---|
| 125 | result['manager'] = obj.manager.username
|
|---|
| 126 | if obj.osm_id:
|
|---|
| 127 | result['osmId'] = obj.osm_id
|
|---|
| 128 | if obj.osm_type:
|
|---|
| 129 | result['osmType'] = obj.osm_type.name
|
|---|
| 130 | if obj.gauges:
|
|---|
| 131 | result['gauges'] = []
|
|---|
| 132 | for gauge in obj.gauges:
|
|---|
| 133 | result['gauges'].append(gauge.to_dict())
|
|---|
| 134 | if obj.logs:
|
|---|
| 135 | logs = []
|
|---|
| 136 | for log in obj.logs:
|
|---|
| 137 | logs.append(log.meta_data())
|
|---|
| 138 | result['logs'] = logs
|
|---|
| 139 | return result
|
|---|
| 140 |
|
|---|
| 141 | class Gauge(db.Model):
|
|---|
| 142 | __tablename__ = "gauges"
|
|---|
| 143 |
|
|---|
| 144 | id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|---|
| 145 | name = db.Column(db.String(255), nullable=False)
|
|---|
| 146 | manager_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
|---|
| 147 | water_id = db.Column(db.Integer, db.ForeignKey('waters.id'))
|
|---|
| 148 | # POINT(Lon Lat)
|
|---|
| 149 | location = db.Column(Geometry(geometry_type='POINT', srid=4326, management=True))
|
|---|
| 150 | reference_water_level_gauge_height = db.Column(db.Float, nullable = False)
|
|---|
| 151 | comment = db.Column(db.String(255))
|
|---|
| 152 | #osm_id = db.Column(db.Integer)
|
|---|
| 153 | #osm_type = db.Column(db.String(255))
|
|---|
| 154 | #osm_class = db.Column(db.String(255))
|
|---|
| 155 | manager = db.relationship("User", backref=db.backref("gauges"), lazy=True)
|
|---|
| 156 | water = db.relationship("Water", backref=db.backref("gauges"), lazy=True)
|
|---|
| 157 |
|
|---|
| 158 | def to_dict(obj):
|
|---|
| 159 | result = { 'gaugeId': obj.id, 'name': obj.name }
|
|---|
| 160 | if obj.manager:
|
|---|
| 161 | result['manager'] = obj.manager.username
|
|---|
| 162 | location = wkb_to_dict(obj.location)
|
|---|
| 163 | result['location'] = [location['longitude'], location['latitude']]
|
|---|
| 164 | result['referenceWaterLevelGaugeHeight'] = obj.reference_water_level_gauge_height
|
|---|
| 165 | if obj.water:
|
|---|
| 166 | result['water'] = { 'label': obj.water.name, 'id': obj.water.id }
|
|---|
| 167 | if obj.logs:
|
|---|
| 168 | logs = []
|
|---|
| 169 | for log in obj.logs:
|
|---|
| 170 | logs.append(log.meta_data())
|
|---|
| 171 | result['logs'] = logs
|
|---|
| 172 | if obj.comment:
|
|---|
| 173 | result['comment'] = obj.comment
|
|---|
| 174 | return result
|
|---|
| 175 |
|
|---|
| 176 | def to_geojson(obj):
|
|---|
| 177 | location = wkb_to_dict(obj.location)
|
|---|
| 178 | result = {
|
|---|
| 179 | 'type': 'Feature',
|
|---|
| 180 | 'geometry': {
|
|---|
| 181 | 'type': 'Point',
|
|---|
| 182 | 'coordinates': [location['longitude'], location['latitude']]
|
|---|
| 183 | },
|
|---|
| 184 | 'properties': {
|
|---|
| 185 | 'name': obj.name,
|
|---|
| 186 | 'referenceWaterLevelGaugeHeight': obj.reference_water_level_gauge_height
|
|---|
| 187 | }
|
|---|
| 188 | }
|
|---|
| 189 | if obj.manager:
|
|---|
| 190 | result['properties']['manager'] = obj.manager.username
|
|---|
| 191 | if obj.comment:
|
|---|
| 192 | result['properties']['comment'] = obj.comment
|
|---|
| 193 | return result
|
|---|
| 194 |
|
|---|
| 195 | class Device(db.Model):
|
|---|
| 196 | __tablename__ = "devices"
|
|---|
| 197 |
|
|---|
| 198 | id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|---|
| 199 | name = db.Column(db.String(255), nullable=False)
|
|---|
| 200 | owner_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
|---|
| 201 | sensor_depth = db.Column(db.Float, nullable=False)
|
|---|
| 202 | comment = db.Column(db.String(255))
|
|---|
| 203 |
|
|---|
| 204 | owner = db.relationship("User", backref=db.backref("devices"), lazy=True)
|
|---|
| 205 |
|
|---|
| 206 | def to_dict(obj):
|
|---|
| 207 | result = { 'deviceId': obj.id, 'name': obj.name, 'sensorDepth': obj.sensor_depth }
|
|---|
| 208 | if obj.logs:
|
|---|
| 209 | logs = []
|
|---|
| 210 | for log in obj.logs:
|
|---|
| 211 | logs.append(log.meta_data())
|
|---|
| 212 | result['logs'] = logs
|
|---|
| 213 | if obj.comment:
|
|---|
| 214 | result['comment'] = obj.comment
|
|---|
| 215 | return result
|
|---|
| 216 |
|
|---|
| 217 | class ProcessingStatus(db.Model):
|
|---|
| 218 | __tablename__ = "processingstatus"
|
|---|
| 219 |
|
|---|
| 220 | id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|---|
| 221 | label = db.Column(db.String(255), nullable=False)
|
|---|
| 222 |
|
|---|
| 223 | @staticmethod
|
|---|
| 224 | def insert_states():
|
|---|
| 225 | states = [ 'Undefined', 'Queued for Parsing', 'Parsing', 'Queued for Processing', 'Processing', 'Deployed', 'To Old', 'Error' ]
|
|---|
| 226 | changed = False
|
|---|
| 227 | for state in states:
|
|---|
| 228 | query = ProcessingStatus.query.filter_by(label=state).all()
|
|---|
| 229 | if len(query) != 1:
|
|---|
| 230 | state = ProcessingStatus(label=state)
|
|---|
| 231 | db.session.add(state)
|
|---|
| 232 | changed = True
|
|---|
| 233 | if changed:
|
|---|
| 234 | db.session.commit()
|
|---|
| 235 |
|
|---|
| 236 | class Log(db.Model):
|
|---|
| 237 | __tablename__ = "logs"
|
|---|
| 238 |
|
|---|
| 239 | id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|---|
| 240 | submitter_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
|---|
| 241 | water_id = db.Column(db.Integer, db.ForeignKey('waters.id'))
|
|---|
| 242 | device_id = db.Column(db.Integer, db.ForeignKey('devices.id'))
|
|---|
| 243 | gauge_id = db.Column(db.Integer, db.ForeignKey('gauges.id'))
|
|---|
| 244 | gauge_height = db.Column(db.Float, nullable=False)
|
|---|
| 245 | start = db.Column(UtcDateTime, nullable=True)
|
|---|
| 246 | end = db.Column(UtcDateTime, nullable=True)
|
|---|
| 247 | processing_state = db.Column(db.Integer, db.ForeignKey('processingstatus.id'), default=1)
|
|---|
| 248 | comment = db.Column(db.String(255))
|
|---|
| 249 |
|
|---|
| 250 | submitter = db.relationship("User", backref=db.backref("logs"), lazy=True)
|
|---|
| 251 | water = db.relationship("Water", backref=db.backref("logs"), lazy=True)
|
|---|
| 252 | device = db.relationship("Device", backref=db.backref("logs"), lazy=True)
|
|---|
| 253 | gauge = db.relationship("Gauge", backref=db.backref("logs"), lazy=True)
|
|---|
| 254 | processingstatus = db.relationship("ProcessingStatus", backref=db.backref("logs"), lazy=True)
|
|---|
| 255 |
|
|---|
| 256 | def meta_data(obj):
|
|---|
| 257 | result = {
|
|---|
| 258 | 'logId': obj.id,
|
|---|
| 259 | 'submitter': obj.submitter.username,
|
|---|
| 260 | 'water': {
|
|---|
| 261 | 'id': obj.water.id,
|
|---|
| 262 | 'label': obj.water.name,
|
|---|
| 263 | },
|
|---|
| 264 | 'device': {
|
|---|
| 265 | 'id': obj.device.id,
|
|---|
| 266 | 'label': obj.device.name,
|
|---|
| 267 | },
|
|---|
| 268 | 'gauge': {
|
|---|
| 269 | 'id': obj.gauge.id,
|
|---|
| 270 | 'label': obj.gauge.name,
|
|---|
| 271 | },
|
|---|
| 272 | 'gaugeHeight': obj.gauge_height,
|
|---|
| 273 | 'start': '',
|
|---|
| 274 | 'end': '',
|
|---|
| 275 | 'processingState': {
|
|---|
| 276 | 'id': obj.processingstatus.id,
|
|---|
| 277 | 'label': obj.processingstatus.label
|
|---|
| 278 | }
|
|---|
| 279 | }
|
|---|
| 280 | if obj.start is not None:
|
|---|
| 281 | result['start'] = obj.start.isoformat('T')
|
|---|
| 282 | if obj.end is not None:
|
|---|
| 283 | result['end'] = obj.end.isoformat('T')
|
|---|
| 284 |
|
|---|
| 285 | entries_count = 0
|
|---|
| 286 | if obj.log_entries:
|
|---|
| 287 | entries_count = len(obj.log_entries)
|
|---|
| 288 | result['entriesCount'] = entries_count
|
|---|
| 289 | if obj.comment:
|
|---|
| 290 | result['comment'] = obj.comment
|
|---|
| 291 | return result
|
|---|
| 292 |
|
|---|
| 293 | def log(obj):
|
|---|
| 294 | result = { 'metaData': obj.meta_data() }
|
|---|
| 295 | entries = []
|
|---|
| 296 | if obj.log_entries:
|
|---|
| 297 | for log in obj.log_entries:
|
|---|
| 298 | entries.append(log.to_dict())
|
|---|
| 299 | result['entries'] = entries
|
|---|
| 300 | return result
|
|---|
| 301 |
|
|---|
| 302 | def to_geojson(obj):
|
|---|
| 303 | result = {
|
|---|
| 304 | 'type': 'FeatureCollection',
|
|---|
| 305 | 'features': []
|
|---|
| 306 | }
|
|---|
| 307 | if obj.log_entries:
|
|---|
| 308 | for log in obj.log_entries:
|
|---|
| 309 | location = wkb_to_dict(log.location)
|
|---|
| 310 | feature = {
|
|---|
| 311 | 'type': 'Feature',
|
|---|
| 312 | 'geometry': {
|
|---|
| 313 | 'type': 'Point',
|
|---|
| 314 | 'coordinates': [location['longitude'], location['latitude']]
|
|---|
| 315 | },
|
|---|
| 316 | 'properties': {
|
|---|
| 317 | 'datetime': log.datetime.isoformat('T')
|
|---|
| 318 | }
|
|---|
| 319 | }
|
|---|
| 320 | if log.water_depth is not None:
|
|---|
| 321 | feature['properties']['waterDepth'] = log.water_depth
|
|---|
| 322 | result['features'].append(feature)
|
|---|
| 323 | return result
|
|---|
| 324 |
|
|---|
| 325 | class LogEntry(db.Model):
|
|---|
| 326 | __tablename__ = "logentries"
|
|---|
| 327 |
|
|---|
| 328 | id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|---|
| 329 | log_id = db.Column(db.Integer, db.ForeignKey('logs.id'))
|
|---|
| 330 | datetime = db.Column(UtcDateTime, nullable=False)
|
|---|
| 331 | # POINT(Lon Lat)
|
|---|
| 332 | location = db.Column(Geometry(geometry_type='POINT', srid=4326, management=True))
|
|---|
| 333 | water_depth = db.Column(db.Float)
|
|---|
| 334 |
|
|---|
| 335 | log = db.relationship("Log", backref=db.backref("log_entries"), lazy=True)
|
|---|
| 336 |
|
|---|
| 337 | def to_dict(obj):
|
|---|
| 338 | result = {'datetime': obj.datetime.isoformat('T') }
|
|---|
| 339 | location = wkb_to_dict(obj.location)
|
|---|
| 340 | result['location'] = [location['longitude'], location['latitude']]
|
|---|
| 341 | if obj.water_depth:
|
|---|
| 342 | result['waterDepth'] = obj.water_depth
|
|---|
| 343 | return result
|
|---|
| 344 |
|
|---|
| 345 | class LogView(db.Model):
|
|---|
| 346 | __table__ = create_view(
|
|---|
| 347 | name='logview',
|
|---|
| 348 | metadata=db.Model.metadata,
|
|---|
| 349 | selectable=select(
|
|---|
| 350 | [
|
|---|
| 351 | Log.id,
|
|---|
| 352 | Log.submitter_id,
|
|---|
| 353 | Log.water_id,
|
|---|
| 354 | Log.device_id,
|
|---|
| 355 | Log.gauge_id,
|
|---|
| 356 | Log.gauge_height,
|
|---|
| 357 | Log.start,
|
|---|
| 358 | Log.end,
|
|---|
| 359 | ProcessingStatus.label,
|
|---|
| 360 | func.Envelope(func.MakeLine(LogEntry.location)).label('envelope')
|
|---|
| 361 | ],
|
|---|
| 362 | from_obj=(Log.__table__.join(LogEntry, Log.id == LogEntry.log_id).join(ProcessingStatus, Log.processing_state == ProcessingStatus.id)),
|
|---|
| 363 | group_by=(Log.id)
|
|---|
| 364 | ),
|
|---|
| 365 | cascade_on_drop=False
|
|---|
| 366 | )
|
|---|
| 367 |
|
|---|
| 368 | class Queue(db.Model):
|
|---|
| 369 | __tablename__ = "queue"
|
|---|
| 370 |
|
|---|
| 371 | log_id = db.Column(db.Integer, db.ForeignKey('logs.id'), primary_key=True)
|
|---|
| 372 | datetime = db.Column(UtcDateTime, nullable=False, default=datetime.datetime.now(datetime.timezone.utc))
|
|---|
| 373 |
|
|---|
| 374 | log = db.relationship("Log", backref=db.backref("queue"), lazy=True)
|
|---|
| 375 |
|
|---|
| 376 | def db_setup(force = False):
|
|---|
| 377 | if not database_exists(db.engine.url) or force:
|
|---|
| 378 | create_database(db.engine.url)
|
|---|
| 379 | if 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
|
|---|
| 380 | result = db.engine.execute('SELECT count(name) FROM sqlite_master WHERE type="table" AND name="spatial_ref_sys"')
|
|---|
| 381 | if result.fetchone()[0] == 1:
|
|---|
| 382 | print('Spatial lite extension already loaded')
|
|---|
| 383 | else:
|
|---|
| 384 | print("Initiate spatial meta data for Spatialite...")
|
|---|
| 385 | db.engine.execute(select([func.InitSpatialMetaData()]))
|
|---|
| 386 | print("...Finished")
|
|---|
| 387 | db.create_all()
|
|---|
| 388 | ProcessingStatus.insert_states()
|
|---|
| 389 |
|
|---|
| 390 | def load_spatialite(dbapi_conn, connection_record):
|
|---|
| 391 | if not 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
|
|---|
| 392 | return
|
|---|
| 393 |
|
|---|
| 394 | paths = [os.path.join(sys.prefix, 'lib'), os.path.join(sys.prefix, 'lib64'), '/usr/lib', '/usr/lib64']
|
|---|
| 395 | for path in paths:
|
|---|
| 396 | if _load_spatialite_from_path(path, dbapi_conn, connection_record):
|
|---|
| 397 | return True
|
|---|
| 398 | raise FileNotFoundError('mod_spatialite not found in folders {}'.format(', '.join(paths)))
|
|---|
| 399 |
|
|---|
| 400 | def _load_spatialite_from_path(search_path, dbapi_conn, connection_record):
|
|---|
| 401 | for path in Path(search_path).rglob('mod_spatialite.so*'):
|
|---|
| 402 | if os.path.exists(path):
|
|---|
| 403 | if flask.current_app.config['DEBUG'] and (not 'TESTING' in flask.current_app.config or not flask.current_app.config['TESTING']):
|
|---|
| 404 | print('Enabling spatial lite extension. This may take a while')
|
|---|
| 405 | # From https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html
|
|---|
| 406 | dbapi_conn.enable_load_extension(True)
|
|---|
| 407 | dbapi_conn.load_extension(str(path.resolve()))
|
|---|
| 408 | return True
|
|---|
| 409 | return False
|
|---|