@oneuptime/common 7.0.4415 → 7.0.4453
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/DatabaseBaseModel/DatabaseBaseModel.ts +2 -1
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/Project.ts +44 -10
- package/Models/DatabaseModels/StatusPageAnnouncementTemplate.ts +473 -0
- package/Server/API/OpenAPI.ts +1 -1
- package/Server/Infrastructure/Postgres/SchemaMigrations/1749813704371-MigrationName.ts +67 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Middleware/ProjectAuthorization.ts +11 -4
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/StatusPageAnnouncementTemplateService.ts +10 -0
- package/Server/Utils/OpenAPI.ts +14 -25
- package/Tests/Server/Middleware/ProjectAuthorization.test.ts +7 -5
- package/Tests/Server/Services/TeamMemberService.test.ts +3 -1
- package/Tests/UI/Components/Input.test.tsx +22 -0
- package/Tests/UI/Components/MarkdownEditor.test.tsx +61 -0
- package/Tests/UI/Components/TextArea.test.tsx +22 -0
- package/Types/Database/TableColumn.ts +1 -0
- package/Types/Date.ts +18 -0
- package/Types/ObjectID.ts +7 -15
- package/Types/Permission.ts +80 -8
- package/UI/Components/CodeEditor/CodeEditor.tsx +33 -0
- package/UI/Components/Forms/Fields/FormField.tsx +2 -0
- package/UI/Components/Forms/Types/Field.ts +3 -0
- package/UI/Components/Input/Input.tsx +2 -0
- package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +2 -0
- package/UI/Components/TextArea/TextArea.tsx +2 -0
- package/Utils/Schema/AnalyticsModelSchema.ts +5 -14
- package/Utils/Schema/ModelSchema.ts +31 -40
- package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js +2 -1
- package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +42 -10
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageAnnouncementTemplate.js +488 -0
- package/build/dist/Models/DatabaseModels/StatusPageAnnouncementTemplate.js.map +1 -0
- package/build/dist/Server/API/OpenAPI.js +1 -1
- package/build/dist/Server/API/OpenAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1749813704371-MigrationName.js +30 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1749813704371-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js +7 -2
- package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/StatusPageAnnouncementTemplateService.js +9 -0
- package/build/dist/Server/Services/StatusPageAnnouncementTemplateService.js.map +1 -0
- package/build/dist/Server/Utils/OpenAPI.js +14 -19
- package/build/dist/Server/Utils/OpenAPI.js.map +1 -1
- package/build/dist/Tests/Server/Middleware/ProjectAuthorization.test.js +4 -4
- package/build/dist/Tests/Server/Middleware/ProjectAuthorization.test.js.map +1 -1
- package/build/dist/Tests/Server/Services/TeamMemberService.test.js +3 -1
- package/build/dist/Tests/Server/Services/TeamMemberService.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/Input.test.js +16 -0
- package/build/dist/Tests/UI/Components/Input.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/MarkdownEditor.test.js +25 -0
- package/build/dist/Tests/UI/Components/MarkdownEditor.test.js.map +1 -0
- package/build/dist/Tests/UI/Components/TextArea.test.js +16 -1
- package/build/dist/Tests/UI/Components/TextArea.test.js.map +1 -1
- package/build/dist/Types/Database/TableColumn.js.map +1 -1
- package/build/dist/Types/Date.js +17 -0
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/ObjectID.js +5 -13
- package/build/dist/Types/ObjectID.js.map +1 -1
- package/build/dist/Types/Permission.js +69 -8
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js +27 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js +2 -2
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Input/Input.js +1 -1
- package/build/dist/UI/Components/Input/Input.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js.map +1 -1
- package/build/dist/UI/Components/TextArea/TextArea.js +1 -1
- package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
- package/build/dist/Utils/Schema/AnalyticsModelSchema.js +5 -11
- package/build/dist/Utils/Schema/AnalyticsModelSchema.js.map +1 -1
- package/build/dist/Utils/Schema/ModelSchema.js +31 -26
- package/build/dist/Utils/Schema/ModelSchema.js.map +1 -1
- package/package.json +1 -1
|
@@ -92,8 +92,9 @@ export default class DatabaseBaseModel extends BaseEntity {
|
|
|
92
92
|
|
|
93
93
|
@TableColumn({
|
|
94
94
|
title: "Version",
|
|
95
|
-
type: TableColumnType.
|
|
95
|
+
type: TableColumnType.Number,
|
|
96
96
|
description: "Object version",
|
|
97
|
+
hideColumnInDocumentation: true,
|
|
97
98
|
})
|
|
98
99
|
@VersionColumn()
|
|
99
100
|
public version?: number = undefined;
|
|
@@ -103,6 +103,7 @@ import SmsLog from "./SmsLog";
|
|
|
103
103
|
// Status Page
|
|
104
104
|
import StatusPage from "./StatusPage";
|
|
105
105
|
import StatusPageAnnouncement from "./StatusPageAnnouncement";
|
|
106
|
+
import StatusPageAnnouncementTemplate from "./StatusPageAnnouncementTemplate";
|
|
106
107
|
import StatusPageCustomField from "./StatusPageCustomField";
|
|
107
108
|
import StatusPageDomain from "./StatusPageDomain";
|
|
108
109
|
import StatusPageFooterLink from "./StatusPageFooterLink";
|
|
@@ -247,6 +248,7 @@ const AllModelTypes: Array<{
|
|
|
247
248
|
StatusPageResource,
|
|
248
249
|
|
|
249
250
|
StatusPageAnnouncement,
|
|
251
|
+
StatusPageAnnouncementTemplate,
|
|
250
252
|
StatusPageSubscriber,
|
|
251
253
|
StatusPageFooterLink,
|
|
252
254
|
StatusPageHeaderLink,
|
|
@@ -595,7 +595,10 @@ export default class Project extends TenantModel {
|
|
|
595
595
|
read: [],
|
|
596
596
|
update: [],
|
|
597
597
|
})
|
|
598
|
-
@TableColumn({
|
|
598
|
+
@TableColumn({
|
|
599
|
+
type: TableColumnType.Number,
|
|
600
|
+
hideColumnInDocumentation: true,
|
|
601
|
+
})
|
|
599
602
|
@Column({
|
|
600
603
|
type: ColumnType.Number,
|
|
601
604
|
nullable: true,
|
|
@@ -768,6 +771,7 @@ export default class Project extends TenantModel {
|
|
|
768
771
|
@TableColumn({
|
|
769
772
|
required: true,
|
|
770
773
|
isDefaultValueColumn: true,
|
|
774
|
+
hideColumnInDocumentation: true,
|
|
771
775
|
type: TableColumnType.Boolean,
|
|
772
776
|
title: "Low Call and SMS Balance Notification Sent to Owners",
|
|
773
777
|
description: "Low Call and SMS Balance Notification Sent to Owners",
|
|
@@ -788,6 +792,7 @@ export default class Project extends TenantModel {
|
|
|
788
792
|
required: true,
|
|
789
793
|
isDefaultValueColumn: true,
|
|
790
794
|
type: TableColumnType.Boolean,
|
|
795
|
+
hideColumnInDocumentation: true,
|
|
791
796
|
title: "Failed Call and SMS Balance Charge Notification Sent to Owners",
|
|
792
797
|
description:
|
|
793
798
|
"Failed Call and SMS Balance Charge Notification Sent to Owners",
|
|
@@ -808,6 +813,7 @@ export default class Project extends TenantModel {
|
|
|
808
813
|
@TableColumn({
|
|
809
814
|
required: true,
|
|
810
815
|
isDefaultValueColumn: true,
|
|
816
|
+
hideColumnInDocumentation: true,
|
|
811
817
|
type: TableColumnType.Boolean,
|
|
812
818
|
title: "Failed Call and SMS Balance Charge Notification Sent to Owners",
|
|
813
819
|
description:
|
|
@@ -838,6 +844,7 @@ export default class Project extends TenantModel {
|
|
|
838
844
|
title: "Plan Name",
|
|
839
845
|
description: "Name of the plan this project is subscribed to.",
|
|
840
846
|
canReadOnRelationQuery: true,
|
|
847
|
+
hideColumnInDocumentation: true,
|
|
841
848
|
})
|
|
842
849
|
@Column({
|
|
843
850
|
nullable: true,
|
|
@@ -865,7 +872,7 @@ export default class Project extends TenantModel {
|
|
|
865
872
|
read: [],
|
|
866
873
|
update: [],
|
|
867
874
|
})
|
|
868
|
-
@TableColumn({ type: TableColumnType.Phone })
|
|
875
|
+
@TableColumn({ type: TableColumnType.Phone, hideColumnInDocumentation: true })
|
|
869
876
|
@Column({
|
|
870
877
|
type: ColumnType.Phone,
|
|
871
878
|
length: ColumnLength.Phone,
|
|
@@ -880,7 +887,7 @@ export default class Project extends TenantModel {
|
|
|
880
887
|
read: [],
|
|
881
888
|
update: [],
|
|
882
889
|
})
|
|
883
|
-
@TableColumn({ type: TableColumnType.Email })
|
|
890
|
+
@TableColumn({ type: TableColumnType.Email, hideColumnInDocumentation: true })
|
|
884
891
|
@Column({
|
|
885
892
|
type: ColumnType.Email,
|
|
886
893
|
length: ColumnLength.Email,
|
|
@@ -895,7 +902,7 @@ export default class Project extends TenantModel {
|
|
|
895
902
|
read: [],
|
|
896
903
|
update: [],
|
|
897
904
|
})
|
|
898
|
-
@TableColumn({ type: TableColumnType.Name })
|
|
905
|
+
@TableColumn({ type: TableColumnType.Name, hideColumnInDocumentation: true })
|
|
899
906
|
@Column({
|
|
900
907
|
type: ColumnType.Name,
|
|
901
908
|
length: ColumnLength.Name,
|
|
@@ -910,7 +917,10 @@ export default class Project extends TenantModel {
|
|
|
910
917
|
read: [],
|
|
911
918
|
update: [],
|
|
912
919
|
})
|
|
913
|
-
@TableColumn({
|
|
920
|
+
@TableColumn({
|
|
921
|
+
type: TableColumnType.LongText,
|
|
922
|
+
hideColumnInDocumentation: true,
|
|
923
|
+
})
|
|
914
924
|
@Column({
|
|
915
925
|
type: ColumnType.LongText,
|
|
916
926
|
length: ColumnLength.LongText,
|
|
@@ -924,7 +934,10 @@ export default class Project extends TenantModel {
|
|
|
924
934
|
read: [],
|
|
925
935
|
update: [],
|
|
926
936
|
})
|
|
927
|
-
@TableColumn({
|
|
937
|
+
@TableColumn({
|
|
938
|
+
type: TableColumnType.LongText,
|
|
939
|
+
hideColumnInDocumentation: true,
|
|
940
|
+
})
|
|
928
941
|
@Column({
|
|
929
942
|
type: ColumnType.LongText,
|
|
930
943
|
length: ColumnLength.LongText,
|
|
@@ -938,7 +951,10 @@ export default class Project extends TenantModel {
|
|
|
938
951
|
read: [],
|
|
939
952
|
update: [],
|
|
940
953
|
})
|
|
941
|
-
@TableColumn({
|
|
954
|
+
@TableColumn({
|
|
955
|
+
type: TableColumnType.LongText,
|
|
956
|
+
hideColumnInDocumentation: true,
|
|
957
|
+
})
|
|
942
958
|
@Column({
|
|
943
959
|
type: ColumnType.LongText,
|
|
944
960
|
length: ColumnLength.LongText,
|
|
@@ -952,7 +968,10 @@ export default class Project extends TenantModel {
|
|
|
952
968
|
read: [],
|
|
953
969
|
update: [],
|
|
954
970
|
})
|
|
955
|
-
@TableColumn({
|
|
971
|
+
@TableColumn({
|
|
972
|
+
type: TableColumnType.LongText,
|
|
973
|
+
hideColumnInDocumentation: true,
|
|
974
|
+
})
|
|
956
975
|
@Column({
|
|
957
976
|
type: ColumnType.LongText,
|
|
958
977
|
length: ColumnLength.LongText,
|
|
@@ -980,10 +999,14 @@ export default class Project extends TenantModel {
|
|
|
980
999
|
read: [],
|
|
981
1000
|
update: [],
|
|
982
1001
|
})
|
|
983
|
-
@TableColumn({
|
|
1002
|
+
@TableColumn({
|
|
1003
|
+
type: TableColumnType.LongText,
|
|
1004
|
+
hideColumnInDocumentation: true,
|
|
1005
|
+
})
|
|
984
1006
|
@Column({
|
|
985
1007
|
type: ColumnType.LongText,
|
|
986
1008
|
length: ColumnLength.LongText,
|
|
1009
|
+
|
|
987
1010
|
nullable: true,
|
|
988
1011
|
unique: false,
|
|
989
1012
|
})
|
|
@@ -994,9 +1017,13 @@ export default class Project extends TenantModel {
|
|
|
994
1017
|
read: [],
|
|
995
1018
|
update: [],
|
|
996
1019
|
})
|
|
997
|
-
@TableColumn({
|
|
1020
|
+
@TableColumn({
|
|
1021
|
+
type: TableColumnType.ShortText,
|
|
1022
|
+
hideColumnInDocumentation: true,
|
|
1023
|
+
})
|
|
998
1024
|
@Column({
|
|
999
1025
|
type: ColumnType.ShortText,
|
|
1026
|
+
|
|
1000
1027
|
length: ColumnLength.ShortText,
|
|
1001
1028
|
nullable: true,
|
|
1002
1029
|
unique: false,
|
|
@@ -1011,6 +1038,7 @@ export default class Project extends TenantModel {
|
|
|
1011
1038
|
@TableColumn({
|
|
1012
1039
|
manyToOneRelationColumn: "resellerId",
|
|
1013
1040
|
type: TableColumnType.Entity,
|
|
1041
|
+
hideColumnInDocumentation: true,
|
|
1014
1042
|
modelType: Reseller,
|
|
1015
1043
|
title: "Reseller",
|
|
1016
1044
|
description: "Relation to Reseller Resource in which this object belongs",
|
|
@@ -1046,6 +1074,7 @@ export default class Project extends TenantModel {
|
|
|
1046
1074
|
type: TableColumnType.ObjectID,
|
|
1047
1075
|
required: false,
|
|
1048
1076
|
canReadOnRelationQuery: true,
|
|
1077
|
+
hideColumnInDocumentation: true,
|
|
1049
1078
|
title: "Reseller ID",
|
|
1050
1079
|
description: "ID of your OneUptime Reseller in which this object belongs",
|
|
1051
1080
|
})
|
|
@@ -1065,6 +1094,7 @@ export default class Project extends TenantModel {
|
|
|
1065
1094
|
manyToOneRelationColumn: "ResellerPlanId",
|
|
1066
1095
|
type: TableColumnType.Entity,
|
|
1067
1096
|
modelType: ResellerPlan,
|
|
1097
|
+
hideColumnInDocumentation: true,
|
|
1068
1098
|
title: "ResellerPlan",
|
|
1069
1099
|
description:
|
|
1070
1100
|
"Relation to ResellerPlan Resource in which this object belongs",
|
|
@@ -1093,6 +1123,7 @@ export default class Project extends TenantModel {
|
|
|
1093
1123
|
type: TableColumnType.ObjectID,
|
|
1094
1124
|
required: false,
|
|
1095
1125
|
canReadOnRelationQuery: true,
|
|
1126
|
+
hideColumnInDocumentation: true,
|
|
1096
1127
|
title: "Reseller Plan ID",
|
|
1097
1128
|
description:
|
|
1098
1129
|
"ID of your OneUptime Reseller Plan in which this object belongs",
|
|
@@ -1113,6 +1144,7 @@ export default class Project extends TenantModel {
|
|
|
1113
1144
|
required: false,
|
|
1114
1145
|
type: TableColumnType.ShortText,
|
|
1115
1146
|
title: "License ID",
|
|
1147
|
+
hideColumnInDocumentation: true,
|
|
1116
1148
|
description: "License ID from a OneUptime Reseller",
|
|
1117
1149
|
canReadOnRelationQuery: true,
|
|
1118
1150
|
})
|
|
@@ -1132,6 +1164,7 @@ export default class Project extends TenantModel {
|
|
|
1132
1164
|
required: false,
|
|
1133
1165
|
type: TableColumnType.Number,
|
|
1134
1166
|
title: "Enterprise Annual Contract Value",
|
|
1167
|
+
hideColumnInDocumentation: true,
|
|
1135
1168
|
description:
|
|
1136
1169
|
"Annual contract value for this project (in USD). This field is only applicable for enterprise customers and is manually edited.",
|
|
1137
1170
|
})
|
|
@@ -1156,6 +1189,7 @@ export default class Project extends TenantModel {
|
|
|
1156
1189
|
required: false,
|
|
1157
1190
|
type: TableColumnType.Boolean,
|
|
1158
1191
|
title: "Let Customer Support Access Project",
|
|
1192
|
+
hideColumnInDocumentation: true,
|
|
1159
1193
|
description:
|
|
1160
1194
|
"OneUptime customer support can access this project. This is used for debugging purposes.",
|
|
1161
1195
|
})
|
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import Project from "./Project";
|
|
2
|
+
import StatusPage from "./StatusPage";
|
|
3
|
+
import User from "./User";
|
|
4
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
5
|
+
import Route from "../../Types/API/Route";
|
|
6
|
+
import { PlanType } from "../../Types/Billing/SubscriptionPlan";
|
|
7
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
8
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
9
|
+
import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
|
|
10
|
+
import CanAccessIfCanReadOn from "../../Types/Database/CanAccessIfCanReadOn";
|
|
11
|
+
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
12
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
13
|
+
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
14
|
+
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
15
|
+
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
16
|
+
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
17
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
18
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
19
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
20
|
+
import TenantColumn from "../../Types/Database/TenantColumn";
|
|
21
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
22
|
+
import ObjectID from "../../Types/ObjectID";
|
|
23
|
+
import Permission from "../../Types/Permission";
|
|
24
|
+
import {
|
|
25
|
+
Column,
|
|
26
|
+
Entity,
|
|
27
|
+
Index,
|
|
28
|
+
JoinColumn,
|
|
29
|
+
JoinTable,
|
|
30
|
+
ManyToMany,
|
|
31
|
+
ManyToOne,
|
|
32
|
+
} from "typeorm";
|
|
33
|
+
|
|
34
|
+
@EnableDocumentation()
|
|
35
|
+
@TenantColumn("projectId")
|
|
36
|
+
@CanAccessIfCanReadOn("statusPages")
|
|
37
|
+
@TableBillingAccessControl({
|
|
38
|
+
create: PlanType.Growth,
|
|
39
|
+
read: PlanType.Growth,
|
|
40
|
+
update: PlanType.Growth,
|
|
41
|
+
delete: PlanType.Growth,
|
|
42
|
+
})
|
|
43
|
+
@TableAccessControl({
|
|
44
|
+
create: [
|
|
45
|
+
Permission.ProjectOwner,
|
|
46
|
+
Permission.ProjectAdmin,
|
|
47
|
+
Permission.ProjectMember,
|
|
48
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
49
|
+
],
|
|
50
|
+
read: [
|
|
51
|
+
Permission.ProjectOwner,
|
|
52
|
+
Permission.ProjectAdmin,
|
|
53
|
+
Permission.ProjectMember,
|
|
54
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
55
|
+
],
|
|
56
|
+
delete: [
|
|
57
|
+
Permission.ProjectOwner,
|
|
58
|
+
Permission.ProjectAdmin,
|
|
59
|
+
Permission.ProjectMember,
|
|
60
|
+
Permission.DeleteStatusPageAnnouncementTemplate,
|
|
61
|
+
],
|
|
62
|
+
update: [
|
|
63
|
+
Permission.ProjectOwner,
|
|
64
|
+
Permission.ProjectAdmin,
|
|
65
|
+
Permission.ProjectMember,
|
|
66
|
+
Permission.EditStatusPageAnnouncementTemplate,
|
|
67
|
+
],
|
|
68
|
+
})
|
|
69
|
+
@EnableWorkflow({
|
|
70
|
+
create: true,
|
|
71
|
+
delete: true,
|
|
72
|
+
update: true,
|
|
73
|
+
read: true,
|
|
74
|
+
})
|
|
75
|
+
@CrudApiEndpoint(new Route("/status-page-announcement-template"))
|
|
76
|
+
@SlugifyColumn("templateName", "slug")
|
|
77
|
+
@TableMetadata({
|
|
78
|
+
tableName: "StatusPageAnnouncementTemplate",
|
|
79
|
+
singularName: "Status Page Announcement Template",
|
|
80
|
+
pluralName: "Status Page Announcement Templates",
|
|
81
|
+
icon: IconProp.Announcement,
|
|
82
|
+
tableDescription: "Manage announcement templates for your status page",
|
|
83
|
+
})
|
|
84
|
+
@Entity({
|
|
85
|
+
name: "StatusPageAnnouncementTemplate",
|
|
86
|
+
})
|
|
87
|
+
export default class StatusPageAnnouncementTemplate extends BaseModel {
|
|
88
|
+
@ColumnAccessControl({
|
|
89
|
+
create: [
|
|
90
|
+
Permission.ProjectOwner,
|
|
91
|
+
Permission.ProjectAdmin,
|
|
92
|
+
Permission.ProjectMember,
|
|
93
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
94
|
+
],
|
|
95
|
+
read: [
|
|
96
|
+
Permission.ProjectOwner,
|
|
97
|
+
Permission.ProjectAdmin,
|
|
98
|
+
Permission.ProjectMember,
|
|
99
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
100
|
+
],
|
|
101
|
+
update: [],
|
|
102
|
+
})
|
|
103
|
+
@TableColumn({
|
|
104
|
+
manyToOneRelationColumn: "projectId",
|
|
105
|
+
type: TableColumnType.Entity,
|
|
106
|
+
modelType: Project,
|
|
107
|
+
title: "Project",
|
|
108
|
+
description: "Relation to Project Resource in which this object belongs",
|
|
109
|
+
})
|
|
110
|
+
@ManyToOne(
|
|
111
|
+
() => {
|
|
112
|
+
return Project;
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
eager: false,
|
|
116
|
+
nullable: true,
|
|
117
|
+
onDelete: "CASCADE",
|
|
118
|
+
orphanedRowAction: "nullify",
|
|
119
|
+
},
|
|
120
|
+
)
|
|
121
|
+
@JoinColumn({ name: "projectId" })
|
|
122
|
+
public project?: Project = undefined;
|
|
123
|
+
|
|
124
|
+
@ColumnAccessControl({
|
|
125
|
+
create: [
|
|
126
|
+
Permission.ProjectOwner,
|
|
127
|
+
Permission.ProjectAdmin,
|
|
128
|
+
Permission.ProjectMember,
|
|
129
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
130
|
+
],
|
|
131
|
+
read: [
|
|
132
|
+
Permission.ProjectOwner,
|
|
133
|
+
Permission.ProjectAdmin,
|
|
134
|
+
Permission.ProjectMember,
|
|
135
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
136
|
+
],
|
|
137
|
+
update: [],
|
|
138
|
+
})
|
|
139
|
+
@Index()
|
|
140
|
+
@TableColumn({
|
|
141
|
+
type: TableColumnType.ObjectID,
|
|
142
|
+
required: true,
|
|
143
|
+
canReadOnRelationQuery: true,
|
|
144
|
+
title: "Project ID",
|
|
145
|
+
description: "ID of your OneUptime Project in which this object belongs",
|
|
146
|
+
})
|
|
147
|
+
@Column({
|
|
148
|
+
type: ColumnType.ObjectID,
|
|
149
|
+
nullable: false,
|
|
150
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
151
|
+
})
|
|
152
|
+
public projectId?: ObjectID = undefined;
|
|
153
|
+
|
|
154
|
+
@ColumnAccessControl({
|
|
155
|
+
create: [
|
|
156
|
+
Permission.ProjectOwner,
|
|
157
|
+
Permission.ProjectAdmin,
|
|
158
|
+
Permission.ProjectMember,
|
|
159
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
160
|
+
],
|
|
161
|
+
read: [
|
|
162
|
+
Permission.ProjectOwner,
|
|
163
|
+
Permission.ProjectAdmin,
|
|
164
|
+
Permission.ProjectMember,
|
|
165
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
166
|
+
],
|
|
167
|
+
update: [
|
|
168
|
+
Permission.ProjectOwner,
|
|
169
|
+
Permission.ProjectAdmin,
|
|
170
|
+
Permission.ProjectMember,
|
|
171
|
+
Permission.EditStatusPageAnnouncementTemplate,
|
|
172
|
+
],
|
|
173
|
+
})
|
|
174
|
+
@TableColumn({
|
|
175
|
+
required: true,
|
|
176
|
+
type: TableColumnType.ShortText,
|
|
177
|
+
title: "Template Name",
|
|
178
|
+
description: "Name of the announcement template",
|
|
179
|
+
})
|
|
180
|
+
@Column({
|
|
181
|
+
nullable: false,
|
|
182
|
+
type: ColumnType.ShortText,
|
|
183
|
+
length: ColumnLength.ShortText,
|
|
184
|
+
})
|
|
185
|
+
public templateName?: string = undefined;
|
|
186
|
+
|
|
187
|
+
@ColumnAccessControl({
|
|
188
|
+
create: [
|
|
189
|
+
Permission.ProjectOwner,
|
|
190
|
+
Permission.ProjectAdmin,
|
|
191
|
+
Permission.ProjectMember,
|
|
192
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
193
|
+
],
|
|
194
|
+
read: [
|
|
195
|
+
Permission.ProjectOwner,
|
|
196
|
+
Permission.ProjectAdmin,
|
|
197
|
+
Permission.ProjectMember,
|
|
198
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
199
|
+
],
|
|
200
|
+
update: [
|
|
201
|
+
Permission.ProjectOwner,
|
|
202
|
+
Permission.ProjectAdmin,
|
|
203
|
+
Permission.ProjectMember,
|
|
204
|
+
Permission.EditStatusPageAnnouncementTemplate,
|
|
205
|
+
],
|
|
206
|
+
})
|
|
207
|
+
@TableColumn({
|
|
208
|
+
required: false,
|
|
209
|
+
type: TableColumnType.LongText,
|
|
210
|
+
title: "Template Description",
|
|
211
|
+
description: "Description of the announcement template",
|
|
212
|
+
})
|
|
213
|
+
@Column({
|
|
214
|
+
nullable: true,
|
|
215
|
+
type: ColumnType.LongText,
|
|
216
|
+
length: ColumnLength.LongText,
|
|
217
|
+
})
|
|
218
|
+
public templateDescription?: string = undefined;
|
|
219
|
+
|
|
220
|
+
@ColumnAccessControl({
|
|
221
|
+
create: [
|
|
222
|
+
Permission.ProjectOwner,
|
|
223
|
+
Permission.ProjectAdmin,
|
|
224
|
+
Permission.ProjectMember,
|
|
225
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
226
|
+
],
|
|
227
|
+
read: [
|
|
228
|
+
Permission.ProjectOwner,
|
|
229
|
+
Permission.ProjectAdmin,
|
|
230
|
+
Permission.ProjectMember,
|
|
231
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
232
|
+
],
|
|
233
|
+
update: [
|
|
234
|
+
Permission.ProjectOwner,
|
|
235
|
+
Permission.ProjectAdmin,
|
|
236
|
+
Permission.ProjectMember,
|
|
237
|
+
Permission.EditStatusPageAnnouncementTemplate,
|
|
238
|
+
],
|
|
239
|
+
})
|
|
240
|
+
@TableColumn({
|
|
241
|
+
required: true,
|
|
242
|
+
type: TableColumnType.ShortText,
|
|
243
|
+
title: "Announcement Title",
|
|
244
|
+
description: "Title of the announcement",
|
|
245
|
+
})
|
|
246
|
+
@Column({
|
|
247
|
+
nullable: false,
|
|
248
|
+
type: ColumnType.ShortText,
|
|
249
|
+
length: ColumnLength.ShortText,
|
|
250
|
+
})
|
|
251
|
+
public title?: string = undefined;
|
|
252
|
+
|
|
253
|
+
@ColumnAccessControl({
|
|
254
|
+
create: [
|
|
255
|
+
Permission.ProjectOwner,
|
|
256
|
+
Permission.ProjectAdmin,
|
|
257
|
+
Permission.ProjectMember,
|
|
258
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
259
|
+
],
|
|
260
|
+
read: [
|
|
261
|
+
Permission.ProjectOwner,
|
|
262
|
+
Permission.ProjectAdmin,
|
|
263
|
+
Permission.ProjectMember,
|
|
264
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
265
|
+
],
|
|
266
|
+
update: [
|
|
267
|
+
Permission.ProjectOwner,
|
|
268
|
+
Permission.ProjectAdmin,
|
|
269
|
+
Permission.ProjectMember,
|
|
270
|
+
Permission.EditStatusPageAnnouncementTemplate,
|
|
271
|
+
],
|
|
272
|
+
})
|
|
273
|
+
@TableColumn({
|
|
274
|
+
required: true,
|
|
275
|
+
type: TableColumnType.Markdown,
|
|
276
|
+
title: "Announcement Description",
|
|
277
|
+
description: "Text of the announcement. This is in Markdown.",
|
|
278
|
+
})
|
|
279
|
+
@Column({
|
|
280
|
+
nullable: false,
|
|
281
|
+
type: ColumnType.Markdown,
|
|
282
|
+
})
|
|
283
|
+
public description?: string = undefined;
|
|
284
|
+
|
|
285
|
+
@ColumnAccessControl({
|
|
286
|
+
create: [
|
|
287
|
+
Permission.ProjectOwner,
|
|
288
|
+
Permission.ProjectAdmin,
|
|
289
|
+
Permission.ProjectMember,
|
|
290
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
291
|
+
],
|
|
292
|
+
read: [
|
|
293
|
+
Permission.ProjectOwner,
|
|
294
|
+
Permission.ProjectAdmin,
|
|
295
|
+
Permission.ProjectMember,
|
|
296
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
297
|
+
],
|
|
298
|
+
update: [
|
|
299
|
+
Permission.ProjectOwner,
|
|
300
|
+
Permission.ProjectAdmin,
|
|
301
|
+
Permission.ProjectMember,
|
|
302
|
+
Permission.EditStatusPageAnnouncementTemplate,
|
|
303
|
+
],
|
|
304
|
+
})
|
|
305
|
+
@TableColumn({
|
|
306
|
+
required: false,
|
|
307
|
+
type: TableColumnType.EntityArray,
|
|
308
|
+
modelType: StatusPage,
|
|
309
|
+
title: "Status Pages",
|
|
310
|
+
description: "Status Pages to show this announcement on.",
|
|
311
|
+
})
|
|
312
|
+
@ManyToMany(
|
|
313
|
+
() => {
|
|
314
|
+
return StatusPage;
|
|
315
|
+
},
|
|
316
|
+
{ eager: false },
|
|
317
|
+
)
|
|
318
|
+
@JoinTable({
|
|
319
|
+
name: "AnnouncementTemplateStatusPage",
|
|
320
|
+
inverseJoinColumn: {
|
|
321
|
+
name: "statusPageId",
|
|
322
|
+
referencedColumnName: "_id",
|
|
323
|
+
},
|
|
324
|
+
joinColumn: {
|
|
325
|
+
name: "announcementTemplateId",
|
|
326
|
+
referencedColumnName: "_id",
|
|
327
|
+
},
|
|
328
|
+
})
|
|
329
|
+
public statusPages?: Array<StatusPage> = undefined;
|
|
330
|
+
|
|
331
|
+
@ColumnAccessControl({
|
|
332
|
+
create: [
|
|
333
|
+
Permission.ProjectOwner,
|
|
334
|
+
Permission.ProjectAdmin,
|
|
335
|
+
Permission.ProjectMember,
|
|
336
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
337
|
+
],
|
|
338
|
+
read: [
|
|
339
|
+
Permission.ProjectOwner,
|
|
340
|
+
Permission.ProjectAdmin,
|
|
341
|
+
Permission.ProjectMember,
|
|
342
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
343
|
+
],
|
|
344
|
+
update: [
|
|
345
|
+
Permission.ProjectOwner,
|
|
346
|
+
Permission.ProjectAdmin,
|
|
347
|
+
Permission.ProjectMember,
|
|
348
|
+
Permission.EditStatusPageAnnouncementTemplate,
|
|
349
|
+
],
|
|
350
|
+
})
|
|
351
|
+
@TableColumn({
|
|
352
|
+
isDefaultValueColumn: true,
|
|
353
|
+
type: TableColumnType.Boolean,
|
|
354
|
+
title: "Should subscribers be notified?",
|
|
355
|
+
description:
|
|
356
|
+
"Should subscribers be notified about announcements created from this template?",
|
|
357
|
+
})
|
|
358
|
+
@Column({
|
|
359
|
+
type: ColumnType.Boolean,
|
|
360
|
+
default: true,
|
|
361
|
+
})
|
|
362
|
+
public shouldStatusPageSubscribersBeNotified?: boolean = undefined;
|
|
363
|
+
|
|
364
|
+
@ColumnAccessControl({
|
|
365
|
+
create: [],
|
|
366
|
+
read: [
|
|
367
|
+
Permission.ProjectOwner,
|
|
368
|
+
Permission.ProjectAdmin,
|
|
369
|
+
Permission.ProjectMember,
|
|
370
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
371
|
+
],
|
|
372
|
+
update: [],
|
|
373
|
+
})
|
|
374
|
+
@TableColumn({
|
|
375
|
+
manyToOneRelationColumn: "createdByUserId",
|
|
376
|
+
type: TableColumnType.Entity,
|
|
377
|
+
modelType: User,
|
|
378
|
+
title: "Created by User",
|
|
379
|
+
description:
|
|
380
|
+
"Relation to User who created this object (if this object was created by a User)",
|
|
381
|
+
})
|
|
382
|
+
@ManyToOne(
|
|
383
|
+
() => {
|
|
384
|
+
return User;
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
eager: false,
|
|
388
|
+
nullable: true,
|
|
389
|
+
onDelete: "SET NULL",
|
|
390
|
+
orphanedRowAction: "nullify",
|
|
391
|
+
},
|
|
392
|
+
)
|
|
393
|
+
@JoinColumn({ name: "createdByUserId" })
|
|
394
|
+
public createdByUser?: User = undefined;
|
|
395
|
+
|
|
396
|
+
@ColumnAccessControl({
|
|
397
|
+
create: [
|
|
398
|
+
Permission.ProjectOwner,
|
|
399
|
+
Permission.ProjectAdmin,
|
|
400
|
+
Permission.ProjectMember,
|
|
401
|
+
Permission.CreateStatusPageAnnouncementTemplate,
|
|
402
|
+
],
|
|
403
|
+
read: [
|
|
404
|
+
Permission.ProjectOwner,
|
|
405
|
+
Permission.ProjectAdmin,
|
|
406
|
+
Permission.ProjectMember,
|
|
407
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
408
|
+
],
|
|
409
|
+
update: [],
|
|
410
|
+
})
|
|
411
|
+
@TableColumn({
|
|
412
|
+
type: TableColumnType.ObjectID,
|
|
413
|
+
title: "Created by User ID",
|
|
414
|
+
description:
|
|
415
|
+
"User ID who created this object (if this object was created by a User)",
|
|
416
|
+
})
|
|
417
|
+
@Column({
|
|
418
|
+
type: ColumnType.ObjectID,
|
|
419
|
+
nullable: true,
|
|
420
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
421
|
+
})
|
|
422
|
+
public createdByUserId?: ObjectID = undefined;
|
|
423
|
+
|
|
424
|
+
@ColumnAccessControl({
|
|
425
|
+
create: [],
|
|
426
|
+
read: [
|
|
427
|
+
Permission.ProjectOwner,
|
|
428
|
+
Permission.ProjectAdmin,
|
|
429
|
+
Permission.ProjectMember,
|
|
430
|
+
Permission.ReadStatusPageAnnouncementTemplate,
|
|
431
|
+
],
|
|
432
|
+
update: [],
|
|
433
|
+
})
|
|
434
|
+
@TableColumn({
|
|
435
|
+
manyToOneRelationColumn: "deletedByUserId",
|
|
436
|
+
type: TableColumnType.Entity,
|
|
437
|
+
title: "Deleted by User",
|
|
438
|
+
description:
|
|
439
|
+
"Relation to User who deleted this object (if this object was deleted by a User)",
|
|
440
|
+
})
|
|
441
|
+
@ManyToOne(
|
|
442
|
+
() => {
|
|
443
|
+
return User;
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
cascade: false,
|
|
447
|
+
eager: false,
|
|
448
|
+
nullable: true,
|
|
449
|
+
onDelete: "SET NULL",
|
|
450
|
+
orphanedRowAction: "nullify",
|
|
451
|
+
},
|
|
452
|
+
)
|
|
453
|
+
@JoinColumn({ name: "deletedByUserId" })
|
|
454
|
+
public deletedByUser?: User = undefined;
|
|
455
|
+
|
|
456
|
+
@ColumnAccessControl({
|
|
457
|
+
create: [],
|
|
458
|
+
read: [],
|
|
459
|
+
update: [],
|
|
460
|
+
})
|
|
461
|
+
@TableColumn({
|
|
462
|
+
type: TableColumnType.ObjectID,
|
|
463
|
+
title: "Deleted by User ID",
|
|
464
|
+
description:
|
|
465
|
+
"User ID who deleted this object (if this object was deleted by a User)",
|
|
466
|
+
})
|
|
467
|
+
@Column({
|
|
468
|
+
type: ColumnType.ObjectID,
|
|
469
|
+
nullable: true,
|
|
470
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
471
|
+
})
|
|
472
|
+
public deletedByUserId?: ObjectID = undefined;
|
|
473
|
+
}
|
package/Server/API/OpenAPI.ts
CHANGED
|
@@ -19,7 +19,7 @@ export default class OpenAPI {
|
|
|
19
19
|
public static getRouter(): ExpressRouter {
|
|
20
20
|
const router: ExpressRouter = Express.getRouter();
|
|
21
21
|
|
|
22
|
-
router.get("/openapi", (req: ExpressRequest, res: ExpressResponse) => {
|
|
22
|
+
router.get("/openapi/spec", (req: ExpressRequest, res: ExpressResponse) => {
|
|
23
23
|
const openAPISpec: JSONObject = OpenAPIUtil.generateOpenAPISpec();
|
|
24
24
|
return Response.sendJsonObjectResponse(req, res, openAPISpec);
|
|
25
25
|
});
|