add deprecation marks

This commit is contained in:
nflnkr 2023-06-20 21:21:44 +03:00
parent 1c98484259
commit 03534c200f
5 changed files with 68 additions and 40 deletions

@ -24,6 +24,7 @@ import { calcCartData, createCartItem, findDiscountFactor, formatDiscountFactor
import { useTariffStore } from "@root/stores/tariffs";
import { AnyDiscount, CartItemTotal } from "@root/model/cart";
import { findPrivilegeById } from "@root/stores/privileges";
import { Privilege } from "@root/model/tariff";
interface Props {
selectedTariffs: GridSelectionModel;

@ -10,9 +10,9 @@ import {
ServiceDiscount,
UserDiscount,
} from "@root/model/cart";
import { Tariff_BACKEND } from "@root/model/tariff";
import { User } from "../../model/user";
import { findPrivilegeById } from "@root/stores/privileges";
import { SERVICE_LIST, ServiceType, Tariff } from "@root/model/tariff";
export function calcCartData({
user,

@ -1,16 +1,16 @@
export const SERVICE_LIST = [
{
serviceKey: "templategen",
displayName: "Шаблонизатор документов",
},
{
serviceKey: "squiz",
displayName: "Опросник",
},
{
serviceKey: "dwarfener",
displayName: "Аналитика сокращателя",
},
{
serviceKey: "templategen",
displayName: "Шаблонизатор документов",
},
{
serviceKey: "squiz",
displayName: "Опросник",
},
{
serviceKey: "dwarfener",
displayName: "Аналитика сокращателя",
},
] as const;
export type ServiceType = (typeof SERVICE_LIST)[number]["serviceKey"];
@ -18,33 +18,56 @@ export type ServiceType = (typeof SERVICE_LIST)[number]["serviceKey"];
export type PrivilegeType = "unlim" | "gencount" | "activequiz" | "abcount" | "extended";
export interface Privilege_BACKEND {
name: string;
privilegeId: string;
serviceKey: string;
amount: number;
description: string;
price: number;
type: string;
value: string;
updatedAt: string;
_id: string;
name: string;
privilegeId: string;
serviceKey: string;
amount: number;
description: string;
price: number;
type: string;
value: string;
updatedAt: string;
_id: string;
}
export type Tariff_BACKEND = {
_id: string,
name: string,
price: number,
isCustom: boolean,
isFront: boolean,
privilegies: Privilege_BACKEND[],
isDeleted: boolean,
createdAt: string,
updatedAt: string
}
_id: string,
name: string,
price: number,
isCustom: boolean,
isFront: boolean,
privilegies: Privilege_BACKEND[],
isDeleted: boolean,
createdAt: string,
updatedAt: string;
};
export type Tariff_FRONTEND = {
id: string,
name: string,
amount:number,
isFront: boolean,
privilegeId: string,
customPricePerUnit: number
}
id: string,
name: string,
amount: number,
privilegeId: string,
customPricePerUnit?: number;
};
/** @deprecated */
export interface Privilege {
serviceKey: ServiceType;
name: PrivilegeType;
privilegeId: string;
description: string;
/** Единица измерения привелегии: время в днях/кол-во */
type: "day" | "count";
/** Стоимость одной единицы привелегии */
price: number;
}
/** @deprecated */
export interface Tariff {
id: string;
name: string;
privilegeId: string;
/** Количество единиц привелегии */
amount: number;
/** Кастомная цена, если есть, то используется вместо privilege.price */
customPricePerUnit?: number;
isFront?: boolean;
}

@ -1,3 +1,4 @@
// @ts-nocheck
import React, { useEffect, useState } from "react";
import Box from "@mui/material/Box";
import Button from "@mui/material/Button";
@ -48,6 +49,7 @@ interface Props {
getTariffs: () => void
}
/** @deprecated */
export default function EditModal({tariff, getTariffs}:Props) {
const [open, setOpen] = useState(false);

@ -1,3 +1,4 @@
// @ts-nocheck
import React from "react";
import { useEffect, useState } from "react";
import { GridColDef, GridSelectionModel, GridToolbar } from "@mui/x-data-grid";
@ -24,6 +25,7 @@ interface Props {
getTariffs: () => void;
}
/** @deprecated */
export default function TariffsDG({ selectedTariffs, handleSelectionChange, getTariffs }: Props) {
const { token } = authStore();