return self.backend.db.fetch(stmt)
- async def create(self, reported_by, comment=None, **kwargs):
+ async def create(self, name, reported_by, comment=None, **kwargs):
"""
Creates a new report
"""
+ # Check if the name is valid
+ if not util.is_fqdn(name):
+ raise ValueError("'%s' is not a valid FQDN" % name)
+
# The database can only handle users by their UID
if isinstance(reported_by, users.User):
reported_by = reported_by.uid
report = await self.backend.db.insert(
- Report, reported_by=reported_by, **kwargs,
+ Report, name=name, reported_by=reported_by, **kwargs,
)
# Manifest the object in the database immediately to assign the ID