Serializer exceptions, #build

Changed:
- Fixed missing channel_tags serializer
- Fixed download error message serializer
This commit is contained in:
Simon
2025-02-23 19:24:09 +07:00
6 changed files with 24 additions and 5 deletions

View File

@@ -240,3 +240,19 @@ services:
```
If you want to run queries on the Elasticsearch container directly from your host with for example `curl` or something like *postman*, you might want to **publish** the port 9200 instead of just **exposing** it.
**Persist Token**
The token will get stored in ES in the `config` folder, and not in the `data` folder. To persist the token between ES container rebuilds, you'll need to persist the config folder as an additional volume:
1. Create the token as described above
2. While the container is running, copy the current config folder out of the container, e.g.:
```
docker cp archivist-es:/usr/share/elasticsearch/config/ volume/es_config
```
3. Then stop all containers and mount this folder into the container as an additional volume:
```yml
- ./volume/es_config:/usr/share/elasticsearch/config
```
4. Start all containers back up.
Now your token will persist between ES container rebuilds.

View File

@@ -42,7 +42,9 @@ class ChannelSerializer(serializers.Serializer):
channel_overwrites = ChannelOverwriteSerializer(required=False)
channel_subs = serializers.IntegerField()
channel_subscribed = serializers.BooleanField()
channel_tags = serializers.ListField(child=serializers.CharField())
channel_tags = serializers.ListField(
child=serializers.CharField(), required=False
)
channel_views = serializers.IntegerField()
_index = serializers.CharField(required=False)
_score = serializers.IntegerField(required=False)

View File

@@ -57,7 +57,7 @@ class YoutubeChannel(YouTubeItem):
self.youtube_meta["thumbnails"].reverse()
self.json_data = {
"channel_active": True,
"channel_description": self.youtube_meta.get("description", False),
"channel_description": self.youtube_meta.get("description", ""),
"channel_id": self.youtube_id,
"channel_last_refresh": int(datetime.now().timestamp()),
"channel_name": self.youtube_meta["uploader"],
@@ -116,7 +116,7 @@ class YoutubeChannel(YouTubeItem):
"channel_id": self.youtube_id,
"channel_subscribed": False,
"channel_tags": [],
"channel_description": False,
"channel_description": "",
"channel_thumb_url": False,
"channel_views": 0,
}

View File

@@ -22,6 +22,7 @@ class DownloadItemSerializer(serializers.Serializer):
vid_thumb_url = serializers.CharField()
vid_type = serializers.ChoiceField(choices=VideoTypeEnum.values())
youtube_id = serializers.CharField()
message = serializers.CharField(required=False)
_index = serializers.CharField(required=False)
_score = serializers.IntegerField(required=False)

View File

@@ -222,7 +222,7 @@ const ChannelAbout = () => {
</div>
)}
{channel.channel_tags.length > 0 && (
{channel?.channel_tags && channel.channel_tags.length > 0 && (
<div className="description-box">
<div className="video-tag-box">
{channel.channel_tags.map(tag => {

View File

@@ -36,7 +36,7 @@ export type ChannelType = {
channel_overwrites?: ChannelOverwritesType;
channel_subs: number;
channel_subscribed: boolean;
channel_tags: string[];
channel_tags?: string[];
channel_thumb_url: string;
channel_tvart_url: string;
channel_views: number;