Migrace na OpenAPI - TypeScript typy
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
/** Notifikace */
|
||||
import { ClientData, NotififaceInput, NotifikaceData } from '../../types';
|
||||
import axios from 'axios';
|
||||
import dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
import { getToday } from "./service";
|
||||
import { formatDate, getUsersByLocation, getHumanTime } from "./utils";
|
||||
import { getClientData, getToday } from "./service";
|
||||
import { getUsersByLocation, getHumanTime } from "./utils";
|
||||
import getStorage from "./storage";
|
||||
import { NotifikaceData, NotifikaceInput } from '../../types';
|
||||
|
||||
const storage = getStorage();
|
||||
const ENVIRONMENT = process.env.NODE_ENV || 'production'
|
||||
@@ -54,7 +54,7 @@ dotenv.config({ path: path.resolve(__dirname, `../.env.${ENVIRONMENT}`) });
|
||||
// return promises;
|
||||
// };
|
||||
|
||||
export const ntfyCall = async (data: NotififaceInput) => {
|
||||
export const ntfyCall = async (data: NotifikaceInput) => {
|
||||
const url = process.env.NTFY_HOST
|
||||
const username = process.env.NTFY_USERNAME;
|
||||
const password = process.env.NTFY_PASSWD;
|
||||
@@ -70,8 +70,7 @@ export const ntfyCall = async (data: NotififaceInput) => {
|
||||
console.log("NTFY_PASSWD není definován v env")
|
||||
return
|
||||
}
|
||||
const today = formatDate(getToday());
|
||||
let clientData: ClientData = await storage.getData(today);
|
||||
let clientData = await getClientData(getToday());
|
||||
const userByCLocation = getUsersByLocation(clientData.choices, data.user)
|
||||
|
||||
const token = Buffer.from(`${username}:${password}`, 'utf8').toString('base64');
|
||||
@@ -98,7 +97,7 @@ export const ntfyCall = async (data: NotififaceInput) => {
|
||||
|
||||
}
|
||||
|
||||
export const teamsCall = async (data: NotififaceInput) => {
|
||||
export const teamsCall = async (data: NotifikaceInput) => {
|
||||
const url = process.env.TEAMS_WEBHOOK_URL;
|
||||
const title = data.udalost;
|
||||
let time = new Date();
|
||||
|
||||
Reference in New Issue
Block a user