Skip to content

Commit

Permalink
[AB#45976] feat: publish image alt text (#379)
Browse files Browse the repository at this point in the history
* feat: publish image alt text

* test: updated unit tests
  • Loading branch information
axisuru authored Oct 14, 2024
1 parent d18bef3 commit c257ecc
Show file tree
Hide file tree
Showing 43 changed files with 2,469 additions and 17 deletions.
4 changes: 4 additions & 0 deletions libs/media-messages/schemas/payloads/channel/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
"height": {
"description": "Height of the image.",
"type": ["integer", "null"]
},
"alt_text": {
"description": "Alternative text for the image.",
"type": ["string", "null"]
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions libs/media-messages/schemas/payloads/publish/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@
"height": {
"description": "Height of the image in pixels.",
"type": ["integer", "null"]
},
"alt_text": {
"description": "Alternative text for the image.",
"type": ["string", "null"]
}
},
"required": ["type", "path"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@
"integer",
"null"
]
},
"alt_text": {
"description": "Alternative text for the image.",
"type": [
"string",
"null"
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@
"integer",
"null"
]
},
"alt_text": {
"description": "Alternative text for the image.",
"type": [
"string",
"null"
]
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
"integer",
"null"
]
},
"alt_text": {
"description": "Alternative text for the image.",
"type": [
"string",
"null"
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@
"integer",
"null"
]
},
"alt_text": {
"description": "Alternative text for the image.",
"type": [
"string",
"null"
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
"integer",
"null"
]
},
"alt_text": {
"description": "Alternative text for the image.",
"type": [
"string",
"null"
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@
"integer",
"null"
]
},
"alt_text": {
"description": "Alternative text for the image.",
"type": [
"string",
"null"
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
"integer",
"null"
]
},
"alt_text": {
"description": "Alternative text for the image.",
"type": [
"string",
"null"
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export interface DetailedImage {
* Height of the image.
*/
height?: number | null;
/**
* Alternative text for the image.
*/
alt_text?: string | null;

[k: string]: unknown;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ export interface Image {
* Height of the image in pixels.
*/
height?: number | null;
/**
* Alternative text for the image.
*/
alt_text?: string | null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--! Previous: sha1:fc9415fd1858d514f88cce07b2bd0be73c05d3e8
--! Hash: sha1:677b5e78a2bfb199af4c633568e2c80a8aebc78b
--! Message: image-alt-text-added

-- Media Service
ALTER TABLE app_public.movie_images
DROP COLUMN IF EXISTS alt_text CASCADE;

ALTER TABLE app_public.movie_images
ADD COLUMN alt_text TEXT;

ALTER TABLE app_public.tvshow_images
DROP COLUMN IF EXISTS alt_text CASCADE;

ALTER TABLE app_public.tvshow_images
ADD COLUMN alt_text TEXT;

ALTER TABLE app_public.season_images
DROP COLUMN IF EXISTS alt_text CASCADE;

ALTER TABLE app_public.season_images
ADD COLUMN alt_text TEXT;

ALTER TABLE app_public.episode_images
DROP COLUMN IF EXISTS alt_text CASCADE;

ALTER TABLE app_public.episode_images
ADD COLUMN alt_text TEXT;

ALTER TABLE app_public.collection_images
DROP COLUMN IF EXISTS alt_text CASCADE;

ALTER TABLE app_public.collection_images
ADD COLUMN alt_text TEXT;

-- Channel Service
ALTER TABLE app_public.channel_images
DROP COLUMN IF EXISTS alt_text CASCADE;

ALTER TABLE app_public.channel_images
ADD COLUMN alt_text TEXT;

ALTER TABLE app_public.program_images
DROP COLUMN IF EXISTS alt_text CASCADE;

ALTER TABLE app_public.program_images
ADD COLUMN alt_text TEXT;
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('ChannelPublishEventHandler', () => {
{
channel_id: payload.content_id,
},
{ columns: ['height', 'width', 'path', 'type'] },
{ columns: ['height', 'width', 'path', 'type', 'alt_text'] },
).run(ctx.ownerPool);
const { id: imageId, ...messageImage } = payload.images![0];
expect(image).toMatchObject(messageImage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class ChannelPublishedEventHandler extends TransactionalInboxMessageHandl
path: image.path,
width: image.width,
height: image.height,
alt_text: image.alt_text,
}),
),
).run(txnClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class PlaylistPublishedEventHandler extends TransactionalInboxMessageHand
path: p.image.path,
width: p.image.width,
height: p.image.height,
alt_text: p.image.alt_text,
},
});
}
Expand Down
21 changes: 14 additions & 7 deletions services/catalog/service/src/generated/db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,8 @@ CREATE TABLE app_public.channel_images (
type text,
path text,
width integer,
height integer
height integer,
alt_text text
);


Expand Down Expand Up @@ -2235,7 +2236,8 @@ CREATE TABLE app_public.collection_images (
type text,
path text,
width integer,
height integer
height integer,
alt_text text
);


Expand Down Expand Up @@ -2403,7 +2405,8 @@ CREATE TABLE app_public.episode_images (
type text,
path text,
width integer,
height integer
height integer,
alt_text text
);


Expand Down Expand Up @@ -2758,7 +2761,8 @@ CREATE TABLE app_public.movie_images (
type text,
path text,
width integer,
height integer
height integer,
alt_text text
);


Expand Down Expand Up @@ -3026,7 +3030,8 @@ CREATE TABLE app_public.program_images (
type text,
path text,
width integer,
height integer
height integer,
alt_text text
);


Expand Down Expand Up @@ -3162,7 +3167,8 @@ CREATE TABLE app_public.season_images (
type text,
path text,
width integer,
height integer
height integer,
alt_text text
);


Expand Down Expand Up @@ -3504,7 +3510,8 @@ CREATE TABLE app_public.tvshow_images (
type text,
path text,
width integer,
height integer
height integer,
alt_text text
);


Expand Down
Loading

0 comments on commit c257ecc

Please sign in to comment.