feat: podpora notifikací z notify

This commit is contained in:
Reallag authored and Martin Berka committed 2023-10-15 20:28:58 +02:00
1 parent 3460d69899
commit 6d89858e3e
7 files changed
+116 -17

No files matched your search

+22 -1
View File
@@ -1,3 +1,5 @@
import { Choices } from "../../types";
/** Vrátí datum v ISO formátu. */
export function formatDate(date: Date) {
let currentDay = String(date.getDate()).padStart(2, '0');
@@ -106,4 +108,23 @@ export const checkBodyParams = (req: any, paramNames: string[]) => {
// TODO umístit do samostatného souboru
export class InsufficientPermissions extends Error { }
export class InsufficientPermissions extends Error { }
export const getUsersByLocation = (data: Choices, login: string): string[] => {
const result: string[] = [];
for (const location in data) {
if (data.hasOwnProperty(location)) {
if (data[location][login]) {
for (const username in data[location]) {
if (data[location].hasOwnProperty(username)) {
result.push(username);
}
}
break;
}
}
}
return result;
}