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) {
|
||||
const { user, form, isCreate } = config;
|
||||
const { form, isCreate } = config;
|
||||
|
||||
const fd = new FormData();
|
||||
fd.append("teamId", user.teamId);
|
||||
fd.append("userId", user._id);
|
||||
fd.append("type", form.type);
|
||||
form.isPublished !== undefined && fd.append("isPublished", form.isPublished);
|
||||
form.companyName && fd.append("companyName", form.companyName);
|
||||
|
||||
@@ -24,7 +24,13 @@ class StatusPageController {
|
||||
}
|
||||
|
||||
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({
|
||||
msg: this.stringService.statusPageCreate,
|
||||
data: statusPage,
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
import StatusPage from "../../models/StatusPage.js";
|
||||
import Monitor from "../../models/Monitor.js";
|
||||
import { NormalizeData } from "../../../utils/dataUtils.js";
|
||||
import ServiceRegistry from "../../../service/serviceRegistry.js";
|
||||
import StringService from "../../../service/stringService.js";
|
||||
|
||||
const SERVICE_NAME = "statusPageModule";
|
||||
|
||||
const createStatusPage = async (statusPageData, image) => {
|
||||
const createStatusPage = async ({ statusPageData, image, userId, teamId }) => {
|
||||
const stringService = ServiceRegistry.get(StringService.SERVICE_NAME);
|
||||
|
||||
try {
|
||||
const statusPage = new StatusPage({ ...statusPageData });
|
||||
const statusPage = new StatusPage({
|
||||
...statusPageData,
|
||||
userId,
|
||||
teamId,
|
||||
});
|
||||
if (image) {
|
||||
statusPage.logo = {
|
||||
data: image.buffer,
|
||||
|
||||
@@ -424,8 +424,6 @@ const getStatusPageQueryValidation = joi.object({
|
||||
});
|
||||
|
||||
const createStatusPageBodyValidation = joi.object({
|
||||
userId: joi.string().required(),
|
||||
teamId: joi.string().required(),
|
||||
type: joi.string().valid("uptime").required(),
|
||||
companyName: joi.string().required(),
|
||||
url: joi
|
||||
|
||||
Reference in new issue
Block a user