Skip to content

Commit

Permalink
fix server side validation of event related_items
Browse files Browse the repository at this point in the history
SDBELGA-792
  • Loading branch information
petrjasek committed Apr 4, 2024
1 parent 655ebbc commit 25e76d3
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 1 deletion.
90 changes: 89 additions & 1 deletion server/features/events.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1404,4 +1404,92 @@ Feature: Events
}
}]
"""
Then we get OK response
Then we get OK response

@auth
Scenario: Create events with related items and coverages
When we post to "/events"
"""
{
"type": "event",
"occur_status": {
"qcode": "eocstat:eos5",
"name": "Planned, occurs certainly",
"label": "Planned, occurs certainly"
},
"dates": {
"start": "2050-01-01T00:00:00+0000",
"end": "2050-01-02T00:00:00+0000",
"tz": "Europe/Sofia"
},
"calendars": [],
"state": "draft",
"language": "en",
"languages": [
"en"
],
"place": [],
"files": [],
"associated_plannings": [
{
"_id": "tempId-1712223365066uledqfmsv",
"type": "planning",
"planning_date": null,
"agendas": [],
"state": "draft",
"item_class": "plinat:newscoverage",
"language": "en",
"languages": [
"en"
],
"place": [],
"flags": {
"marked_for_not_publication": false,
"overide_auto_assign_to_workflow": false
},
"coverages": [
{
"coverage_id": "tempId-1712223368199odugn",
"planning": {
"scheduled": "2024-04-04T13:36:08+03:00",
"g2_content_type": "text",
"language": "en",
"_scheduledTime": "2024-04-04T13:36:08+03:00"
},
"news_coverage_status": {
"qcode": "ncostat:int",
"name": "coverage intended",
"label": "Planned"
},
"workflow_status": "draft",
"assigned_to": {}
}
],
"event_item": "tempId-1712220681040btveuuz"
}
],
"related_items": [
{
"type": "picture",
"pubstatus": "usable",
"versioncreated": "2024-02-20T08:37:53+0000",
"guid": "0be5e148-2cd5-4a8b-bf76-a19fe21b2cb7",
"state": "in_progress",
"source": "ANSA",
"language": "it",
"search_provider": "660e6a002c73e11f433f0210"
},
{
"type": "picture",
"pubstatus": "usable",
"versioncreated": "2024-02-20T08:37:07+0000",
"guid": "941f41db-4444-4aaf-94d9-cd48cd091a59",
"state": "in_progress",
"source": "ANSA",
"language": "it",
"search_provider": "660e6a002c73e11f433f0210"
}
]
}
"""
Then we get OK response
5 changes: 5 additions & 0 deletions server/planning/events/events_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@
},
},
},
"associated_plannings": { # This is used to create new planning items from the event editor
"type": "list",
"required": False,
"schema": {"type": "dict", "allow_unknown": True, "schema": {}},
},
"related_items": {
"type": "list",
"required": False,
Expand Down

0 comments on commit 25e76d3

Please sign in to comment.