Skip to content

Commit

Permalink
fix events autosave with related items (#1960)
Browse files Browse the repository at this point in the history
SDBELGA-792
  • Loading branch information
petrjasek authored Apr 10, 2024
1 parent 9a7ce5d commit 18273da
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 5 deletions.
91 changes: 91 additions & 0 deletions server/features/events.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1492,4 +1492,95 @@ Feature: Events
]
}
"""
Then we get OK response

@auth
Scenario: Autosave events with related items and coverages
Given we have sessions "/sessions"
When we post to "/event_autosave"
"""
{
"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"
}
],
"lock_user": "#CONTEXT_USER_ID#",
"lock_session": "#SESSION_ID#"
}
"""
Then we get OK response
6 changes: 1 addition & 5 deletions server/planning/events/event_autosave.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ class EventAutosaveResource(Resource):
item_methods = ["GET", "PUT", "PATCH", "DELETE"]

schema = deepcopy(events_schema)
schema["associated_plannings"] = {
"type": "list",
"required": False,
"schema": {"type": "dict", "allow_unknown": True},
}

datasource = {
"source": "event_autosave",
}
Expand Down

0 comments on commit 18273da

Please sign in to comment.