From f1b60351929b02726a7a488461b71ab62a684006 Mon Sep 17 00:00:00 2001 From: inmake Date: Wed, 26 Mar 2025 13:33:37 +0500 Subject: [PATCH] upd --- client/src/components/Input.tsx | 2 +- client/src/components/ModalContainer.tsx | 2 +- .../components/modals/CreateBuildModal.tsx | 47 ++++++++++++++----- .../components/modals/CreateCompanyModal.tsx | 10 ++++ client/src/pages/AdminCompanyPage.tsx | 4 -- client/src/types/IBuild.ts | 1 - server/src/models/Build.ts | 6 --- server/src/routes/scheduledSessions.ts | 8 ++-- 8 files changed, 50 insertions(+), 30 deletions(-) diff --git a/client/src/components/Input.tsx b/client/src/components/Input.tsx index b7b0752..600e399 100644 --- a/client/src/components/Input.tsx +++ b/client/src/components/Input.tsx @@ -2,7 +2,7 @@ import { useMask } from "@react-input/mask"; interface InputProps { - type?: "text" | "email" | "password" | "time" | "tel"; + type?: "text" | "email" | "password" | "time" | "tel" | "number"; value?: string; placeholder?: string; autoFocus?: boolean; diff --git a/client/src/components/ModalContainer.tsx b/client/src/components/ModalContainer.tsx index 5d5bce1..44ece88 100644 --- a/client/src/components/ModalContainer.tsx +++ b/client/src/components/ModalContainer.tsx @@ -32,7 +32,7 @@ function ModalContainer() { > {(state) => (
{modal}
diff --git a/client/src/components/modals/CreateBuildModal.tsx b/client/src/components/modals/CreateBuildModal.tsx index bf3abd1..4ff83cd 100644 --- a/client/src/components/modals/CreateBuildModal.tsx +++ b/client/src/components/modals/CreateBuildModal.tsx @@ -5,6 +5,7 @@ import api from "../../utils/api"; import IError from "../../types/IError"; import IBuild from "../../types/IBuild"; import useModalStore from "../../stores/useModalStore"; +import Select3 from "../Select3"; interface Props { companyId: string; @@ -13,7 +14,6 @@ interface Props { function CreateBuildModal({ companyId }: Props) { const [name, setName] = useState(""); const [build, setBuild] = useState(""); - const [sessionLimit, setSessionLimit] = useState(1); const { setModal } = useModalStore(); function handleSubmit(e: FormEvent) { @@ -30,7 +30,6 @@ function CreateBuildModal({ companyId }: Props) { companyId, name, build, - sessionLimit, }, }) .json(); @@ -57,17 +56,39 @@ function CreateBuildModal({ companyId }: Props) { autoFocus required /> - setBuild(value)} - required - /> - setSessionLimit(+value)} + setBuild(option)} required />
diff --git a/client/src/components/modals/CreateCompanyModal.tsx b/client/src/components/modals/CreateCompanyModal.tsx index b006925..3cb94bc 100644 --- a/client/src/components/modals/CreateCompanyModal.tsx +++ b/client/src/components/modals/CreateCompanyModal.tsx @@ -8,6 +8,7 @@ import useModalStore from "../../stores/useModalStore"; function CreateCompanyModal() { const [name, setName] = useState(""); + const [sessionLimit, setSessionLimit] = useState(1); const { setModal } = useModalStore(); function handleSubmit(e: FormEvent) { @@ -22,6 +23,7 @@ function CreateCompanyModal() { .post(`admin/companies`, { json: { name, + sessionLimit, }, }) .json(); @@ -48,6 +50,14 @@ function CreateCompanyModal() { autoFocus required /> + setSessionLimit(+value)} + />
))} diff --git a/client/src/types/IBuild.ts b/client/src/types/IBuild.ts index 873145f..a4fa301 100644 --- a/client/src/types/IBuild.ts +++ b/client/src/types/IBuild.ts @@ -3,7 +3,6 @@ interface IBuild { companyId: string; build: string; name: string; - sessionLimit: number; } export default IBuild; diff --git a/server/src/models/Build.ts b/server/src/models/Build.ts index 3b031c2..79d8741 100644 --- a/server/src/models/Build.ts +++ b/server/src/models/Build.ts @@ -9,16 +9,10 @@ const buildSchema = new Schema( name: { type: String, required: true, - unique: true, }, build: { type: String, required: true, - unique: true, - }, - sessionLimit: { - type: Number, - required: true, }, }, { diff --git a/server/src/routes/scheduledSessions.ts b/server/src/routes/scheduledSessions.ts index a2998d0..6bec1b6 100644 --- a/server/src/routes/scheduledSessions.ts +++ b/server/src/routes/scheduledSessions.ts @@ -173,7 +173,7 @@ router.post("/", async (req, res) => { // send mail with defined transport object try { await transporter.sendMail({ - from: "stream@graff.tech", // sender address + from: "GRAFF.estate Stream ", // sender address to: client.email, // list of receivers subject: "Приглашение на демонстрацию - stream.graff.tech", // Subject line html: `
@@ -246,9 +246,9 @@ router.delete("/:id", async (req, res) => { const now = new Date(); if (now > tenMinutesAfterStart) { - return res.json({ - status: "error", - message: "Cannot delete session after 10 minutes from start" + return res.json({ + status: "error", + message: "Cannot delete session after 10 minutes from start", }); }