feat: podpora notifikací z notify

This commit is contained in:
2023-10-12 19:09:32 +02:00
committed by Martin Berka
parent 3460d69899
commit 6d89858e3e
7 changed files with 116 additions and 17 deletions

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;
}