mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-19 14:08:47 -04:00
add created_by to notifications
this is so one-off notifications can be tied to a user (jobs have a created_by, and api notifications don't make sense to have one)
This commit is contained in:
@@ -800,6 +800,9 @@ class Notification(db.Model):
|
||||
phone_prefix = db.Column(db.String, nullable=True)
|
||||
rate_multiplier = db.Column(db.Float(asdecimal=False), nullable=True)
|
||||
|
||||
created_by = db.relationship('User')
|
||||
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), nullable=True)
|
||||
|
||||
@hybrid_property
|
||||
def status(self):
|
||||
return self._status_enum
|
||||
|
||||
@@ -444,6 +444,7 @@ class NotificationWithTemplateSchema(BaseSchema):
|
||||
dump_only=True
|
||||
)
|
||||
job = fields.Nested(JobSchema, only=["id", "original_file_name"], dump_only=True)
|
||||
created_by = fields.Nested(UserSchema, only=['id', 'name', 'email_address'], dump_only=True)
|
||||
status = fields.String(required=False)
|
||||
personalisation = fields.Dict(required=False)
|
||||
key_type = field_for(models.Notification, 'key_type', required=True)
|
||||
|
||||
Reference in New Issue
Block a user