Skip to content

Commit

Permalink
fix: enforce required ISO639_1 field in language schemas and update u…
Browse files Browse the repository at this point in the history
…sage in FileMappers
  • Loading branch information
Joao-vi committed Feb 6, 2025
1 parent ed99d0d commit 317a121
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/api/files.v2/database/FilesMappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const FileMappers = {
fileDBO.entity,
fileDBO.totalPages,
fileDBO.filename,
LanguageUtils.fromISO639_3(fileDBO.language).ISO639_1!
LanguageUtils.fromISO639_3(fileDBO.language).ISO639_1
).withCreationDate(new Date(fileDBO.creationDate));
},
};
2 changes: 1 addition & 1 deletion app/shared/types/commonSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export const LanguageISO6391Schema = {

export const languageSchema = {
type: 'object',
required: ['key', 'label'],
required: ['key', 'label', 'ISO639_1'],
additionalProperties: false,
definitions: {
LanguageISO6391Schema,
Expand Down
4 changes: 2 additions & 2 deletions app/shared/types/commonTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export interface LanguageSchema {
default?: boolean;
ISO639_3?: string;
elastic?: string;
ISO639_1?: LanguageISO6391;
ISO639_1: LanguageISO6391;
localized_label?: string;
translationAvailable?: boolean;
}
Expand All @@ -258,7 +258,7 @@ export type LanguagesListSchema = {
default?: boolean;
ISO639_3?: string;
elastic?: string;
ISO639_1?: LanguageISO6391;
ISO639_1: LanguageISO6391;
localized_label?: string;
translationAvailable?: boolean;
}[];
Expand Down

0 comments on commit 317a121

Please sign in to comment.