Skip to content

Commit 026bc6f

Browse files
committed
chore: refactor notifications topic schemas
1 parent 9ce7895 commit 026bc6f

24 files changed

+507
-226
lines changed

packages/live-status-gateway-api/api/asyncapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ channels:
4747
$ref: './topics/packages/packagesTopic.yaml'
4848
buckets:
4949
$ref: './topics/buckets/bucketsTopic.yaml'
50+
notifications:
51+
$ref: './topics/notifications/notificationsTopic.yaml'
5052

5153
# Needed to retain the Slash type from the old schema structure. Eventually this should be removed.
5254
/:
@@ -89,3 +91,6 @@ channels:
8991
- messageId: buckets-typeGen
9092
payload:
9193
$ref: './components/buckets/messages/bucketsMessage.yaml#/components/messages/bucketsMessage/payload'
94+
- messageId: notifications-typeGen
95+
payload:
96+
$ref: './components/notifications/messages/notificationsMessage.yaml#/components/messages/notificationsMessage/payload'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
event: notifications
2+
activeNotifications:
3+
- $ref: '../../notificationObj/notificationObj-example.yaml'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
$defs:
2+
notificationsEvent:
3+
type: object
4+
title: NotificationsEvent
5+
description: Active notifications in Sofie
6+
properties:
7+
event:
8+
type: string
9+
const: notifications
10+
activeNotifications:
11+
description: Active notifications in Sofie
12+
type: array
13+
items:
14+
$ref: '../../notificationObj/notificationObj.yaml#/$defs/NotificationObj'
15+
required: [event, activeNotifications]
16+
additionalProperties: false
17+
examples:
18+
- $ref: './notificationsEvent-example.yaml'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
components:
2+
messages:
3+
notificationsMessage:
4+
messageId: notificationsUpdate
5+
title: Active notifications in Sofie
6+
payload:
7+
$ref: '../events/notificationsEvent/notificationsEvent.yaml#/$defs/notificationsEvent'
8+
examples:
9+
- payload:
10+
$ref: '../events/notificationsEvent/notificationsEvent-example.yaml'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
_id: 'notif123'
2+
severity: error
3+
message: 'disk.space.low'
4+
relatedTo:
5+
$ref: '../target/pieceInstance/notificationTargetPieceInstance-example.yaml'
6+
created: 1694784932
7+
modified: 1694784950
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
$defs:
2+
NotificationObj:
3+
type: object
4+
title: NotificationObj
5+
description: This describes a notification that should be shown to a user. These can come from various sources, and are added and removed dynamically during system usage
6+
required:
7+
- _id
8+
- severity
9+
- message
10+
- relatedTo
11+
- created
12+
properties:
13+
_id:
14+
type: string
15+
description: Unique identifier for the notification
16+
severity:
17+
$ref: '../notificationSeverity.yaml#/$defs/severity'
18+
message:
19+
type: string
20+
description: The message of the notification
21+
relatedTo:
22+
$ref: '../target/notificationTarget.yaml#/$defs/NotificationTarget'
23+
created:
24+
type: integer
25+
format: int64
26+
description: Unix timestamp of creation
27+
modified:
28+
type: integer
29+
format: int64
30+
description: Unix timestamp of last modification
31+
additionalProperties: false
32+
examples:
33+
- $ref: './notificationObj-example.yaml'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
$defs:
2+
severity:
3+
type: string
4+
title: NotificationSeverity
5+
description: Severity level of the notification.
6+
enum:
7+
- warning
8+
- error
9+
- info
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
$defs:
2+
NotificationTarget:
3+
title: NotificationTarget
4+
description: Describes what the notification is related to
5+
oneOf:
6+
- $ref: './rundown/notificationTargetRundown.yaml#/$defs/NotificationTargetRundown'
7+
- $ref: './rundownPlaylist/notificationTargetRundownPlaylist.yaml#/$defs/NotificationTargetRundownPlaylist'
8+
- $ref: './partInstance/notificationTargetPartInstance.yaml#/$defs/NotificationTargetPartInstance'
9+
- $ref: './pieceInstance/notificationTargetPieceInstance.yaml#/$defs/NotificationTargetPieceInstance'
10+
- $ref: './unknown/notificationTargetUnknown.yaml#/$defs/NotificationTargetUnknown'
11+
examples:
12+
- $ref: './rundown/notificationTargetRundown-example.yaml'
13+
- $ref: './rundownPlaylist/notificationTargetRundownPlaylist-example.yaml'
14+
- $ref: './partInstance/NotificationTargetPartInstance-example.yaml'
15+
- $ref: './pieceInstance/notificationTargetPieceInstance-example.yaml'
16+
- $ref: './unknown/notificationTargetUnknown-example.yaml'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
$defs:
2+
NotificationTargetType:
3+
type: string
4+
title: NotificationTargetType
5+
description: Possible NotificationTarget types
6+
enum:
7+
- rundown
8+
- playlist
9+
- partInstance
10+
- pieceInstance
11+
- unknown
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type: partInstance
2+
studioId: studio01
3+
rundownId: rd123
4+
partInstanceId: pi789

0 commit comments

Comments
 (0)