Add teamID to monitor on creation
This commit is contained in:
1 parent
a02f547b2c
commit
e658b4759a
3 files changed
+4
-1
No files matched your search
@@ -118,9 +118,11 @@ const CreateMonitor = () => {
|
|||||||
form = {
|
form = {
|
||||||
...form,
|
...form,
|
||||||
description: form.name,
|
description: form.name,
|
||||||
|
teamId: user.teamId,
|
||||||
userId: user._id,
|
userId: user._id,
|
||||||
notifications: monitor.notifications,
|
notifications: monitor.notifications,
|
||||||
};
|
};
|
||||||
|
console.log(form);
|
||||||
const action = await dispatch(
|
const action = await dispatch(
|
||||||
createUptimeMonitor({ authToken, monitor: form })
|
createUptimeMonitor({ authToken, monitor: form })
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -364,10 +364,10 @@ const getMonitorsByUserId = async (req, res) => {
|
|||||||
*/
|
*/
|
||||||
const createMonitor = async (req, res) => {
|
const createMonitor = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
|
console.log(req.body);
|
||||||
const monitor = new Monitor({ ...req.body });
|
const monitor = new Monitor({ ...req.body });
|
||||||
// Remove notifications fom monitor as they aren't needed here
|
// Remove notifications fom monitor as they aren't needed here
|
||||||
monitor.notifications = undefined;
|
monitor.notifications = undefined;
|
||||||
monitor.userId = req.user._id;
|
|
||||||
await monitor.save();
|
await monitor.save();
|
||||||
return monitor;
|
return monitor;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ const getMonitorsByUserIdQueryValidation = joi.object({
|
|||||||
const createMonitorBodyValidation = joi.object({
|
const createMonitorBodyValidation = joi.object({
|
||||||
_id: joi.string(),
|
_id: joi.string(),
|
||||||
userId: joi.string().required(),
|
userId: joi.string().required(),
|
||||||
|
teamId: joi.string().required(),
|
||||||
name: joi.string().required(),
|
name: joi.string().required(),
|
||||||
description: joi.string().required(),
|
description: joi.string().required(),
|
||||||
type: joi.string().required(),
|
type: joi.string().required(),
|
||||||
|
|||||||
Reference in new issue
Block a user