1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00
pigallery2/src/common/PG2ConfMap.ts

35 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-08-28 23:50:41 +02:00
import {SortingByTypes, SortingMethod} from './entities/SortingMethods';
2023-08-29 22:14:38 +02:00
import {Utils} from './Utils';
/**
* This contains the action of the supported list of *.pg2conf files.
* These files are passed down to the client as metaFiles (like photos and directories)
*/
2023-08-29 22:14:38 +02:00
export const PG2ConfMap: { sorting: { [key: string]: SortingMethod } } = {
sorting: {}
};
2023-08-29 22:14:38 +02:00
Utils.enumToArray(SortingByTypes).forEach(kv => {
if (kv.key === SortingByTypes.random) {
PG2ConfMap.sorting['.order_random.pg2conf'] = {method: kv.key, ascending: null} as SortingMethod;
return;
}
PG2ConfMap.sorting['.order_descending' + kv.value.toLowerCase() + '.pg2conf'] = {method: kv.key, ascending: false} as SortingMethod;
PG2ConfMap.sorting['.order_ascending' + kv.value.toLowerCase() + '.pg2conf'] = {method: kv.key, ascending: true} as SortingMethod;
});
/**
* These files are processed on the server side,
* do not get passed down to the client or saved to the DB
*/
export enum ServerSidePG2ConfAction {
2021-05-30 18:18:24 +02:00
// Enum always starts from 1 as !!0 === false
2022-04-04 19:37:31 +02:00
SAVED_SEARCH = 1,
}
export const ServerPG2ConfMap: { [key: string]: ServerSidePG2ConfAction } = {
2022-04-04 19:37:31 +02:00
'.saved_searches.pg2conf': ServerSidePG2ConfAction.SAVED_SEARCH,
};