Skip to content

Commit

Permalink
fix: update LanguageISO6391 type usage in FilesMappers and commonSchemas
Browse files Browse the repository at this point in the history
  • Loading branch information
Joao-vi committed Feb 6, 2025
1 parent 526a037 commit ed99d0d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions app/api/files.v2/database/FilesMappers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LanguageUtils } from 'shared/language';
import { LanguageISO6391 } from 'shared/types/commonTypes';
import { FileDBOType } from './schemas/filesTypes';
import { UwaziFile } from '../model/UwaziFile';
import { Document } from '../model/Document';
Expand Down Expand Up @@ -43,7 +42,7 @@ export const FileMappers = {
fileDBO.entity,
fileDBO.totalPages,
fileDBO.filename,
LanguageUtils.fromISO639_3(fileDBO.language).ISO639_1 as LanguageISO6391
LanguageUtils.fromISO639_3(fileDBO.language).ISO639_1!
).withCreationDate(new Date(fileDBO.creationDate));
},
};
2 changes: 1 addition & 1 deletion app/shared/language/availableLanguages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type LanguageCode = 'elastic' | 'ISO639_3' | 'ISO639_1';
const otherLanguageSchema: LanguageSchema = {
label: 'Other',
key: 'other' as any,
ISO639_1: 'other',
ISO639_1: 'other' as any,
ISO639_3: 'other',
elastic: 'other',
localized_label: 'Other',
Expand Down
2 changes: 1 addition & 1 deletion app/shared/types/commonSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export const languageSchema = {
default: { type: 'boolean' },
ISO639_3: { type: 'string' },
elastic: { type: 'string' },
ISO639_1: { type: 'string' },
ISO639_1: LanguageISO6391Schema,
localized_label: { type: 'string' },
translationAvailable: { type: 'boolean' },
},
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?: string;
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?: string;
ISO639_1?: LanguageISO6391;
localized_label?: string;
translationAvailable?: boolean;
}[];
Expand Down

0 comments on commit ed99d0d

Please sign in to comment.