added support for image orientation filter (#4404)

* added support for image orientation filter
* Add orientation filtering to scenes
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
keenbed
2024-01-16 03:50:17 +01:00
committed by GitHub
parent aeb68a5851
commit 14bde44597
14 changed files with 157 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import { OrientationEnum } from "src/core/generated-graphql";
const stringOrientationMap = new Map<string, OrientationEnum>([
["Landscape", OrientationEnum.Landscape],
["Portrait", OrientationEnum.Portrait],
["Square", OrientationEnum.Square],
]);
export const stringToOrientation = (
value?: string | null,
caseInsensitive?: boolean
) => {
if (!value) {
return undefined;
}
const ret = stringOrientationMap.get(value);
if (ret || !caseInsensitive) {
return ret;
}
const asUpper = value.toUpperCase();
const foundEntry = Array.from(stringOrientationMap.entries()).find((e) => {
return e[0].toUpperCase() === asUpper;
});
if (foundEntry) {
return foundEntry[1];
}
};
export const orientationStrings = Array.from(stringOrientationMap.keys());