@oneuptime/common 7.0.3621 → 7.0.3655
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/Alert.ts +48 -0
- package/Models/DatabaseModels/Incident.ts +19 -0
- package/Models/DatabaseModels/Index.ts +10 -0
- package/Models/DatabaseModels/ScheduledMaintenance.ts +48 -0
- package/Models/DatabaseModels/WorkspaceNotificationRule.ts +461 -0
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +379 -0
- package/Models/DatabaseModels/WorkspaceSetting.ts +230 -0
- package/Models/DatabaseModels/WorkspaceUserAuthToken.ts +312 -0
- package/Server/API/SlackAPI.ts +368 -0
- package/Server/EnvironmentConfig.ts +10 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1739209832500-MigrationName.ts +147 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1739210586538-MigrationName.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1739217257089-MigrationName.ts +23 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1739282331053-MigrationName.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Middleware/SlackAuthorization.ts +60 -0
- package/Server/Services/AlertService.ts +38 -2
- package/Server/Services/Index.ts +9 -0
- package/Server/Services/ProjectService.ts +6 -4
- package/Server/Services/ScheduledMaintenanceService.ts +39 -2
- package/Server/Services/TeamMemberService.ts +1 -0
- package/Server/Services/UserService.ts +7 -2
- package/Server/Services/WorkspaceCommunicationTools/Slack.ts +0 -0
- package/Server/Services/WorkspaceCommunicationTools/Teams.ts +0 -0
- package/Server/Services/WorkspaceCommunicationTools/WorkspaceCommunicationBaseService.ts +0 -0
- package/Server/Services/WorkspaceNotificationRuleService.ts +31 -0
- package/Server/Services/WorkspaceProjectAuthTokenService.ts +84 -0
- package/Server/Services/WorkspaceSettingService.ts +78 -0
- package/Server/Services/WorkspaceUserAuthTokenService.ts +89 -0
- package/Server/Types/Workflow/Components/Slack/SendMessageToChannel.ts +2 -2
- package/Server/Utils/Express.ts +2 -1
- package/Server/Utils/Monitor/MonitorResource.ts +2 -5
- package/Server/Utils/Slack/Slack.ts +271 -0
- package/Server/Utils/Slack/app-manifest-temp.json +198 -0
- package/Server/Utils/Slack/app-manifest.json +67 -0
- package/Server/Utils/StartServer.ts +2 -1
- package/Types/Filter/FilterCondition.ts +2 -2
- package/Types/Monitor/CriteriaFilter.ts +31 -5
- package/Types/Monitor/MonitorCriteriaInstance.ts +40 -10
- package/Types/Monitor/MonitorStep.ts +1 -1
- package/Types/Permission.ts +34 -0
- package/Types/Workspace/NotificationRules/BaseNotificationRule.ts +3 -0
- package/Types/Workspace/NotificationRules/EventType.ts +8 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.ts +355 -0
- package/Types/Workspace/NotificationRules/SlackNotificationRule.ts +19 -0
- package/Types/Workspace/WorkspaceNotificationPayload.ts +29 -0
- package/Types/Workspace/WorkspaceType.ts +6 -0
- package/UI/Components/Forms/BasicForm.tsx +9 -0
- package/UI/Components/Forms/Fields/FormField.tsx +36 -1
- package/UI/Components/Forms/Types/Field.ts +2 -0
- package/UI/Components/Forms/Types/FormFieldSchemaType.ts +1 -1
- package/UI/Components/Forms/Utils/FormFieldSchemaTypeUtil.ts +2 -2
- package/UI/Components/Icon/Icon.tsx +18 -5
- package/UI/Components/Radio/Radio.tsx +12 -10
- package/UI/Config.ts +3 -0
- package/build/dist/Models/DatabaseModels/Alert.js +52 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Incident.js +21 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +8 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +52 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationRule.js +481 -0
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js +390 -0
- package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -0
- package/build/dist/Models/DatabaseModels/WorkspaceSetting.js +236 -0
- package/build/dist/Models/DatabaseModels/WorkspaceSetting.js.map +1 -0
- package/build/dist/Models/DatabaseModels/WorkspaceUserAuthToken.js +326 -0
- package/build/dist/Models/DatabaseModels/WorkspaceUserAuthToken.js.map +1 -0
- package/build/dist/Server/API/SlackAPI.js +237 -0
- package/build/dist/Server/API/SlackAPI.js.map +1 -0
- package/build/dist/Server/EnvironmentConfig.js +5 -1
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739209832500-MigrationName.js +58 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739209832500-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739210586538-MigrationName.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739210586538-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739217257089-MigrationName.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739217257089-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739282331053-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739282331053-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/SlackAuthorization.js +28 -0
- package/build/dist/Server/Middleware/SlackAuthorization.js.map +1 -0
- package/build/dist/Server/Services/AlertService.js +31 -5
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +8 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +5 -4
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +30 -3
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +1 -0
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +5 -2
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceCommunicationTools/Slack.js +2 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/Slack.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/Teams.js +2 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/Teams.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/WorkspaceCommunicationBaseService.js +2 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/WorkspaceCommunicationBaseService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +22 -0
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js +63 -0
- package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceSettingService.js +59 -0
- package/build/dist/Server/Services/WorkspaceSettingService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceUserAuthTokenService.js +66 -0
- package/build/dist/Server/Services/WorkspaceUserAuthTokenService.js.map +1 -0
- package/build/dist/Server/Types/Workflow/Components/Slack/SendMessageToChannel.js +2 -2
- package/build/dist/Server/Types/Workflow/Components/Slack/SendMessageToChannel.js.map +1 -1
- package/build/dist/Server/Utils/Express.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +2 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Slack/Slack.js +172 -0
- package/build/dist/Server/Utils/Slack/Slack.js.map +1 -0
- package/build/dist/Server/Utils/Slack/app-manifest.json +67 -0
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Types/Filter/FilterCondition.js +2 -2
- package/build/dist/Types/Filter/FilterCondition.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +19 -5
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +33 -10
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Permission.js +32 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationRules/BaseNotificationRule.js +2 -0
- package/build/dist/Types/Workspace/NotificationRules/BaseNotificationRule.js.map +1 -0
- package/build/dist/Types/Workspace/NotificationRules/EventType.js +9 -0
- package/build/dist/Types/Workspace/NotificationRules/EventType.js.map +1 -0
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js +275 -0
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js.map +1 -0
- package/build/dist/Types/Workspace/NotificationRules/SlackNotificationRule.js +2 -0
- package/build/dist/Types/Workspace/NotificationRules/SlackNotificationRule.js.map +1 -0
- package/build/dist/Types/Workspace/WorkspaceNotificationPayload.js +2 -0
- package/build/dist/Types/Workspace/WorkspaceNotificationPayload.js.map +1 -0
- package/build/dist/Types/Workspace/WorkspaceType.js +7 -0
- package/build/dist/Types/Workspace/WorkspaceType.js.map +1 -0
- package/build/dist/UI/Components/Forms/BasicForm.js +7 -0
- package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js +21 -4
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Forms/Types/FormFieldSchemaType.js +1 -1
- package/build/dist/UI/Components/Forms/Types/FormFieldSchemaType.js.map +1 -1
- package/build/dist/UI/Components/Forms/Utils/FormFieldSchemaTypeUtil.js +2 -2
- package/build/dist/UI/Components/Forms/Utils/FormFieldSchemaTypeUtil.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +5 -1
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Radio/Radio.js +4 -4
- package/build/dist/UI/Components/Radio/Radio.js.map +1 -1
- package/build/dist/UI/Config.js +1 -0
- package/build/dist/UI/Config.js.map +1 -1
- package/package.json +2 -2
- package/Server/Utils/Slack.ts +0 -29
- package/build/dist/Server/Utils/Slack.js +0 -20
- package/build/dist/Server/Utils/Slack.js.map +0 -1
|
@@ -1006,4 +1006,52 @@ export default class Alert extends BaseModel {
|
|
|
1006
1006
|
nullable: true,
|
|
1007
1007
|
})
|
|
1008
1008
|
public telemetryQuery?: TelemetryQuery = undefined;
|
|
1009
|
+
|
|
1010
|
+
@ColumnAccessControl({
|
|
1011
|
+
create: [
|
|
1012
|
+
Permission.ProjectOwner,
|
|
1013
|
+
Permission.ProjectAdmin,
|
|
1014
|
+
Permission.ProjectMember,
|
|
1015
|
+
Permission.CreateAlert,
|
|
1016
|
+
],
|
|
1017
|
+
read: [
|
|
1018
|
+
Permission.ProjectOwner,
|
|
1019
|
+
Permission.ProjectAdmin,
|
|
1020
|
+
Permission.ProjectMember,
|
|
1021
|
+
Permission.ReadAlert,
|
|
1022
|
+
],
|
|
1023
|
+
update: [],
|
|
1024
|
+
})
|
|
1025
|
+
@Index()
|
|
1026
|
+
@TableColumn({
|
|
1027
|
+
isDefaultValueColumn: false,
|
|
1028
|
+
required: false,
|
|
1029
|
+
type: TableColumnType.Number,
|
|
1030
|
+
title: "Alert Number",
|
|
1031
|
+
description: "Alert Number",
|
|
1032
|
+
})
|
|
1033
|
+
@Column({
|
|
1034
|
+
type: ColumnType.Number,
|
|
1035
|
+
nullable: true,
|
|
1036
|
+
})
|
|
1037
|
+
public alertNumber?: number = undefined;
|
|
1038
|
+
|
|
1039
|
+
@ColumnAccessControl({
|
|
1040
|
+
create: [],
|
|
1041
|
+
read: [],
|
|
1042
|
+
update: [],
|
|
1043
|
+
})
|
|
1044
|
+
@TableColumn({
|
|
1045
|
+
isDefaultValueColumn: false,
|
|
1046
|
+
required: false,
|
|
1047
|
+
type: TableColumnType.ShortText,
|
|
1048
|
+
title: "Post Updates To Slack Channel ID",
|
|
1049
|
+
description: "Post Updates To Slack Channel ID",
|
|
1050
|
+
})
|
|
1051
|
+
@Column({
|
|
1052
|
+
type: ColumnType.ShortText,
|
|
1053
|
+
length: ColumnLength.ShortText,
|
|
1054
|
+
nullable: true,
|
|
1055
|
+
})
|
|
1056
|
+
public postUpdatesToSlackChannelId?: number = undefined;
|
|
1009
1057
|
}
|
|
@@ -1120,4 +1120,23 @@ export default class Incident extends BaseModel {
|
|
|
1120
1120
|
nullable: true,
|
|
1121
1121
|
})
|
|
1122
1122
|
public incidentNumber?: number = undefined;
|
|
1123
|
+
|
|
1124
|
+
@ColumnAccessControl({
|
|
1125
|
+
create: [],
|
|
1126
|
+
read: [],
|
|
1127
|
+
update: [],
|
|
1128
|
+
})
|
|
1129
|
+
@TableColumn({
|
|
1130
|
+
isDefaultValueColumn: false,
|
|
1131
|
+
required: false,
|
|
1132
|
+
type: TableColumnType.ShortText,
|
|
1133
|
+
title: "Post Updates To Slack Channel ID",
|
|
1134
|
+
description: "Post Updates To Slack Channel ID",
|
|
1135
|
+
})
|
|
1136
|
+
@Column({
|
|
1137
|
+
type: ColumnType.ShortText,
|
|
1138
|
+
length: ColumnLength.ShortText,
|
|
1139
|
+
nullable: true,
|
|
1140
|
+
})
|
|
1141
|
+
public postUpdatesToSlackChannelId?: number = undefined;
|
|
1123
1142
|
}
|
|
@@ -161,10 +161,17 @@ import Dashboard from "./Dashboard";
|
|
|
161
161
|
import MonitorTest from "./MonitorTest";
|
|
162
162
|
import ScheduledMaintenanceFeed from "./ScheduledMaintenanceFeed";
|
|
163
163
|
|
|
164
|
+
import WorkspaceUserAuthToken from "./WorkspaceUserAuthToken";
|
|
165
|
+
import WorkspaceProjectAuthToken from "./WorkspaceProjectAuthToken";
|
|
166
|
+
import WorkspaceSetting from "./WorkspaceSetting";
|
|
167
|
+
import WorkspaceNotificationRule from "./WorkspaceNotificationRule";
|
|
168
|
+
|
|
164
169
|
const AllModelTypes: Array<{
|
|
165
170
|
new (): BaseModel;
|
|
166
171
|
}> = [
|
|
167
172
|
User,
|
|
173
|
+
WorkspaceUserAuthToken,
|
|
174
|
+
WorkspaceProjectAuthToken,
|
|
168
175
|
Probe,
|
|
169
176
|
Project,
|
|
170
177
|
EmailVerificationToken,
|
|
@@ -343,6 +350,9 @@ const AllModelTypes: Array<{
|
|
|
343
350
|
Dashboard,
|
|
344
351
|
|
|
345
352
|
MonitorTest,
|
|
353
|
+
|
|
354
|
+
WorkspaceSetting,
|
|
355
|
+
WorkspaceNotificationRule,
|
|
346
356
|
];
|
|
347
357
|
|
|
348
358
|
const modelTypeMap: { [key: string]: { new (): BaseModel } } = {};
|
|
@@ -950,4 +950,52 @@ export default class ScheduledMaintenance extends BaseModel {
|
|
|
950
950
|
nullable: true,
|
|
951
951
|
})
|
|
952
952
|
public nextSubscriberNotificationBeforeTheEventAt?: Date = undefined;
|
|
953
|
+
|
|
954
|
+
@ColumnAccessControl({
|
|
955
|
+
create: [
|
|
956
|
+
Permission.ProjectOwner,
|
|
957
|
+
Permission.ProjectAdmin,
|
|
958
|
+
Permission.ProjectMember,
|
|
959
|
+
Permission.CreateProjectScheduledMaintenance,
|
|
960
|
+
],
|
|
961
|
+
read: [
|
|
962
|
+
Permission.ProjectOwner,
|
|
963
|
+
Permission.ProjectAdmin,
|
|
964
|
+
Permission.ProjectMember,
|
|
965
|
+
Permission.ReadProjectScheduledMaintenance,
|
|
966
|
+
],
|
|
967
|
+
update: [],
|
|
968
|
+
})
|
|
969
|
+
@Index()
|
|
970
|
+
@TableColumn({
|
|
971
|
+
isDefaultValueColumn: false,
|
|
972
|
+
required: false,
|
|
973
|
+
type: TableColumnType.Number,
|
|
974
|
+
title: "Scheduled Maintenance Number",
|
|
975
|
+
description: "Scheduled Maintenance Number",
|
|
976
|
+
})
|
|
977
|
+
@Column({
|
|
978
|
+
type: ColumnType.Number,
|
|
979
|
+
nullable: true,
|
|
980
|
+
})
|
|
981
|
+
public scheduledMaintenanceNumber?: number = undefined;
|
|
982
|
+
|
|
983
|
+
@ColumnAccessControl({
|
|
984
|
+
create: [],
|
|
985
|
+
read: [],
|
|
986
|
+
update: [],
|
|
987
|
+
})
|
|
988
|
+
@TableColumn({
|
|
989
|
+
isDefaultValueColumn: false,
|
|
990
|
+
required: false,
|
|
991
|
+
type: TableColumnType.ShortText,
|
|
992
|
+
title: "Post Updates To Slack Channel ID",
|
|
993
|
+
description: "Post Updates To Slack Channel ID",
|
|
994
|
+
})
|
|
995
|
+
@Column({
|
|
996
|
+
type: ColumnType.ShortText,
|
|
997
|
+
length: ColumnLength.ShortText,
|
|
998
|
+
nullable: true,
|
|
999
|
+
})
|
|
1000
|
+
public postUpdatesToSlackChannelId?: number = undefined;
|
|
953
1001
|
}
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import Project from "./Project";
|
|
2
|
+
import User from "./User";
|
|
3
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
4
|
+
import Route from "../../Types/API/Route";
|
|
5
|
+
import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
|
|
6
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
7
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
8
|
+
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
9
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
10
|
+
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
11
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
12
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
13
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
14
|
+
import TenantColumn from "../../Types/Database/TenantColumn";
|
|
15
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
16
|
+
import ObjectID from "../../Types/ObjectID";
|
|
17
|
+
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
18
|
+
import WorkspaceType from "../../Types/Workspace/WorkspaceType";
|
|
19
|
+
import BaseNotificationRule from "../../Types/Workspace/NotificationRules/BaseNotificationRule";
|
|
20
|
+
import NotificationRuleEventType from "../../Types/Workspace/NotificationRules/EventType";
|
|
21
|
+
import Permission from "../../Types/Permission";
|
|
22
|
+
|
|
23
|
+
@TenantColumn("projectId")
|
|
24
|
+
@AllowAccessIfSubscriptionIsUnpaid()
|
|
25
|
+
@TableAccessControl({
|
|
26
|
+
create: [
|
|
27
|
+
Permission.ProjectAdmin,
|
|
28
|
+
Permission.ProjectOwner,
|
|
29
|
+
Permission.ProjectMember,
|
|
30
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
31
|
+
],
|
|
32
|
+
read: [
|
|
33
|
+
Permission.ProjectAdmin,
|
|
34
|
+
Permission.ProjectOwner,
|
|
35
|
+
Permission.ProjectMember,
|
|
36
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
37
|
+
],
|
|
38
|
+
delete: [
|
|
39
|
+
Permission.ProjectAdmin,
|
|
40
|
+
Permission.ProjectOwner,
|
|
41
|
+
Permission.ProjectMember,
|
|
42
|
+
Permission.DeleteWorkspaceNotificationRule,
|
|
43
|
+
],
|
|
44
|
+
update: [
|
|
45
|
+
Permission.ProjectAdmin,
|
|
46
|
+
Permission.ProjectOwner,
|
|
47
|
+
Permission.ProjectMember,
|
|
48
|
+
Permission.EditWorkspaceNotificationRule,
|
|
49
|
+
],
|
|
50
|
+
})
|
|
51
|
+
@CrudApiEndpoint(new Route("/workspace-notification-rule"))
|
|
52
|
+
@Entity({
|
|
53
|
+
name: "WorkspaceNotificationRule",
|
|
54
|
+
})
|
|
55
|
+
@TableMetadata({
|
|
56
|
+
tableName: "WorkspaceNotificationRule",
|
|
57
|
+
singularName: "Workspace Notification Rule",
|
|
58
|
+
pluralName: "Workspace Notification Rules",
|
|
59
|
+
icon: IconProp.Logs,
|
|
60
|
+
tableDescription: "Notification Rule for Third Party Workspaces",
|
|
61
|
+
})
|
|
62
|
+
class WorkspaceNotificationRule extends BaseModel {
|
|
63
|
+
@ColumnAccessControl({
|
|
64
|
+
create: [
|
|
65
|
+
Permission.ProjectAdmin,
|
|
66
|
+
Permission.ProjectOwner,
|
|
67
|
+
Permission.ProjectMember,
|
|
68
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
69
|
+
],
|
|
70
|
+
read: [
|
|
71
|
+
Permission.ProjectAdmin,
|
|
72
|
+
Permission.ProjectOwner,
|
|
73
|
+
Permission.ProjectMember,
|
|
74
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
75
|
+
],
|
|
76
|
+
update: [],
|
|
77
|
+
})
|
|
78
|
+
@TableColumn({
|
|
79
|
+
manyToOneRelationColumn: "projectId",
|
|
80
|
+
type: TableColumnType.Entity,
|
|
81
|
+
modelType: Project,
|
|
82
|
+
title: "Project",
|
|
83
|
+
description: "Relation to Project Resource in which this object belongs",
|
|
84
|
+
})
|
|
85
|
+
@ManyToOne(
|
|
86
|
+
() => {
|
|
87
|
+
return Project;
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
eager: false,
|
|
91
|
+
nullable: true,
|
|
92
|
+
onDelete: "CASCADE",
|
|
93
|
+
orphanedRowAction: "nullify",
|
|
94
|
+
},
|
|
95
|
+
)
|
|
96
|
+
@JoinColumn({ name: "projectId" })
|
|
97
|
+
public project?: Project = undefined;
|
|
98
|
+
|
|
99
|
+
@ColumnAccessControl({
|
|
100
|
+
create: [
|
|
101
|
+
Permission.ProjectAdmin,
|
|
102
|
+
Permission.ProjectOwner,
|
|
103
|
+
Permission.ProjectMember,
|
|
104
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
105
|
+
],
|
|
106
|
+
read: [
|
|
107
|
+
Permission.ProjectAdmin,
|
|
108
|
+
Permission.ProjectOwner,
|
|
109
|
+
Permission.ProjectMember,
|
|
110
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
111
|
+
],
|
|
112
|
+
update: [],
|
|
113
|
+
})
|
|
114
|
+
@Index()
|
|
115
|
+
@TableColumn({
|
|
116
|
+
type: TableColumnType.ObjectID,
|
|
117
|
+
required: true,
|
|
118
|
+
canReadOnRelationQuery: true,
|
|
119
|
+
title: "Project ID",
|
|
120
|
+
description: "ID of your OneUptime Project in which this object belongs",
|
|
121
|
+
})
|
|
122
|
+
@Column({
|
|
123
|
+
type: ColumnType.ObjectID,
|
|
124
|
+
nullable: false,
|
|
125
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
126
|
+
})
|
|
127
|
+
public projectId?: ObjectID = undefined;
|
|
128
|
+
|
|
129
|
+
@ColumnAccessControl({
|
|
130
|
+
create: [
|
|
131
|
+
Permission.ProjectAdmin,
|
|
132
|
+
Permission.ProjectOwner,
|
|
133
|
+
Permission.ProjectMember,
|
|
134
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
135
|
+
],
|
|
136
|
+
read: [
|
|
137
|
+
Permission.ProjectAdmin,
|
|
138
|
+
Permission.ProjectOwner,
|
|
139
|
+
Permission.ProjectMember,
|
|
140
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
141
|
+
],
|
|
142
|
+
update: [
|
|
143
|
+
Permission.ProjectAdmin,
|
|
144
|
+
Permission.ProjectOwner,
|
|
145
|
+
Permission.ProjectMember,
|
|
146
|
+
Permission.EditWorkspaceNotificationRule,
|
|
147
|
+
],
|
|
148
|
+
})
|
|
149
|
+
@TableColumn({
|
|
150
|
+
title: "Rule Name",
|
|
151
|
+
description: "Name of the Notification Rule",
|
|
152
|
+
required: true,
|
|
153
|
+
unique: false,
|
|
154
|
+
type: TableColumnType.LongText,
|
|
155
|
+
canReadOnRelationQuery: true,
|
|
156
|
+
})
|
|
157
|
+
@Column({
|
|
158
|
+
type: ColumnType.LongText,
|
|
159
|
+
length: ColumnLength.LongText,
|
|
160
|
+
unique: false,
|
|
161
|
+
nullable: false,
|
|
162
|
+
})
|
|
163
|
+
public name?: string = undefined;
|
|
164
|
+
|
|
165
|
+
@ColumnAccessControl({
|
|
166
|
+
create: [
|
|
167
|
+
Permission.ProjectAdmin,
|
|
168
|
+
Permission.ProjectOwner,
|
|
169
|
+
Permission.ProjectMember,
|
|
170
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
171
|
+
],
|
|
172
|
+
read: [
|
|
173
|
+
Permission.ProjectAdmin,
|
|
174
|
+
Permission.ProjectOwner,
|
|
175
|
+
Permission.ProjectMember,
|
|
176
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
177
|
+
],
|
|
178
|
+
update: [
|
|
179
|
+
Permission.ProjectAdmin,
|
|
180
|
+
Permission.ProjectOwner,
|
|
181
|
+
Permission.ProjectMember,
|
|
182
|
+
Permission.EditWorkspaceNotificationRule,
|
|
183
|
+
],
|
|
184
|
+
})
|
|
185
|
+
@TableColumn({
|
|
186
|
+
title: "Rule Description",
|
|
187
|
+
description: "Description of the Notification Rule",
|
|
188
|
+
required: false,
|
|
189
|
+
unique: false,
|
|
190
|
+
type: TableColumnType.LongText,
|
|
191
|
+
canReadOnRelationQuery: true,
|
|
192
|
+
})
|
|
193
|
+
@Column({
|
|
194
|
+
type: ColumnType.LongText,
|
|
195
|
+
length: ColumnLength.LongText,
|
|
196
|
+
unique: false,
|
|
197
|
+
nullable: true,
|
|
198
|
+
})
|
|
199
|
+
public description?: string = undefined;
|
|
200
|
+
|
|
201
|
+
@ColumnAccessControl({
|
|
202
|
+
create: [
|
|
203
|
+
Permission.ProjectAdmin,
|
|
204
|
+
Permission.ProjectOwner,
|
|
205
|
+
Permission.ProjectMember,
|
|
206
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
207
|
+
],
|
|
208
|
+
read: [
|
|
209
|
+
Permission.ProjectAdmin,
|
|
210
|
+
Permission.ProjectOwner,
|
|
211
|
+
Permission.ProjectMember,
|
|
212
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
213
|
+
],
|
|
214
|
+
update: [
|
|
215
|
+
Permission.ProjectAdmin,
|
|
216
|
+
Permission.ProjectOwner,
|
|
217
|
+
Permission.ProjectMember,
|
|
218
|
+
Permission.EditWorkspaceNotificationRule,
|
|
219
|
+
],
|
|
220
|
+
})
|
|
221
|
+
@TableColumn({
|
|
222
|
+
title: "Workspace Notification Rules",
|
|
223
|
+
description: "Notification Rules for the Workspace",
|
|
224
|
+
required: true,
|
|
225
|
+
unique: false,
|
|
226
|
+
type: TableColumnType.JSON,
|
|
227
|
+
canReadOnRelationQuery: true,
|
|
228
|
+
})
|
|
229
|
+
@Column({
|
|
230
|
+
type: ColumnType.JSON,
|
|
231
|
+
unique: false,
|
|
232
|
+
nullable: false,
|
|
233
|
+
})
|
|
234
|
+
public notificationRule?: BaseNotificationRule = undefined;
|
|
235
|
+
|
|
236
|
+
@ColumnAccessControl({
|
|
237
|
+
create: [
|
|
238
|
+
Permission.ProjectAdmin,
|
|
239
|
+
Permission.ProjectOwner,
|
|
240
|
+
Permission.ProjectMember,
|
|
241
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
242
|
+
],
|
|
243
|
+
read: [
|
|
244
|
+
Permission.ProjectAdmin,
|
|
245
|
+
Permission.ProjectOwner,
|
|
246
|
+
Permission.ProjectMember,
|
|
247
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
248
|
+
],
|
|
249
|
+
update: [
|
|
250
|
+
Permission.ProjectAdmin,
|
|
251
|
+
Permission.ProjectOwner,
|
|
252
|
+
Permission.ProjectMember,
|
|
253
|
+
Permission.EditWorkspaceNotificationRule,
|
|
254
|
+
],
|
|
255
|
+
})
|
|
256
|
+
@TableColumn({
|
|
257
|
+
title: "Workspace Event Type",
|
|
258
|
+
description:
|
|
259
|
+
"Event Type for the Workspace like Incident Created, Monitor Status Updated, etc.",
|
|
260
|
+
required: true,
|
|
261
|
+
unique: false,
|
|
262
|
+
type: TableColumnType.ShortText,
|
|
263
|
+
canReadOnRelationQuery: true,
|
|
264
|
+
})
|
|
265
|
+
@Column({
|
|
266
|
+
type: ColumnType.ShortText,
|
|
267
|
+
unique: false,
|
|
268
|
+
nullable: false,
|
|
269
|
+
})
|
|
270
|
+
public eventType?: NotificationRuleEventType = undefined;
|
|
271
|
+
|
|
272
|
+
@ColumnAccessControl({
|
|
273
|
+
create: [
|
|
274
|
+
Permission.ProjectAdmin,
|
|
275
|
+
Permission.ProjectOwner,
|
|
276
|
+
Permission.ProjectMember,
|
|
277
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
278
|
+
],
|
|
279
|
+
read: [
|
|
280
|
+
Permission.ProjectAdmin,
|
|
281
|
+
Permission.ProjectOwner,
|
|
282
|
+
Permission.ProjectMember,
|
|
283
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
284
|
+
],
|
|
285
|
+
update: [
|
|
286
|
+
Permission.ProjectAdmin,
|
|
287
|
+
Permission.ProjectOwner,
|
|
288
|
+
Permission.ProjectMember,
|
|
289
|
+
Permission.EditWorkspaceNotificationRule,
|
|
290
|
+
],
|
|
291
|
+
})
|
|
292
|
+
@TableColumn({
|
|
293
|
+
title: "Workspace Type",
|
|
294
|
+
description: "Type of Workspace - slack, microsoft teams etc.",
|
|
295
|
+
required: true,
|
|
296
|
+
unique: false,
|
|
297
|
+
type: TableColumnType.LongText,
|
|
298
|
+
canReadOnRelationQuery: true,
|
|
299
|
+
})
|
|
300
|
+
@Column({
|
|
301
|
+
type: ColumnType.LongText,
|
|
302
|
+
length: ColumnLength.LongText,
|
|
303
|
+
unique: false,
|
|
304
|
+
nullable: false,
|
|
305
|
+
})
|
|
306
|
+
public workspaceType?: WorkspaceType = undefined;
|
|
307
|
+
|
|
308
|
+
@ColumnAccessControl({
|
|
309
|
+
create: [
|
|
310
|
+
Permission.ProjectAdmin,
|
|
311
|
+
Permission.ProjectOwner,
|
|
312
|
+
Permission.ProjectMember,
|
|
313
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
314
|
+
],
|
|
315
|
+
read: [
|
|
316
|
+
Permission.ProjectAdmin,
|
|
317
|
+
Permission.ProjectOwner,
|
|
318
|
+
Permission.ProjectMember,
|
|
319
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
320
|
+
],
|
|
321
|
+
update: [
|
|
322
|
+
Permission.ProjectAdmin,
|
|
323
|
+
Permission.ProjectOwner,
|
|
324
|
+
Permission.ProjectMember,
|
|
325
|
+
Permission.EditWorkspaceNotificationRule,
|
|
326
|
+
],
|
|
327
|
+
})
|
|
328
|
+
@TableColumn({
|
|
329
|
+
manyToOneRelationColumn: "createdByUserId",
|
|
330
|
+
type: TableColumnType.Entity,
|
|
331
|
+
modelType: User,
|
|
332
|
+
title: "Created by User",
|
|
333
|
+
description:
|
|
334
|
+
"Relation to User who created this object (if this object was created by a User)",
|
|
335
|
+
})
|
|
336
|
+
@ManyToOne(
|
|
337
|
+
() => {
|
|
338
|
+
return User;
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
eager: false,
|
|
342
|
+
nullable: true,
|
|
343
|
+
onDelete: "SET NULL",
|
|
344
|
+
orphanedRowAction: "nullify",
|
|
345
|
+
},
|
|
346
|
+
)
|
|
347
|
+
@JoinColumn({ name: "createdByUserId" })
|
|
348
|
+
public createdByUser?: User = undefined;
|
|
349
|
+
|
|
350
|
+
@ColumnAccessControl({
|
|
351
|
+
create: [
|
|
352
|
+
Permission.ProjectAdmin,
|
|
353
|
+
Permission.ProjectOwner,
|
|
354
|
+
Permission.ProjectMember,
|
|
355
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
356
|
+
],
|
|
357
|
+
read: [
|
|
358
|
+
Permission.ProjectAdmin,
|
|
359
|
+
Permission.ProjectOwner,
|
|
360
|
+
Permission.ProjectMember,
|
|
361
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
362
|
+
],
|
|
363
|
+
update: [
|
|
364
|
+
Permission.ProjectAdmin,
|
|
365
|
+
Permission.ProjectOwner,
|
|
366
|
+
Permission.ProjectMember,
|
|
367
|
+
Permission.EditWorkspaceNotificationRule,
|
|
368
|
+
],
|
|
369
|
+
})
|
|
370
|
+
@TableColumn({
|
|
371
|
+
type: TableColumnType.ObjectID,
|
|
372
|
+
title: "Created by User ID",
|
|
373
|
+
description:
|
|
374
|
+
"User ID who created this object (if this object was created by a User)",
|
|
375
|
+
})
|
|
376
|
+
@Column({
|
|
377
|
+
type: ColumnType.ObjectID,
|
|
378
|
+
nullable: true,
|
|
379
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
380
|
+
})
|
|
381
|
+
public createdByUserId?: ObjectID = undefined;
|
|
382
|
+
|
|
383
|
+
@ColumnAccessControl({
|
|
384
|
+
create: [
|
|
385
|
+
Permission.ProjectAdmin,
|
|
386
|
+
Permission.ProjectOwner,
|
|
387
|
+
Permission.ProjectMember,
|
|
388
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
389
|
+
],
|
|
390
|
+
read: [
|
|
391
|
+
Permission.ProjectAdmin,
|
|
392
|
+
Permission.ProjectOwner,
|
|
393
|
+
Permission.ProjectMember,
|
|
394
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
395
|
+
],
|
|
396
|
+
update: [
|
|
397
|
+
Permission.ProjectAdmin,
|
|
398
|
+
Permission.ProjectOwner,
|
|
399
|
+
Permission.ProjectMember,
|
|
400
|
+
Permission.EditWorkspaceNotificationRule,
|
|
401
|
+
],
|
|
402
|
+
})
|
|
403
|
+
@TableColumn({
|
|
404
|
+
manyToOneRelationColumn: "deletedByUserId",
|
|
405
|
+
type: TableColumnType.Entity,
|
|
406
|
+
title: "Deleted by User",
|
|
407
|
+
description:
|
|
408
|
+
"Relation to User who deleted this object (if this object was deleted by a User)",
|
|
409
|
+
})
|
|
410
|
+
@ManyToOne(
|
|
411
|
+
() => {
|
|
412
|
+
return User;
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
cascade: false,
|
|
416
|
+
eager: false,
|
|
417
|
+
nullable: true,
|
|
418
|
+
onDelete: "SET NULL",
|
|
419
|
+
orphanedRowAction: "nullify",
|
|
420
|
+
},
|
|
421
|
+
)
|
|
422
|
+
@JoinColumn({ name: "deletedByUserId" })
|
|
423
|
+
public deletedByUser?: User = undefined;
|
|
424
|
+
|
|
425
|
+
// deleted by userId
|
|
426
|
+
|
|
427
|
+
@ColumnAccessControl({
|
|
428
|
+
create: [
|
|
429
|
+
Permission.ProjectAdmin,
|
|
430
|
+
Permission.ProjectOwner,
|
|
431
|
+
Permission.ProjectMember,
|
|
432
|
+
Permission.CreateWorkspaceNotificationRule,
|
|
433
|
+
],
|
|
434
|
+
read: [
|
|
435
|
+
Permission.ProjectAdmin,
|
|
436
|
+
Permission.ProjectOwner,
|
|
437
|
+
Permission.ProjectMember,
|
|
438
|
+
Permission.ReadWorkspaceNotificationRule,
|
|
439
|
+
],
|
|
440
|
+
update: [
|
|
441
|
+
Permission.ProjectAdmin,
|
|
442
|
+
Permission.ProjectOwner,
|
|
443
|
+
Permission.ProjectMember,
|
|
444
|
+
Permission.EditWorkspaceNotificationRule,
|
|
445
|
+
],
|
|
446
|
+
})
|
|
447
|
+
@TableColumn({
|
|
448
|
+
type: TableColumnType.ObjectID,
|
|
449
|
+
title: "Deleted by User ID",
|
|
450
|
+
description:
|
|
451
|
+
"User ID who deleted this object (if this object was deleted by a User)",
|
|
452
|
+
})
|
|
453
|
+
@Column({
|
|
454
|
+
type: ColumnType.ObjectID,
|
|
455
|
+
nullable: true,
|
|
456
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
457
|
+
})
|
|
458
|
+
public deletedByUserId?: ObjectID = undefined;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export default WorkspaceNotificationRule;
|