mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Update the template_schema to include a parent_folder_id.
When creating the Tempalte from_json, the folder is passed in. Since some validation should done, as in the folder exists and is for the same service, the folder is passed through to the Tempalte.from_json method. When the template is persisted so is the relationship to folders. TODO: If the folder is invalid a specific message should be returned.
This commit is contained in:
@@ -885,7 +885,7 @@ class Template(TemplateBase):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, data):
|
||||
def from_json(cls, data, folder):
|
||||
"""
|
||||
Assumption: data has been validated appropriately.
|
||||
|
||||
@@ -895,7 +895,8 @@ class Template(TemplateBase):
|
||||
|
||||
fields['created_by_id'] = fields.pop('created_by')
|
||||
fields['service_id'] = fields.pop('service')
|
||||
|
||||
if fields.pop("parent_folder_id"):
|
||||
fields['folder'] = folder
|
||||
return cls(**fields)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user