remove userID and teamID from status page

This commit is contained in:
Alex Holliday
2025-06-13 13:10:56 +08:00
parent 5e23a2b79c
commit 42372ab111
4 changed files with 14 additions and 9 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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