Skip to content

Commit

Permalink
[STT-6] Feature(backend): Support linking multiple Events into a Plan…
Browse files Browse the repository at this point in the history
…ning item (#1991)

* Update planning resource

* Update types and add utils

* Update Events resource

* Update Assignments resource

* Update item locks

* Update ProdAPI

* Update json_planning formatter

* Update flag_expired command

* Update search

* New command to replace depreacted event_item attribute

* Update planning article export

* Fix/add feature tests
  • Loading branch information
MarkLark86 authored Jun 5, 2024
1 parent 65b8c35 commit ed7c3f3
Show file tree
Hide file tree
Showing 76 changed files with 2,126 additions and 992 deletions.
10 changes: 8 additions & 2 deletions server/features/assignments_delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ Feature: Assignments Delete
},
"workflow_status": "active"
}],
"event_item": "#events._id#"
"related_events": [
{"_id": "#events._id#", "link_type": "primary"}
]
}
"""
Then we get OK response
Expand Down Expand Up @@ -347,7 +349,11 @@ Feature: Assignments Delete
},
"workflow_status": "active"
}],
"event_item": "#EVENT2._id#",
"related_events": [{
"_id": "#EVENT2._id#",
"link_type": "primary",
"recurrence_id": "#EVENT2.recurrence_id#"
}],
"recurrence_id": "#EVENT2.recurrence_id#"
}
"""
Expand Down
3 changes: 3 additions & 0 deletions server/features/assignments_lock.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: Assignments Locking
"""
[{
"_id": "a123",
"planning_item": "plan1",
"planning": {
"ednote": "test coverage, I want 250 words",
"headline": "test headline",
Expand Down Expand Up @@ -34,6 +35,7 @@ Feature: Assignments Locking
"""
[{
"_id": "a123",
"planning_item": "plan1",
"planning": {
"ednote": "test coverage, I want 250 words",
"headline": "test headline",
Expand Down Expand Up @@ -148,6 +150,7 @@ Feature: Assignments Locking
"""
[{
"_id": "a123",
"planning_item": "plan1",
"planning": {
"ednote": "test coverage, I want 250 words",
"headline": "test headline",
Expand Down
3 changes: 3 additions & 0 deletions server/features/assignments_revert.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Feature: Assignment Revert
"""
[{
"_id": "aaaaaaaaaaaaaaaaaaaaaaaa",
"planning_item": "plan1",
"planning": {
"ednote": "test coverage, I want 250 words",
"headline": "test headline",
Expand Down Expand Up @@ -78,6 +79,7 @@ Feature: Assignment Revert
"""
[{
"_id": "aaaaaaaaaaaaaaaaaaaaaaaa",
"planning_item": "plan1",
"planning": {
"ednote": "test coverage, I want 250 words",
"headline": "test headline",
Expand Down Expand Up @@ -114,6 +116,7 @@ Feature: Assignment Revert
"""
[{
"_id": "aaaaaaaaaaaaaaaaaaaaaaaa",
"planning_item": "plan1",
"planning": {
"ednote": "test coverage, I want 250 words",
"headline": "test headline",
Expand Down
4 changes: 3 additions & 1 deletion server/features/combined_export.feature
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ Feature: Export combined Planning and Event items with default template
"headline": "Planning 1",
"slugline": "planning-1",
"description_text": "desc",
"event_item": "#events._id#",
"related_events": [
{"_id": "#events._id#", "link_type": "primary"}
],
"ednote": "Ed. note 1",
"coverages": [{
"coverage_id": "123",
Expand Down
8 changes: 6 additions & 2 deletions server/features/event_embedded_planning.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ Feature: Event Embedded Planning
"original_creator": "#CONTEXT_USER_ID#",
"firstcreated": "__now__",
"versioncreated": "__now__",
"event_item": "event1",
"related_events": [
{"_id": "event1", "link_type": "primary"}
],
"planning_date": "2029-11-21T12:00:00+0000",
"coverages": [{
"coverage_id": "__any_value__",
Expand Down Expand Up @@ -381,7 +383,9 @@ Feature: Event Embedded Planning
Then we get list with 1 items
"""
{"_items": [{
"event_item": "event1",
"related_events": [
{"_id": "event1", "link_type": "primary"}
],
"slugline": "__no_value__",
"coverages": [{
"planning": {
Expand Down
18 changes: 12 additions & 6 deletions server/features/events.feature
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ Feature: Events
When we get "/planning/plan1"
Then we get existing resource
"""
{"event_item": "#events._id#"}
{"related_events": [{"_id": "#events._id#", "link_type": "primary"}]}
"""
And we get notifications
"""
Expand Down Expand Up @@ -711,7 +711,9 @@ Feature: Events
"operation": "create_event",
"planning_id": "#planning._id#",
"update": {
"event_item": "#events._id#"
"related_events": [
{"_id": "#events._id#", "link_type": "primary"}
]
}
}]
}
Expand Down Expand Up @@ -1135,7 +1137,7 @@ Feature: Events
When we get "/planning/#planning._id#"
Then we get existing resource
"""
{"event_item": "#events._id#"}
{"related_events": [{"_id": "#events._id#", "link_type": "primary"}]}
"""
When we post to "/events/#events._id#/lock"
"""
Expand Down Expand Up @@ -1324,7 +1326,7 @@ Feature: Events
When we get "/planning/#planning._id#"
Then we get existing resource
"""
{"event_item": "#events._id#"}
{"related_events": [{"_id": "#events._id#", "link_type": "primary"}]}
"""
When we post to "/events/#events._id#/lock"
"""
Expand Down Expand Up @@ -1465,7 +1467,9 @@ Feature: Events
"assigned_to": {}
}
],
"event_item": "tempId-1712220681040btveuuz"
"related_events": [
{"_id": "tempId-1712220681040btveuuz", "link_type": "primary"}
]
}
],
"related_items": [
Expand Down Expand Up @@ -1554,7 +1558,9 @@ Feature: Events
"assigned_to": {}
}
],
"event_item": "tempId-1712220681040btveuuz"
"related_events": [
{"_id": "tempId-1712220681040btveuuz", "link_type": "primary"}
]
}
],
"related_items": [
Expand Down
60 changes: 55 additions & 5 deletions server/features/events_cancel.feature
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ Feature: Events Cancel
"_id": "plan1",
"guid": "plan1",
"slugline": "TestPlan 1",
"event_item": "event1",
"related_events": [{"_id": "event1", "link_type": "primary"}],
"state": "draft",
"planning_date": "2016-01-02"
},
{
"_id": "plan2",
"guid": "plan2",
"slugline": "TestPlan 2",
"event_item": "event1",
"related_events": [{"_id": "event1", "link_type": "primary"}],
"state": "draft",
"planning_date": "2016-01-02"
}]
Expand Down Expand Up @@ -311,7 +311,7 @@ Feature: Events Cancel
[{
"slugline": "Weekly Meetings",
"headline": "Friday Club",
"event_item": "#EVENT3._id#",
"related_events": [{"_id": "#EVENT3._id#", "link_type": "primary"}],
"planning_date": "2016-01-02"
}]
"""
Expand Down Expand Up @@ -349,6 +349,7 @@ Feature: Events Cancel
"""
[{
"_id": "aaaaaaaaaaaaaaaaaaaaaaaa",
"planning_item": "plan1",
"planning": {
"ednote": "test coverage, I want 250 words",
"headline": "test headline",
Expand Down Expand Up @@ -392,7 +393,9 @@ Feature: Events Cancel
"_id": "plan1",
"guid": "plan1",
"slugline": "TestPlan 1",
"event_item": "event1",
"related_events": [
{"_id": "event1", "link_type": "primary"}
],
"ednote": "We're covering this Event",
"state": "draft",
"coverages": [{
Expand Down Expand Up @@ -866,7 +869,9 @@ Feature: Events Cancel
[{
"slugline": "Weekly Meetings",
"headline": "Friday Club",
"event_item": "#EVENT3._id#",
"related_events": [
{"_id": "#EVENT3._id#", "link_type": "primary"}
],
"planning_date": "2016-01-02"
}]
"""
Expand Down Expand Up @@ -895,3 +900,48 @@ Feature: Events Cancel
{ "_id": "#EVENT4._id#", "state": "cancelled" }
]}
"""

@auth
@vocabulary
Scenario: Cancelling an Event does not cancel Planning item with secondary link
Given we have sessions "/sessions"
And "events"
"""
[{
"guid": "event1",
"name": "Event1",
"dates": {
"start": "2029-05-29T12:00:00+0000",
"end": "2029-05-29T14:00:00+0000",
"tz": "Australia/Sydney"
},
"lock_user": "#CONTEXT_USER_ID#",
"lock_session": "#SESSION_ID#",
"lock_action": "cancel",
"lock_time": "#DATE#"
}]
"""
And "planning"
"""
[{
"guid": "plan1",
"slugline": "test-plan",
"planning_date": "2029-05-29T12:00:00+0000",
"related_events": [{"_id": "event1", "link_type": "primary"}]
}, {
"guid": "plan2",
"slugline": "test-plan",
"planning_date": "2029-05-29T12:00:00+0000",
"related_events": [{"_id": "event1", "link_type": "secondary"}]
}]
"""
When we perform cancel on events "event1"
Then we get OK response
When we get "/planning"
Then we get list with 2 items
"""
{"_items": [
{"_id": "plan1", "state": "cancelled"},
{"_id": "plan2", "state": "draft"}
]}
"""
8 changes: 4 additions & 4 deletions server/features/events_lock.feature
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Feature: Events Locking
"""
[{
"slugline": "TestPlan",
"event_item": "123",
"related_events": [{"_id": "123", "link_type": "primary"}],
"planning_date": "2016-01-02"
}]
"""
Expand All @@ -113,7 +113,7 @@ Feature: Events Locking
"""
{
"slugline": "TestPlan",
"event_item": "123",
"related_events": [{"_id": "123", "link_type": "primary"}],
"lock_user": "#CONTEXT_USER_ID#"
}
Expand Down Expand Up @@ -236,7 +236,7 @@ Feature: Events Locking
{
"item_class": "item class value",
"headline": "test headline",
"event_item": "#EVENT3._id#",
"related_events": [{"_id": "#EVENT3._id#", "link_type": "primary"}],
"planning_date": "2016-01-02"
}
]
Expand All @@ -251,7 +251,7 @@ Feature: Events Locking
{
"item_class": "item class value",
"headline": "test headline",
"event_item": "#EVENT3._id#",
"related_events": [{"_id": "#EVENT3._id#", "link_type": "primary"}],
"lock_user": "#CONTEXT_USER_ID#"
}
"""
Expand Down
Loading

0 comments on commit ed7c3f3

Please sign in to comment.