upd
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
PORT=3000
|
||||
PORT=3001
|
||||
MONGO_URI=mongodb://root:p62Z!ZatgY25@194.26.138.94:27017/
|
||||
JWT_SECRET=yDcdWJgvlj2bJAuovYfQHTvtc3U9xQPw
|
||||
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "crm.stream.graff.tech-server",
|
||||
exec_mode: "cluster",
|
||||
script: "yarn",
|
||||
args: "start",
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -10,6 +10,7 @@ import companiesRouter from "./routes/companies.js";
|
||||
import scheduledSessionsRouter from "./routes/scheduledSessions.js";
|
||||
import usersRouter from "./routes/users.js";
|
||||
import buildsRouter from "./routes/builds.js";
|
||||
import actionsRouter from "./routes/actions.js";
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 3000;
|
||||
@@ -21,6 +22,7 @@ app.use(cors());
|
||||
|
||||
app.use("/login", loginRouter);
|
||||
app.use("/registration", registrationRouter);
|
||||
app.use("/actions", actionsRouter);
|
||||
app.use("/app", authMiddleware, appRouter);
|
||||
app.use("/companies", authMiddleware, companiesRouter);
|
||||
app.use("/users", authMiddleware, usersRouter);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { model, Schema } from "mongoose";
|
||||
|
||||
const actionSchema = new Schema(
|
||||
{
|
||||
sessionId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
required: true,
|
||||
},
|
||||
pointName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
toJSON: { virtuals: true },
|
||||
toObject: { virtuals: true },
|
||||
}
|
||||
);
|
||||
|
||||
const Action = model("Action", actionSchema);
|
||||
|
||||
export default Action;
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Router } from "express";
|
||||
import Action from "../models/Action.js";
|
||||
|
||||
const actionsRouter = Router();
|
||||
|
||||
actionsRouter.post("/", async (req, res) => {
|
||||
if (!req.body.sessionId) {
|
||||
res.json({ error: "'sessionId' parameter is required" });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!req.body.pointName) {
|
||||
res.json({ error: "'pointName' parameter is required" });
|
||||
return;
|
||||
}
|
||||
|
||||
const action = await Action.create({
|
||||
sessionId: req.body.sessionId,
|
||||
pointName: req.body.pointName,
|
||||
});
|
||||
|
||||
res.json(action);
|
||||
});
|
||||
|
||||
export default actionsRouter;
|
||||
Reference in New Issue
Block a user