Skip to content

Commit

Permalink
fix: shared model: unify data objects
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Nov 15, 2023
1 parent fbbffee commit 3563d86
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/shared/model/src/model.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { ProtectedString } from './ProtectedString.js'
import { AnyProtectedString, ProtectedString } from './ProtectedString.js'

/*
These types are shared between the server and the client
*/

export interface DataObject {
_id: AnyProtectedString
}

export type RundownPlaylistId = ProtectedString<'RundownPlaylistId', string>
export interface RundownPlaylist {
export interface RundownPlaylist extends DataObject {
_id: RundownPlaylistId

/** Rundown playlist slug - user-presentable name */
Expand All @@ -18,7 +22,7 @@ export interface RundownPlaylist {
/** Is the playlist in rehearsal mode (can be used, when active: true) */
rehearsal: boolean
/** Actual time of playback starting */
startedPlayback?: number
startedPlayback: number | undefined

// To be implemented later:
// timing: {
Expand All @@ -30,7 +34,7 @@ export interface RundownPlaylist {
}

export type RundownId = ProtectedString<'RundownId', string>
export interface Rundown {
export interface Rundown extends DataObject {
_id: RundownId

playlistId: RundownPlaylistId
Expand All @@ -47,7 +51,7 @@ export interface Rundown {
}

export type SegmentId = ProtectedString<'SegmentId', string>
export interface Segment {
export interface Segment extends DataObject {
_id: SegmentId
rundownId: RundownId
/** The position of the Segment within its Rundown */
Expand All @@ -71,7 +75,7 @@ export interface Segment {
}

export type PartId = ProtectedString<'PartId', string>
export interface Part {
export interface Part extends DataObject {
_id: PartId
rundownId: RundownId
segmentId: SegmentId
Expand Down

0 comments on commit 3563d86

Please sign in to comment.