Skip to content

Commit

Permalink
Localized video description (#182)
Browse files Browse the repository at this point in the history
# Localized video description

## ♻️ Current situation & Problem
*Link any open issues or pull requests (PRs) related to this PR. Please
ensure that all non-trivial PRs are first tracked and discussed in an
existing GitHub issue or discussion.*


## ⚙️ Release Notes 
*Add a bullet point list summary of the feature and possible migration
guides if this is a breaking change so this section can be added to the
release notes.*
*Include code snippets that provide examples of the feature implemented
or links to the documentation if it appends or changes the public
interface.*


## 📚 Documentation
*Please ensure that you properly document any additions in conformance
to [Spezi Documentation
Guide](https://github.com/StanfordSpezi/.github/blob/main/DOCUMENTATIONGUIDE.md).*
*You can use this section to describe your solution, but we encourage
contributors to document your reasoning and changes using in-line
documentation.*


## ✅ Testing
*Please ensure that the PR meets the testing requirements set by CodeCov
and that new functionality is appropriately tested.*
*This section describes important information about the tests and why
some elements might not be testable.*


### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
pauljohanneskraft authored Nov 10, 2024
1 parent c5f159a commit d348a61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
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

0 comments on commit d348a61

Please sign in to comment.