remove userID and teamID from status page
This commit is contained in:
1 parent
5e23a2b79c
commit
42372ab111
4 files changed
+14
-9
No files matched your search
@@ -847,11 +847,9 @@ class NetworkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createStatusPage(config) {
|
async createStatusPage(config) {
|
||||||
const { user, form, isCreate } = config;
|
const { form, isCreate } = config;
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append("teamId", user.teamId);
|
|
||||||
fd.append("userId", user._id);
|
|
||||||
fd.append("type", form.type);
|
fd.append("type", form.type);
|
||||||
form.isPublished !== undefined && fd.append("isPublished", form.isPublished);
|
form.isPublished !== undefined && fd.append("isPublished", form.isPublished);
|
||||||
form.companyName && fd.append("companyName", form.companyName);
|
form.companyName && fd.append("companyName", form.companyName);
|
||||||
|
|||||||
@@ -24,7 +24,13 @@ class StatusPageController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const statusPage = await this.db.createStatusPage(req.body, req.file);
|
const { _id, teamId } = req.user;
|
||||||
|
const statusPage = await this.db.createStatusPage({
|
||||||
|
statusPageData: req.body,
|
||||||
|
image: req.file,
|
||||||
|
userId: _id,
|
||||||
|
teamId,
|
||||||
|
});
|
||||||
return res.success({
|
return res.success({
|
||||||
msg: this.stringService.statusPageCreate,
|
msg: this.stringService.statusPageCreate,
|
||||||
data: statusPage,
|
data: statusPage,
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
import StatusPage from "../../models/StatusPage.js";
|
import StatusPage from "../../models/StatusPage.js";
|
||||||
import Monitor from "../../models/Monitor.js";
|
|
||||||
import { NormalizeData } from "../../../utils/dataUtils.js";
|
import { NormalizeData } from "../../../utils/dataUtils.js";
|
||||||
import ServiceRegistry from "../../../service/serviceRegistry.js";
|
import ServiceRegistry from "../../../service/serviceRegistry.js";
|
||||||
import StringService from "../../../service/stringService.js";
|
import StringService from "../../../service/stringService.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "statusPageModule";
|
const SERVICE_NAME = "statusPageModule";
|
||||||
|
|
||||||
const createStatusPage = async (statusPageData, image) => {
|
const createStatusPage = async ({ statusPageData, image, userId, teamId }) => {
|
||||||
const stringService = ServiceRegistry.get(StringService.SERVICE_NAME);
|
const stringService = ServiceRegistry.get(StringService.SERVICE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const statusPage = new StatusPage({ ...statusPageData });
|
const statusPage = new StatusPage({
|
||||||
|
...statusPageData,
|
||||||
|
userId,
|
||||||
|
teamId,
|
||||||
|
});
|
||||||
if (image) {
|
if (image) {
|
||||||
statusPage.logo = {
|
statusPage.logo = {
|
||||||
data: image.buffer,
|
data: image.buffer,
|
||||||
|
|||||||
@@ -424,8 +424,6 @@ const getStatusPageQueryValidation = joi.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const createStatusPageBodyValidation = joi.object({
|
const createStatusPageBodyValidation = joi.object({
|
||||||
userId: joi.string().required(),
|
|
||||||
teamId: joi.string().required(),
|
|
||||||
type: joi.string().valid("uptime").required(),
|
type: joi.string().valid("uptime").required(),
|
||||||
companyName: joi.string().required(),
|
companyName: joi.string().required(),
|
||||||
url: joi
|
url: joi
|
||||||
|
|||||||
Reference in new issue
Block a user