Skip to content

Commit

Permalink
ignore case when searching textures
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Nov 11, 2023
1 parent b531068 commit 737b131
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/v2/repository/firestorm/texture.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,18 @@ export default class TextureFirestormRepository implements TextureRepository {
*/
if (name_or_id.startsWith("_") || name_or_id.endsWith("_")) {
return textures
.search([{ field: "name", criteria: "includes", value: name_or_id }])
.search([{ field: "name", criteria: "includes", value: name_or_id, ignoreCase: true }])
.then((texturesFound: Textures) => {
if (property === null) return texturesFound;
return Promise.all(texturesFound.map((t) => t[property]()));
});
}

return textures
.search([{ field: "name", criteria: "==", value: name_or_id }])
.search([{ field: "name", criteria: "==", value: name_or_id, ignoreCase: true }])
.then((res: Textures) => {
if (res.length === 0)
return textures.search([{ field: "name", criteria: "includes", value: name_or_id }]);
return textures.search([{ field: "name", criteria: "includes", value: name_or_id, ignoreCase: true }]);
return res;
})
.then((otherTexturesFound: Textures) => {
Expand Down
2 changes: 1 addition & 1 deletion src/v2/service/texture.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class TextureService {

getById(id: number, property: TextureProperty): Promise<Texture> {
if (Number.isNaN(id) || id < 0)
return Promise.reject(new Error("Texture IDs are integer greater than 0"));
return Promise.reject(new Error("Texture IDs are integers greater than 0"));
return this.textureRepo.getTextureById(id, property);
}

Expand Down

0 comments on commit 737b131

Please sign in to comment.