Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localized video description #182

Merged
merged 3 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ In this section, we describe all data related to educational videos to be shown
|title|LocalizedText|e.g. "Beta Blockers for Heart Failure"|May be localized.|
|youtubeId|LocalizedText|e.g. "XfgcXkq61k0"|Contains the video id from YouTube.|
|orderIndex|integer|e.g. 1|Since Firestore collections aren't necessarily ordered, we have this property to order the elements by on the clients. The list is supposed to be ordered ascending by `orderIndex`.|
|description|LocalizedText|-|Describes the content of the video; to be shown underneath the video.|

Embed links for YouTube: `https://youtube.com/embed/${youtubeId}`.
Short links for YouTube: `https://youtu.be/${youtubeId}`.
Expand Down
8 changes: 4 additions & 4 deletions functions/models/src/types/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export const videoConverter = new Lazy(
title: localizedTextConverter.schema,
youtubeId: localizedTextConverter.schema,
orderIndex: z.number(),
description: z.string(),
description: localizedTextConverter.schema,
})
.transform((content) => new Video(content)),
encode: (object) => ({
title: localizedTextConverter.encode(object.title),
youtubeId: localizedTextConverter.encode(object.youtubeId),
orderIndex: object.orderIndex,
description: object.description,
description: localizedTextConverter.encode(object.description),
}),
}),
)
Expand All @@ -37,15 +37,15 @@ export class Video {
readonly title: LocalizedText
readonly youtubeId: LocalizedText
readonly orderIndex: number
readonly description: string
readonly description: LocalizedText

// Constructor

constructor(input: {
title: LocalizedText
youtubeId: LocalizedText
orderIndex: number
description: string
description: LocalizedText
}) {
this.title = input.title
this.youtubeId = input.youtubeId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class StaticDataService extends SeedingService {
title: localizedTextConverter.schema,
youtubeId: localizedTextConverter.schema,
orderIndex: z.number(),
description: z.string(),
description: localizedTextConverter.schema,
})
.array(),
}),
Expand Down
Loading