Compare commits
2 Commits
e611d36995
...
feat/enumF
| Author | SHA1 | Date | |
|---|---|---|---|
| bc039a361d | |||
| fd9aa547e2 |
@@ -194,9 +194,9 @@ function App() {
|
||||
}, [auth?.login, easterEgg?.duration, easterEgg?.url, eggImage]);
|
||||
|
||||
const doAddChoice = async (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
const index = Object.keys(Locations).indexOf(event.target.value as unknown as Locations);
|
||||
const locationKey = event.target.value as Locations;
|
||||
if (auth?.login) {
|
||||
await errorHandler(() => addChoice(index, undefined, dayIndex));
|
||||
await errorHandler(() => addChoice(locationKey, undefined, dayIndex));
|
||||
if (foodChoiceRef.current?.value) {
|
||||
foodChoiceRef.current.value = "";
|
||||
}
|
||||
@@ -211,17 +211,16 @@ function App() {
|
||||
|
||||
const doAddFoodChoice = async (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
if (event.target.value && foodChoiceList?.length && choiceRef.current?.value) {
|
||||
const restaurantKey = choiceRef.current.value;
|
||||
const locationKey = choiceRef.current.value as Locations;
|
||||
if (auth?.login) {
|
||||
const locationIndex = Object.keys(Locations).indexOf(restaurantKey as unknown as Locations);
|
||||
await errorHandler(() => addChoice(locationIndex, Number(event.target.value), dayIndex));
|
||||
await errorHandler(() => addChoice(locationKey, Number(event.target.value), dayIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const doRemoveChoices = async (locationKey: string) => {
|
||||
const doRemoveChoices = async (locationKey: Locations) => {
|
||||
if (auth?.login) {
|
||||
await errorHandler(() => removeChoices(Number(locationKey), dayIndex));
|
||||
await errorHandler(() => removeChoices(locationKey, dayIndex));
|
||||
// Vyresetujeme výběr, aby bylo jasné pro který případně vybíráme jídlo
|
||||
if (choiceRef?.current?.value) {
|
||||
choiceRef.current.value = "";
|
||||
@@ -232,9 +231,9 @@ function App() {
|
||||
}
|
||||
}
|
||||
|
||||
const doRemoveFoodChoice = async (locationKey: string, foodIndex: number) => {
|
||||
const doRemoveFoodChoice = async (locationKey: Locations, foodIndex: number) => {
|
||||
if (auth?.login) {
|
||||
await errorHandler(() => removeChoice(Number(locationKey), foodIndex, dayIndex));
|
||||
await errorHandler(() => removeChoice(locationKey, foodIndex, dayIndex));
|
||||
if (choiceRef?.current?.value) {
|
||||
choiceRef.current.value = "";
|
||||
}
|
||||
@@ -459,11 +458,21 @@ function App() {
|
||||
{Object.keys(data.choices).length > 0 ?
|
||||
<Table bordered className='mt-5'>
|
||||
<tbody>
|
||||
{Object.keys(data.choices).map((locationKey: string) => {
|
||||
const locationName = Object.values(Locations)[Number(locationKey)];
|
||||
const locationLoginList = Object.entries(data.choices[Number(locationKey)]);
|
||||
{Object.keys(data.choices).map(key => {
|
||||
const locationKey = key as keyof typeof Locations;
|
||||
console.log("Mapuji location key", locationKey);
|
||||
const locationName = Locations[locationKey];
|
||||
console.log("Location name", locationName);
|
||||
console.log("Obsah data.choices", data.choices);
|
||||
const loginObject = data.choices[locationKey];
|
||||
// TODO toto je hovnokód, mělo by to být napsané tak, aby si na to TypeScript nemohl stěžovat
|
||||
if (!loginObject) {
|
||||
return;
|
||||
}
|
||||
const locationLoginList = Object.entries(loginObject);
|
||||
console.log("Entries", locationLoginList);
|
||||
return (
|
||||
<tr key={locationKey}>
|
||||
<tr key={key}>
|
||||
<td>{locationName}</td>
|
||||
<td className='p-0'>
|
||||
<Table>
|
||||
@@ -485,20 +494,20 @@ function App() {
|
||||
setNoteModalOpen(true);
|
||||
}} title='Upravit poznámku' className='action-icon' icon={faNoteSticky} />}
|
||||
{login === auth.login && canChangeChoice && <FontAwesomeIcon onClick={() => {
|
||||
doRemoveChoices(locationKey);
|
||||
doRemoveChoices(key as Locations); // TODO dořešit
|
||||
}} title={`Odstranit volbu ${locationName}, včetně případných zvolených jídel`} className='action-icon' icon={faTrashCan} />}
|
||||
</td>
|
||||
{userChoices?.length && food ? <td>
|
||||
<ul>
|
||||
{userChoices?.map(foodIndex => {
|
||||
const locationsKey = Object.keys(Locations)[Number(locationKey)]
|
||||
const locationsKey = Object.keys(Locations)[Number(key)]
|
||||
const restaurantKey = Object.keys(Restaurants).indexOf(locationsKey);
|
||||
const restaurant = Object.values(Restaurants)[restaurantKey];
|
||||
const foodName = food[restaurant]?.food[foodIndex].name;
|
||||
return <li key={foodIndex}>
|
||||
{foodName}
|
||||
{login === auth.login && canChangeChoice && <FontAwesomeIcon onClick={() => {
|
||||
doRemoveFoodChoice(locationKey, foodIndex);
|
||||
doRemoveFoodChoice(key as Locations, foodIndex); // TODO dořešit
|
||||
}} title={`Odstranit ${foodName}`} className='action-icon' icon={faTrashCan} />}
|
||||
</li>
|
||||
})}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { AddChoiceRequest, ChangeDepartureTimeRequest, RemoveChoiceRequest, RemoveChoicesRequest, UpdateNoteRequest } from "../types";
|
||||
import { AddChoiceRequest, ChangeDepartureTimeRequest, Locations, RemoveChoiceRequest, RemoveChoicesRequest, UpdateNoteRequest } from "../types";
|
||||
import { api } from "./Api";
|
||||
|
||||
const FOOD_API_PREFIX = '/api/food';
|
||||
|
||||
export const addChoice = async (locationIndex: number, foodIndex?: number, dayIndex?: number) => {
|
||||
return await api.post<AddChoiceRequest, void>(`${FOOD_API_PREFIX}/addChoice`, { locationIndex, foodIndex, dayIndex });
|
||||
export const addChoice = async (locationKey: keyof typeof Locations, foodIndex?: number, dayIndex?: number) => {
|
||||
return await api.post<AddChoiceRequest, void>(`${FOOD_API_PREFIX}/addChoice`, { locationKey, foodIndex, dayIndex });
|
||||
}
|
||||
|
||||
export const removeChoices = async (locationIndex: number, dayIndex?: number) => {
|
||||
return await api.post<RemoveChoicesRequest, void>(`${FOOD_API_PREFIX}/removeChoices`, { locationIndex, dayIndex });
|
||||
export const removeChoices = async (locationKey: keyof typeof Locations, dayIndex?: number) => {
|
||||
return await api.post<RemoveChoicesRequest, void>(`${FOOD_API_PREFIX}/removeChoices`, { locationKey, dayIndex });
|
||||
}
|
||||
|
||||
export const removeChoice = async (locationIndex: number, foodIndex: number, dayIndex?: number) => {
|
||||
return await api.post<RemoveChoiceRequest, void>(`${FOOD_API_PREFIX}/removeChoice`, { locationIndex, foodIndex, dayIndex });
|
||||
export const removeChoice = async (locationKey: keyof typeof Locations, foodIndex: number, dayIndex?: number) => {
|
||||
return await api.post<RemoveChoiceRequest, void>(`${FOOD_API_PREFIX}/removeChoice`, { locationKey, foodIndex, dayIndex });
|
||||
}
|
||||
|
||||
export const updateNote = async (note?: string, dayIndex?: number) => {
|
||||
|
||||
@@ -33,7 +33,6 @@ const router = express.Router();
|
||||
router.post("/addChoice", async (req: Request<{}, any, AddChoiceRequest>, res, next) => {
|
||||
const login = getLogin(parseToken(req));
|
||||
const trusted = getTrusted(parseToken(req));
|
||||
if (req.body.locationIndex > -1) {
|
||||
let date = undefined;
|
||||
if (req.body.dayIndex != null) {
|
||||
let dayIndex;
|
||||
@@ -45,12 +44,10 @@ router.post("/addChoice", async (req: Request<{}, any, AddChoiceRequest>, res, n
|
||||
date = getDateForWeekIndex(dayIndex);
|
||||
}
|
||||
try {
|
||||
const data = await addChoice(login, trusted, req.body.locationIndex, req.body.foodIndex, date);
|
||||
const data = await addChoice(login, trusted, req.body.locationKey, req.body.foodIndex, date);
|
||||
getWebsocket().emit("message", await addVolatileData(data));
|
||||
return res.status(200).json(data);
|
||||
} catch (e: any) { next(e) }
|
||||
}
|
||||
return res.status(400); // TODO přidat popis chyby
|
||||
});
|
||||
|
||||
router.post("/removeChoices", async (req: Request<{}, any, RemoveChoicesRequest>, res, next) => {
|
||||
@@ -67,7 +64,7 @@ router.post("/removeChoices", async (req: Request<{}, any, RemoveChoicesRequest>
|
||||
date = getDateForWeekIndex(dayIndex);
|
||||
}
|
||||
try {
|
||||
const data = await removeChoices(login, trusted, req.body.locationIndex, date);
|
||||
const data = await removeChoices(login, trusted, req.body.locationKey, date);
|
||||
getWebsocket().emit("message", await addVolatileData(data));
|
||||
res.status(200).json(data);
|
||||
} catch (e: any) { next(e) }
|
||||
@@ -87,7 +84,7 @@ router.post("/removeChoice", async (req: Request<{}, any, RemoveChoiceRequest>,
|
||||
date = getDateForWeekIndex(dayIndex);
|
||||
}
|
||||
try {
|
||||
const data = await removeChoice(login, trusted, req.body.locationIndex, req.body.foodIndex, date);
|
||||
const data = await removeChoice(login, trusted, req.body.locationKey, req.body.foodIndex, date);
|
||||
getWebsocket().emit("message", await addVolatileData(data));
|
||||
res.status(200).json(data);
|
||||
} catch (e: any) { next(e) }
|
||||
|
||||
@@ -192,19 +192,19 @@ export async function initIfNeeded(date?: Date) {
|
||||
*
|
||||
* @param login login uživatele
|
||||
* @param trusted příznak, zda se jedná o ověřeného uživatele
|
||||
* @param locationIndex vybrané "umístění"
|
||||
* @param locationKey vybrané "umístění"
|
||||
* @param date datum, ke kterému se volba vztahuje
|
||||
* @returns
|
||||
*/
|
||||
export async function removeChoices(login: string, trusted: boolean, locationIndex: number, date?: Date) {
|
||||
export async function removeChoices(login: string, trusted: boolean, locationKey: keyof typeof Locations, date?: Date) {
|
||||
const selectedDay = formatDate(date ?? getToday());
|
||||
let data: DayData = await storage.getData(selectedDay);
|
||||
validateTrusted(data, login, trusted);
|
||||
if (locationIndex in data.choices) {
|
||||
if (login in data.choices[locationIndex]) {
|
||||
delete data.choices[locationIndex][login]
|
||||
if (Object.keys(data.choices[locationIndex]).length === 0) {
|
||||
delete data.choices[locationIndex]
|
||||
if (locationKey in data.choices) {
|
||||
if (data.choices[locationKey] && login in data.choices[locationKey]) {
|
||||
delete data.choices[locationKey][login]
|
||||
if (Object.keys(data.choices[locationKey]).length === 0) {
|
||||
delete data.choices[locationKey]
|
||||
}
|
||||
await storage.setData(selectedDay, data);
|
||||
}
|
||||
@@ -218,20 +218,20 @@ export async function removeChoices(login: string, trusted: boolean, locationInd
|
||||
*
|
||||
* @param login login uživatele
|
||||
* @param trusted příznak, zda se jedná o ověřeného uživatele
|
||||
* @param locationIndex vybrané "umístění"
|
||||
* @param locationKey vybrané "umístění"
|
||||
* @param foodIndex index jídla v jídelním lístku daného umístění, pokud existuje
|
||||
* @param date datum, ke kterému se volba vztahuje
|
||||
* @returns
|
||||
*/
|
||||
export async function removeChoice(login: string, trusted: boolean, locationIndex: number, foodIndex: number, date?: Date) {
|
||||
export async function removeChoice(login: string, trusted: boolean, locationKey: keyof typeof Locations, foodIndex: number, date?: Date) {
|
||||
const selectedDay = formatDate(date ?? getToday());
|
||||
let data: DayData = await storage.getData(selectedDay);
|
||||
validateTrusted(data, login, trusted);
|
||||
if (locationIndex in data.choices) {
|
||||
if (login in data.choices[locationIndex]) {
|
||||
const index = data.choices[locationIndex][login].options.indexOf(foodIndex);
|
||||
if (locationKey in data.choices) {
|
||||
if (data.choices[locationKey] && login in data.choices[locationKey]) {
|
||||
const index = data.choices[locationKey][login].options.indexOf(foodIndex);
|
||||
if (index > -1) {
|
||||
data.choices[locationIndex][login].options.splice(index, 1)
|
||||
data.choices[locationKey][login].options.splice(index, 1)
|
||||
await storage.setData(selectedDay, data);
|
||||
}
|
||||
}
|
||||
@@ -247,10 +247,11 @@ export async function removeChoice(login: string, trusted: boolean, locationInde
|
||||
async function removeChoiceIfPresent(login: string, date: string) {
|
||||
let data: DayData = await storage.getData(date);
|
||||
for (const key of Object.keys(data.choices)) {
|
||||
if (login in data.choices[key]) {
|
||||
delete data.choices[key][login];
|
||||
if (Object.keys(data.choices[key]).length === 0) {
|
||||
delete data.choices[key];
|
||||
const locationKey = key as keyof typeof Locations;
|
||||
if (data.choices[locationKey] && login in data.choices[locationKey]) {
|
||||
delete data.choices[locationKey][login];
|
||||
if (Object.keys(data.choices[locationKey]).length === 0) {
|
||||
delete data.choices[locationKey];
|
||||
}
|
||||
await storage.setData(date, data);
|
||||
}
|
||||
@@ -285,13 +286,13 @@ function validateTrusted(data: ClientData, login: string, trusted: boolean) {
|
||||
*
|
||||
* @param login login uživatele
|
||||
* @param trusted příznak, zda se jedná o ověřeného uživatele
|
||||
* @param locationIndex vybrané "umístění"
|
||||
* @param locationKey vybrané "umístění"
|
||||
* @param foodIndex volitelný index jídla v daném umístění
|
||||
* @param trusted příznak, zda se jedná o ověřeného uživatele
|
||||
* @param date datum, ke kterému se volba vztahuje
|
||||
* @returns aktuální data
|
||||
*/
|
||||
export async function addChoice(login: string, trusted: boolean, locationIndex: number, foodIndex?: number, date?: Date) {
|
||||
export async function addChoice(login: string, trusted: boolean, locationKey: keyof typeof Locations, foodIndex?: number, date?: Date) {
|
||||
const usedDate = date ?? getToday();
|
||||
await initIfNeeded(usedDate);
|
||||
const selectedDate = formatDate(usedDate);
|
||||
@@ -301,18 +302,29 @@ export async function addChoice(login: string, trusted: boolean, locationIndex:
|
||||
if (foodIndex == null) {
|
||||
data = await removeChoiceIfPresent(login, selectedDate);
|
||||
}
|
||||
if (!(locationIndex in data.choices)) {
|
||||
data.choices[locationIndex] = {};
|
||||
if (!data.choices) {
|
||||
console.log("Klíč", Locations[locationKey]); // TODO smazat
|
||||
data.choices = {
|
||||
[Locations[locationKey]]: {}
|
||||
}
|
||||
if (!(login in data.choices[locationIndex])) {
|
||||
data.choices[locationIndex][login] = {
|
||||
trusted,
|
||||
options: []
|
||||
};
|
||||
}
|
||||
if (foodIndex != null && !data.choices[locationIndex][login].options.includes(foodIndex)) {
|
||||
data.choices[locationIndex][login].options.push(foodIndex);
|
||||
}
|
||||
console.log("Máme choices", data.choices);
|
||||
console.log("Hodnota locationKey", locationKey);
|
||||
// if (!(data.choices[locationKey])) {
|
||||
// data?.choices[locationKey] = {}
|
||||
// }
|
||||
// if (!(login in data.choices[locationKey])) {
|
||||
// if (!data.choices[locationKey]) {
|
||||
// data.choices[locationKey] = {}
|
||||
// }
|
||||
// data.choices[locationKey][login] = {
|
||||
// trusted,
|
||||
// options: []
|
||||
// };
|
||||
// }
|
||||
// if (foodIndex != null && !data.choices[locationKey][login].options.includes(foodIndex)) {
|
||||
// data.choices[locationKey][login].options.push(foodIndex);
|
||||
// }
|
||||
await storage.setData(selectedDate, data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Choices } from "../../types";
|
||||
import { Choices, Locations } from "../../types";
|
||||
|
||||
/** Vrátí datum v ISO formátu. */
|
||||
export function formatDate(date: Date) {
|
||||
@@ -110,20 +110,22 @@ export const checkBodyParams = (req: any, paramNames: string[]) => {
|
||||
// TODO umístit do samostatného souboru
|
||||
export class InsufficientPermissions extends Error { }
|
||||
|
||||
export const getUsersByLocation = (data: Choices, login: string): string[] => {
|
||||
export const getUsersByLocation = (choices: 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;
|
||||
}
|
||||
}
|
||||
for (const location of Object.entries(choices)) {
|
||||
const locationKey = location[0];
|
||||
const locationValue = location[1];
|
||||
console.log("locationKey", locationKey);
|
||||
console.log("locationValue", locationValue);
|
||||
// if (locationValues[login]) {
|
||||
// for (const username in choices[locationKey]) {
|
||||
// if (choices[locationKey].hasOwnProperty(username)) {
|
||||
// result.push(username);
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
import { FeatureRequest, PizzaOrder } from "./Types";
|
||||
import { FeatureRequest, Locations, PizzaOrder } from "./Types";
|
||||
|
||||
export interface IDayIndex {
|
||||
export type ILocationKey = {
|
||||
locationKey: keyof typeof Locations,
|
||||
}
|
||||
|
||||
export type IDayIndex = {
|
||||
dayIndex?: number,
|
||||
}
|
||||
|
||||
export interface AddChoiceRequest extends IDayIndex {
|
||||
locationIndex: number,
|
||||
export type AddChoiceRequest = IDayIndex & ILocationKey & {
|
||||
foodIndex?: number,
|
||||
}
|
||||
|
||||
export interface RemoveChoicesRequest extends IDayIndex {
|
||||
locationIndex: number,
|
||||
}
|
||||
export type RemoveChoicesRequest = IDayIndex & ILocationKey;
|
||||
|
||||
export interface RemoveChoiceRequest extends IDayIndex {
|
||||
locationIndex: number,
|
||||
export type RemoveChoiceRequest = IDayIndex & ILocationKey & {
|
||||
foodIndex: number,
|
||||
}
|
||||
|
||||
export interface UpdateNoteRequest extends IDayIndex {
|
||||
export type UpdateNoteRequest = IDayIndex & {
|
||||
note?: string,
|
||||
}
|
||||
|
||||
export interface ChangeDepartureTimeRequest extends IDayIndex {
|
||||
export type ChangeDepartureTimeRequest = IDayIndex & {
|
||||
time: string,
|
||||
}
|
||||
|
||||
export interface FinishDeliveryRequest {
|
||||
export type FinishDeliveryRequest = {
|
||||
bankAccount?: string,
|
||||
bankAccountHolder?: string,
|
||||
}
|
||||
|
||||
export interface AddPizzaRequest {
|
||||
export type AddPizzaRequest = {
|
||||
pizzaIndex: number,
|
||||
pizzaSizeIndex: number,
|
||||
}
|
||||
|
||||
export interface RemovePizzaRequest {
|
||||
export type RemovePizzaRequest = {
|
||||
pizzaOrder: PizzaOrder,
|
||||
}
|
||||
|
||||
export interface UpdatePizzaDayNoteRequest {
|
||||
export type UpdatePizzaDayNoteRequest = {
|
||||
note?: string,
|
||||
}
|
||||
|
||||
export interface UpdatePizzaFeeRequest {
|
||||
export type UpdatePizzaFeeRequest = {
|
||||
login: string,
|
||||
text?: string,
|
||||
price?: number,
|
||||
}
|
||||
|
||||
export interface UpdateFeatureVoteRequest {
|
||||
export type UpdateFeatureVoteRequest = {
|
||||
option: FeatureRequest,
|
||||
active: boolean,
|
||||
}
|
||||
@@ -5,21 +5,21 @@ export enum Restaurants {
|
||||
TECHTOWER = 'techTower',
|
||||
}
|
||||
|
||||
export interface FoodChoices {
|
||||
export type FoodChoices = {
|
||||
trusted: boolean,
|
||||
options: number[],
|
||||
departureTime?: string,
|
||||
note?: string,
|
||||
}
|
||||
|
||||
export interface Choices {
|
||||
[location: string]: {
|
||||
export type Choices = {
|
||||
[location in keyof typeof Locations]?: {
|
||||
[login: string]: FoodChoices
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/** Velikost konkrétní pizzy */
|
||||
export interface PizzaSize {
|
||||
export type PizzaSize = {
|
||||
varId: number, // unikátní ID varianty pizzy
|
||||
size: string, // velikost pizzy, např. "30cm"
|
||||
pizzaPrice: number, // cena samotné pizzy
|
||||
@@ -28,14 +28,14 @@ export interface PizzaSize {
|
||||
}
|
||||
|
||||
/** Jedna konkrétní pizza */
|
||||
export interface Pizza {
|
||||
export type Pizza = {
|
||||
name: string, // název pizzy
|
||||
ingredients: string[], // seznam ingrediencí
|
||||
sizes: PizzaSize[], // dostupné velikosti pizzy
|
||||
}
|
||||
|
||||
/** Objednávka jedné konkrétní pizzy */
|
||||
export interface PizzaOrder {
|
||||
export type PizzaOrder = {
|
||||
varId: number, // unikátní ID varianty pizzy
|
||||
name: string, // název pizzy
|
||||
size: string, // velikost pizzy jako string (30cm)
|
||||
@@ -43,7 +43,7 @@ export interface PizzaOrder {
|
||||
}
|
||||
|
||||
/** Celková objednávka jednoho člověka */
|
||||
export interface Order {
|
||||
export type Order = {
|
||||
customer: string, // jméno objednatele
|
||||
pizzaList: PizzaOrder[], // seznam objednaných pizz
|
||||
fee?: { text?: string, price: number }, // příplatek (např. za extra ingredience)
|
||||
@@ -69,14 +69,14 @@ interface PizzaDay {
|
||||
}
|
||||
|
||||
/** Týdenní menu jednotlivých restaurací. */
|
||||
export interface WeekMenu {
|
||||
export type WeekMenu = {
|
||||
[dayIndex: number]: {
|
||||
[restaurant in Restaurants]?: DayMenu
|
||||
}
|
||||
}
|
||||
|
||||
/** Data vztahující se k jednomu konkrétnímu dni. */
|
||||
export interface DayData {
|
||||
export type DayData = {
|
||||
date: string, // datum dne
|
||||
isWeekend: boolean, // příznak, zda je datum víkend
|
||||
weekIndex: number, // index dne v týdnu (0-6)
|
||||
@@ -88,19 +88,19 @@ export interface DayData {
|
||||
}
|
||||
|
||||
/** Veškerá data pro zobrazení na klientovi. */
|
||||
export interface ClientData extends DayData {
|
||||
export type ClientData = DayData & {
|
||||
todayWeekIndex?: number, // index dnešního dne v týdnu (0-6)
|
||||
}
|
||||
|
||||
/** Nabídka jídel jednoho podniku pro jeden konkrétní den. */
|
||||
export interface DayMenu {
|
||||
export type DayMenu = {
|
||||
lastUpdate: number, // UNIX timestamp poslední aktualizace menu
|
||||
closed: boolean, // příznak, zda je daný podnik v tento den zavřený
|
||||
food: Food[], // seznam jídel v menu
|
||||
}
|
||||
|
||||
/** Jídlo z obědového menu restaurace. */
|
||||
export interface Food {
|
||||
export type Food = {
|
||||
amount?: string, // množství standardní porce, např. 0,33l nebo 150g
|
||||
name: string, // název/popis jídla
|
||||
price: string, // cena ve formátu '135 Kč'
|
||||
@@ -125,19 +125,19 @@ export enum UdalostEnum {
|
||||
JDEME_OBED = "Jdeme oběd",
|
||||
}
|
||||
|
||||
export interface NotififaceInput {
|
||||
export type NotififaceInput = {
|
||||
udalost: UdalostEnum,
|
||||
user: string,
|
||||
}
|
||||
|
||||
export interface NotifikaceData {
|
||||
export type NotifikaceData = {
|
||||
input: NotififaceInput,
|
||||
gotify?: boolean,
|
||||
teams?: boolean,
|
||||
ntfy?: boolean,
|
||||
}
|
||||
|
||||
export interface GotifyServer {
|
||||
export type GotifyServer = {
|
||||
server: string;
|
||||
api_keys: string[];
|
||||
}
|
||||
@@ -174,7 +174,7 @@ export enum FeatureRequest {
|
||||
DEVELOPMENT = "Zlepšení dokumentace/postupů pro ostatní vývojáře"
|
||||
}
|
||||
|
||||
export interface EasterEgg {
|
||||
export type EasterEgg = {
|
||||
path: string;
|
||||
url: string;
|
||||
startOffset: number;
|
||||
|
||||
Reference in New Issue
Block a user