mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
remove strict mode
This commit is contained in:
parent
f258860e7f
commit
22f6fa1baa
@ -10,9 +10,7 @@ const root: any = ReactDOM.createRoot(
|
||||
);
|
||||
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
@ -22,10 +22,45 @@ export class Service extends DatabaseService<Model> {
|
||||
protected override async onBeforeCreate(
|
||||
data: CreateBy<Model>
|
||||
): Promise<OnCreate<Model>> {
|
||||
|
||||
if (!data.data.statusPageId) {
|
||||
throw new BadDataException('Status Page ID is required.');
|
||||
}
|
||||
|
||||
if (data.data.subscriberEmail) {
|
||||
const subscriber: Model | null = await this.findOneBy({
|
||||
query: {
|
||||
statusPageId: data.data.statusPageId,
|
||||
subscriberEmail: data.data.subscriberEmail
|
||||
},
|
||||
select: {
|
||||
_id: true,
|
||||
isUnsubscribed: true
|
||||
},
|
||||
props: {
|
||||
isRoot: true,
|
||||
ignoreHooks: true
|
||||
}
|
||||
});
|
||||
|
||||
if (subscriber && !subscriber.isUnsubscribed) {
|
||||
throw new BadDataException("You are already subscribed to this status page.");
|
||||
}
|
||||
|
||||
// if the user is unsubscribed, delete this record and it'll create a new one.
|
||||
|
||||
await this.deleteOneBy({
|
||||
query: {
|
||||
_id: subscriber?._id!
|
||||
},
|
||||
props: {
|
||||
ignoreHooks: true,
|
||||
isRoot: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const statuspage: StatusPage | null =
|
||||
await StatusPageService.findOneById({
|
||||
id: data.data.statusPageId,
|
||||
@ -45,6 +80,8 @@ export class Service extends DatabaseService<Model> {
|
||||
throw new BadDataException('Status Page not found');
|
||||
}
|
||||
|
||||
|
||||
|
||||
data.data.projectId = statuspage.projectId;
|
||||
|
||||
return { createBy: data, carryForward: statuspage };
|
||||
|
@ -9,9 +9,7 @@ const root: any = ReactDOM.createRoot(
|
||||
);
|
||||
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user