@oneuptime/common 8.0.5573 → 8.0.5575
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/Index.ts +4 -0
- package/Models/DatabaseModels/StatusPagePrivateUserSession.ts +413 -0
- package/Models/DatabaseModels/UserSession.ts +318 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1762890441920-MigrationName.ts +91 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Services/Index.ts +4 -0
- package/Server/Services/StatusPagePrivateUserSessionService.ts +369 -0
- package/Server/Services/UserSessionService.ts +350 -0
- package/Server/Utils/Cookie.ts +127 -5
- package/Server/Utils/Express.ts +100 -0
- package/Server/Utils/JsonWebToken.ts +8 -1
- package/Types/CookieName.ts +1 -0
- package/Types/JsonWebTokenData.ts +1 -0
- package/Types/Text.ts +15 -0
- package/UI/Utils/API/API.ts +39 -1
- package/Utils/API.ts +74 -5
- package/build/dist/Models/DatabaseModels/Index.js +4 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPagePrivateUserSession.js +456 -0
- package/build/dist/Models/DatabaseModels/StatusPagePrivateUserSession.js.map +1 -0
- package/build/dist/Models/DatabaseModels/UserSession.js +356 -0
- package/build/dist/Models/DatabaseModels/UserSession.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1762890441920-MigrationName.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1762890441920-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/Services/Index.js +4 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js +214 -0
- package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js.map +1 -0
- package/build/dist/Server/Services/UserSessionService.js +202 -0
- package/build/dist/Server/Services/UserSessionService.js.map +1 -0
- package/build/dist/Server/Utils/Cookie.js +74 -7
- package/build/dist/Server/Utils/Cookie.js.map +1 -1
- package/build/dist/Server/Utils/Express.js +62 -0
- package/build/dist/Server/Utils/Express.js.map +1 -1
- package/build/dist/Server/Utils/JsonWebToken.js +8 -2
- package/build/dist/Server/Utils/JsonWebToken.js.map +1 -1
- package/build/dist/Types/CookieName.js +1 -0
- package/build/dist/Types/CookieName.js.map +1 -1
- package/build/dist/Types/Text.js +9 -0
- package/build/dist/Types/Text.js.map +1 -1
- package/build/dist/UI/Utils/API/API.js +27 -0
- package/build/dist/UI/Utils/API/API.js.map +1 -1
- package/build/dist/Utils/API.js +36 -6
- package/build/dist/Utils/API.js.map +1 -1
- package/package.json +146 -146
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
2
|
+
import User from "./User";
|
|
3
|
+
import Route from "../../Types/API/Route";
|
|
4
|
+
import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
|
|
5
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
6
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
7
|
+
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
8
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
9
|
+
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
10
|
+
import CurrentUserCanAccessRecordBy from "../../Types/Database/CurrentUserCanAccessRecordBy";
|
|
11
|
+
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
12
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
13
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
14
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
15
|
+
import HashedString from "../../Types/HashedString";
|
|
16
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
17
|
+
import { JSONObject } from "../../Types/JSON";
|
|
18
|
+
import ObjectID from "../../Types/ObjectID";
|
|
19
|
+
import Permission from "../../Types/Permission";
|
|
20
|
+
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
21
|
+
|
|
22
|
+
@EnableDocumentation({
|
|
23
|
+
isMasterAdminApiDocs: true,
|
|
24
|
+
})
|
|
25
|
+
@AllowAccessIfSubscriptionIsUnpaid()
|
|
26
|
+
@TableAccessControl({
|
|
27
|
+
create: [Permission.CurrentUser],
|
|
28
|
+
read: [Permission.CurrentUser],
|
|
29
|
+
delete: [Permission.CurrentUser],
|
|
30
|
+
update: [Permission.CurrentUser],
|
|
31
|
+
})
|
|
32
|
+
@CrudApiEndpoint(new Route("/user-session"))
|
|
33
|
+
@Entity({
|
|
34
|
+
name: "UserSession",
|
|
35
|
+
})
|
|
36
|
+
@TableMetadata({
|
|
37
|
+
tableName: "UserSession",
|
|
38
|
+
singularName: "User Session",
|
|
39
|
+
pluralName: "User Sessions",
|
|
40
|
+
icon: IconProp.Lock,
|
|
41
|
+
tableDescription:
|
|
42
|
+
"Active user sessions with refresh tokens and device metadata for enhanced authentication security.",
|
|
43
|
+
})
|
|
44
|
+
@CurrentUserCanAccessRecordBy("userId")
|
|
45
|
+
class UserSession extends BaseModel {
|
|
46
|
+
@ColumnAccessControl({
|
|
47
|
+
create: [Permission.CurrentUser],
|
|
48
|
+
read: [Permission.CurrentUser],
|
|
49
|
+
update: [],
|
|
50
|
+
})
|
|
51
|
+
@TableColumn({
|
|
52
|
+
manyToOneRelationColumn: "userId",
|
|
53
|
+
type: TableColumnType.Entity,
|
|
54
|
+
modelType: User,
|
|
55
|
+
title: "User",
|
|
56
|
+
description: "User account this session belongs to.",
|
|
57
|
+
})
|
|
58
|
+
@ManyToOne(
|
|
59
|
+
() => {
|
|
60
|
+
return User;
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
eager: false,
|
|
64
|
+
nullable: false,
|
|
65
|
+
onDelete: "CASCADE",
|
|
66
|
+
orphanedRowAction: "delete",
|
|
67
|
+
},
|
|
68
|
+
)
|
|
69
|
+
@JoinColumn({ name: "userId" })
|
|
70
|
+
public user?: User = undefined;
|
|
71
|
+
|
|
72
|
+
@ColumnAccessControl({
|
|
73
|
+
create: [Permission.CurrentUser],
|
|
74
|
+
read: [Permission.CurrentUser],
|
|
75
|
+
update: [],
|
|
76
|
+
})
|
|
77
|
+
@Index()
|
|
78
|
+
@TableColumn({
|
|
79
|
+
type: TableColumnType.ObjectID,
|
|
80
|
+
required: true,
|
|
81
|
+
title: "User ID",
|
|
82
|
+
description: "Identifier for the user that owns this session.",
|
|
83
|
+
canReadOnRelationQuery: true,
|
|
84
|
+
})
|
|
85
|
+
@Column({
|
|
86
|
+
type: ColumnType.ObjectID,
|
|
87
|
+
nullable: false,
|
|
88
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
89
|
+
})
|
|
90
|
+
public userId?: ObjectID = undefined;
|
|
91
|
+
|
|
92
|
+
@ColumnAccessControl({
|
|
93
|
+
create: [],
|
|
94
|
+
read: [],
|
|
95
|
+
update: [],
|
|
96
|
+
})
|
|
97
|
+
@Index({ unique: true })
|
|
98
|
+
@TableColumn({
|
|
99
|
+
type: TableColumnType.HashedString,
|
|
100
|
+
title: "Refresh Token",
|
|
101
|
+
description: "Hashed refresh token for this session.",
|
|
102
|
+
required: true,
|
|
103
|
+
hideColumnInDocumentation: true,
|
|
104
|
+
})
|
|
105
|
+
@Column({
|
|
106
|
+
type: ColumnType.HashedString,
|
|
107
|
+
length: ColumnLength.HashedString,
|
|
108
|
+
nullable: false,
|
|
109
|
+
unique: true,
|
|
110
|
+
transformer: HashedString.getDatabaseTransformer(),
|
|
111
|
+
})
|
|
112
|
+
public refreshToken?: HashedString = undefined;
|
|
113
|
+
|
|
114
|
+
@ColumnAccessControl({
|
|
115
|
+
create: [],
|
|
116
|
+
read: [],
|
|
117
|
+
update: [],
|
|
118
|
+
})
|
|
119
|
+
@TableColumn({
|
|
120
|
+
type: TableColumnType.Date,
|
|
121
|
+
title: "Refresh Token Expires At",
|
|
122
|
+
description: "Expiration timestamp for the refresh token.",
|
|
123
|
+
required: true,
|
|
124
|
+
})
|
|
125
|
+
@Column({
|
|
126
|
+
type: ColumnType.Date,
|
|
127
|
+
nullable: false,
|
|
128
|
+
})
|
|
129
|
+
public refreshTokenExpiresAt?: Date = undefined;
|
|
130
|
+
|
|
131
|
+
@ColumnAccessControl({
|
|
132
|
+
create: [],
|
|
133
|
+
read: [Permission.CurrentUser],
|
|
134
|
+
update: [],
|
|
135
|
+
})
|
|
136
|
+
@TableColumn({
|
|
137
|
+
type: TableColumnType.Date,
|
|
138
|
+
title: "Last Active At",
|
|
139
|
+
description: "Last time this session was used.",
|
|
140
|
+
})
|
|
141
|
+
@Column({
|
|
142
|
+
type: ColumnType.Date,
|
|
143
|
+
nullable: true,
|
|
144
|
+
})
|
|
145
|
+
public lastActiveAt?: Date = undefined;
|
|
146
|
+
|
|
147
|
+
@ColumnAccessControl({
|
|
148
|
+
create: [],
|
|
149
|
+
read: [Permission.CurrentUser],
|
|
150
|
+
update: [],
|
|
151
|
+
})
|
|
152
|
+
@TableColumn({
|
|
153
|
+
type: TableColumnType.ShortText,
|
|
154
|
+
title: "Device Name",
|
|
155
|
+
description: "Friendly name for the device used to sign in.",
|
|
156
|
+
})
|
|
157
|
+
@Column({
|
|
158
|
+
type: ColumnType.ShortText,
|
|
159
|
+
length: ColumnLength.ShortText,
|
|
160
|
+
nullable: true,
|
|
161
|
+
})
|
|
162
|
+
public deviceName?: string = undefined;
|
|
163
|
+
|
|
164
|
+
@ColumnAccessControl({
|
|
165
|
+
create: [],
|
|
166
|
+
read: [Permission.CurrentUser],
|
|
167
|
+
update: [],
|
|
168
|
+
})
|
|
169
|
+
@TableColumn({
|
|
170
|
+
type: TableColumnType.ShortText,
|
|
171
|
+
title: "Device Type",
|
|
172
|
+
description: "Type of device (e.g., desktop, mobile).",
|
|
173
|
+
})
|
|
174
|
+
@Column({
|
|
175
|
+
type: ColumnType.ShortText,
|
|
176
|
+
length: ColumnLength.ShortText,
|
|
177
|
+
nullable: true,
|
|
178
|
+
})
|
|
179
|
+
public deviceType?: string = undefined;
|
|
180
|
+
|
|
181
|
+
@ColumnAccessControl({
|
|
182
|
+
create: [],
|
|
183
|
+
read: [Permission.CurrentUser],
|
|
184
|
+
update: [],
|
|
185
|
+
})
|
|
186
|
+
@TableColumn({
|
|
187
|
+
type: TableColumnType.ShortText,
|
|
188
|
+
title: "Device OS",
|
|
189
|
+
description: "Operating system reported for this session.",
|
|
190
|
+
})
|
|
191
|
+
@Column({
|
|
192
|
+
type: ColumnType.ShortText,
|
|
193
|
+
length: ColumnLength.ShortText,
|
|
194
|
+
nullable: true,
|
|
195
|
+
})
|
|
196
|
+
public deviceOS?: string = undefined;
|
|
197
|
+
|
|
198
|
+
@ColumnAccessControl({
|
|
199
|
+
create: [],
|
|
200
|
+
read: [Permission.CurrentUser],
|
|
201
|
+
update: [],
|
|
202
|
+
})
|
|
203
|
+
@TableColumn({
|
|
204
|
+
type: TableColumnType.ShortText,
|
|
205
|
+
title: "Browser",
|
|
206
|
+
description: "Browser or client application used for this session.",
|
|
207
|
+
})
|
|
208
|
+
@Column({
|
|
209
|
+
type: ColumnType.ShortText,
|
|
210
|
+
length: ColumnLength.ShortText,
|
|
211
|
+
nullable: true,
|
|
212
|
+
})
|
|
213
|
+
public deviceBrowser?: string = undefined;
|
|
214
|
+
|
|
215
|
+
@ColumnAccessControl({
|
|
216
|
+
create: [],
|
|
217
|
+
read: [Permission.CurrentUser],
|
|
218
|
+
update: [],
|
|
219
|
+
})
|
|
220
|
+
@TableColumn({
|
|
221
|
+
type: TableColumnType.ShortText,
|
|
222
|
+
title: "IP Address",
|
|
223
|
+
description: "IP address observed for this session.",
|
|
224
|
+
})
|
|
225
|
+
@Column({
|
|
226
|
+
type: ColumnType.ShortText,
|
|
227
|
+
length: ColumnLength.ShortText,
|
|
228
|
+
nullable: true,
|
|
229
|
+
})
|
|
230
|
+
public ipAddress?: string = undefined;
|
|
231
|
+
|
|
232
|
+
@ColumnAccessControl({
|
|
233
|
+
create: [],
|
|
234
|
+
read: [Permission.CurrentUser],
|
|
235
|
+
update: [],
|
|
236
|
+
})
|
|
237
|
+
@TableColumn({
|
|
238
|
+
type: TableColumnType.VeryLongText,
|
|
239
|
+
title: "User Agent",
|
|
240
|
+
description: "Complete user agent string supplied by the client.",
|
|
241
|
+
})
|
|
242
|
+
@Column({
|
|
243
|
+
type: ColumnType.VeryLongText,
|
|
244
|
+
nullable: true,
|
|
245
|
+
})
|
|
246
|
+
public userAgent?: string = undefined;
|
|
247
|
+
|
|
248
|
+
@ColumnAccessControl({
|
|
249
|
+
create: [],
|
|
250
|
+
read: [Permission.CurrentUser],
|
|
251
|
+
update: [],
|
|
252
|
+
})
|
|
253
|
+
@TableColumn({
|
|
254
|
+
type: TableColumnType.Boolean,
|
|
255
|
+
title: "Is Revoked",
|
|
256
|
+
description: "Marks whether the session has been explicitly revoked.",
|
|
257
|
+
isDefaultValueColumn: true,
|
|
258
|
+
defaultValue: false,
|
|
259
|
+
})
|
|
260
|
+
@Column({
|
|
261
|
+
type: ColumnType.Boolean,
|
|
262
|
+
nullable: false,
|
|
263
|
+
default: false,
|
|
264
|
+
})
|
|
265
|
+
public isRevoked?: boolean = undefined;
|
|
266
|
+
|
|
267
|
+
@ColumnAccessControl({
|
|
268
|
+
create: [],
|
|
269
|
+
read: [Permission.CurrentUser],
|
|
270
|
+
update: [],
|
|
271
|
+
})
|
|
272
|
+
@TableColumn({
|
|
273
|
+
type: TableColumnType.Date,
|
|
274
|
+
title: "Revoked At",
|
|
275
|
+
description: "Timestamp when the session was revoked, if applicable.",
|
|
276
|
+
})
|
|
277
|
+
@Column({
|
|
278
|
+
type: ColumnType.Date,
|
|
279
|
+
nullable: true,
|
|
280
|
+
})
|
|
281
|
+
public revokedAt?: Date = undefined;
|
|
282
|
+
|
|
283
|
+
@ColumnAccessControl({
|
|
284
|
+
create: [],
|
|
285
|
+
read: [Permission.CurrentUser],
|
|
286
|
+
update: [],
|
|
287
|
+
})
|
|
288
|
+
@TableColumn({
|
|
289
|
+
type: TableColumnType.ShortText,
|
|
290
|
+
title: "Revoked Reason",
|
|
291
|
+
description: "Optional reason describing why the session was revoked.",
|
|
292
|
+
})
|
|
293
|
+
@Column({
|
|
294
|
+
type: ColumnType.ShortText,
|
|
295
|
+
length: ColumnLength.ShortText,
|
|
296
|
+
nullable: true,
|
|
297
|
+
})
|
|
298
|
+
public revokedReason?: string = undefined;
|
|
299
|
+
|
|
300
|
+
@ColumnAccessControl({
|
|
301
|
+
create: [],
|
|
302
|
+
read: [Permission.CurrentUser],
|
|
303
|
+
update: [],
|
|
304
|
+
})
|
|
305
|
+
@TableColumn({
|
|
306
|
+
type: TableColumnType.JSON,
|
|
307
|
+
title: "Additional Info",
|
|
308
|
+
description:
|
|
309
|
+
"Flexible JSON payload for storing structured session metadata.",
|
|
310
|
+
})
|
|
311
|
+
@Column({
|
|
312
|
+
type: ColumnType.JSON,
|
|
313
|
+
nullable: true,
|
|
314
|
+
})
|
|
315
|
+
public additionalInfo?: JSONObject = undefined;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export default UserSession;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1762890441920 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1762890441920";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "StatusPagePrivateUserSession" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "statusPageId" uuid NOT NULL, "statusPagePrivateUserId" uuid NOT NULL, "refreshToken" character varying(64) NOT NULL, "refreshTokenExpiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "lastActiveAt" TIMESTAMP WITH TIME ZONE, "deviceName" character varying(100), "deviceType" character varying(100), "deviceOS" character varying(100), "deviceBrowser" character varying(100), "ipAddress" character varying(100), "userAgent" text, "isRevoked" boolean NOT NULL DEFAULT false, "revokedAt" TIMESTAMP WITH TIME ZONE, "revokedReason" character varying(100), "additionalInfo" jsonb, CONSTRAINT "UQ_12ce827a16d121bf6719260b8a9" UNIQUE ("refreshToken"), CONSTRAINT "PK_cbace84fe4c9712b94e571dc133" PRIMARY KEY ("_id"))`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`CREATE INDEX "IDX_ac5f4c13d6bc9696cbfb8e5a79" ON "StatusPagePrivateUserSession" ("projectId") `,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`CREATE INDEX "IDX_7b8d9b6e068c045d56b47a484b" ON "StatusPagePrivateUserSession" ("statusPageId") `,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`CREATE INDEX "IDX_365d602943505272f8f651ff4e" ON "StatusPagePrivateUserSession" ("statusPagePrivateUserId") `,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`CREATE UNIQUE INDEX "IDX_12ce827a16d121bf6719260b8a" ON "StatusPagePrivateUserSession" ("refreshToken") `,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`CREATE TABLE "UserSession" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "userId" uuid NOT NULL, "refreshToken" character varying(64) NOT NULL, "refreshTokenExpiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "lastActiveAt" TIMESTAMP WITH TIME ZONE, "deviceName" character varying(100), "deviceType" character varying(100), "deviceOS" character varying(100), "deviceBrowser" character varying(100), "ipAddress" character varying(100), "userAgent" text, "isRevoked" boolean NOT NULL DEFAULT false, "revokedAt" TIMESTAMP WITH TIME ZONE, "revokedReason" character varying(100), "additionalInfo" jsonb, CONSTRAINT "UQ_d66bd8342b0005c7192bdb17efc" UNIQUE ("refreshToken"), CONSTRAINT "PK_9dcd180f25755bab5fcebcbeb14" PRIMARY KEY ("_id"))`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`CREATE INDEX "IDX_7353eaf92987aeaf38c2590e94" ON "UserSession" ("userId") `,
|
|
27
|
+
);
|
|
28
|
+
await queryRunner.query(
|
|
29
|
+
`CREATE UNIQUE INDEX "IDX_d66bd8342b0005c7192bdb17ef" ON "UserSession" ("refreshToken") `,
|
|
30
|
+
);
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
|
|
33
|
+
);
|
|
34
|
+
await queryRunner.query(
|
|
35
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
|
|
36
|
+
);
|
|
37
|
+
await queryRunner.query(
|
|
38
|
+
`ALTER TABLE "StatusPagePrivateUserSession" ADD CONSTRAINT "FK_ac5f4c13d6bc9696cbfb8e5a794" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
39
|
+
);
|
|
40
|
+
await queryRunner.query(
|
|
41
|
+
`ALTER TABLE "StatusPagePrivateUserSession" ADD CONSTRAINT "FK_7b8d9b6e068c045d56b47a484be" FOREIGN KEY ("statusPageId") REFERENCES "StatusPage"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
42
|
+
);
|
|
43
|
+
await queryRunner.query(
|
|
44
|
+
`ALTER TABLE "StatusPagePrivateUserSession" ADD CONSTRAINT "FK_365d602943505272f8f651ff4e8" FOREIGN KEY ("statusPagePrivateUserId") REFERENCES "StatusPagePrivateUser"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
45
|
+
);
|
|
46
|
+
await queryRunner.query(
|
|
47
|
+
`ALTER TABLE "UserSession" ADD CONSTRAINT "FK_7353eaf92987aeaf38c2590e943" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
52
|
+
await queryRunner.query(
|
|
53
|
+
`ALTER TABLE "UserSession" DROP CONSTRAINT "FK_7353eaf92987aeaf38c2590e943"`,
|
|
54
|
+
);
|
|
55
|
+
await queryRunner.query(
|
|
56
|
+
`ALTER TABLE "StatusPagePrivateUserSession" DROP CONSTRAINT "FK_365d602943505272f8f651ff4e8"`,
|
|
57
|
+
);
|
|
58
|
+
await queryRunner.query(
|
|
59
|
+
`ALTER TABLE "StatusPagePrivateUserSession" DROP CONSTRAINT "FK_7b8d9b6e068c045d56b47a484be"`,
|
|
60
|
+
);
|
|
61
|
+
await queryRunner.query(
|
|
62
|
+
`ALTER TABLE "StatusPagePrivateUserSession" DROP CONSTRAINT "FK_ac5f4c13d6bc9696cbfb8e5a794"`,
|
|
63
|
+
);
|
|
64
|
+
await queryRunner.query(
|
|
65
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
|
|
66
|
+
);
|
|
67
|
+
await queryRunner.query(
|
|
68
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
|
|
69
|
+
);
|
|
70
|
+
await queryRunner.query(
|
|
71
|
+
`DROP INDEX "public"."IDX_d66bd8342b0005c7192bdb17ef"`,
|
|
72
|
+
);
|
|
73
|
+
await queryRunner.query(
|
|
74
|
+
`DROP INDEX "public"."IDX_7353eaf92987aeaf38c2590e94"`,
|
|
75
|
+
);
|
|
76
|
+
await queryRunner.query(`DROP TABLE "UserSession"`);
|
|
77
|
+
await queryRunner.query(
|
|
78
|
+
`DROP INDEX "public"."IDX_12ce827a16d121bf6719260b8a"`,
|
|
79
|
+
);
|
|
80
|
+
await queryRunner.query(
|
|
81
|
+
`DROP INDEX "public"."IDX_365d602943505272f8f651ff4e"`,
|
|
82
|
+
);
|
|
83
|
+
await queryRunner.query(
|
|
84
|
+
`DROP INDEX "public"."IDX_7b8d9b6e068c045d56b47a484b"`,
|
|
85
|
+
);
|
|
86
|
+
await queryRunner.query(
|
|
87
|
+
`DROP INDEX "public"."IDX_ac5f4c13d6bc9696cbfb8e5a79"`,
|
|
88
|
+
);
|
|
89
|
+
await queryRunner.query(`DROP TABLE "StatusPagePrivateUserSession"`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -181,6 +181,7 @@ import { MigrationName1761232578396 } from "./1761232578396-MigrationName";
|
|
|
181
181
|
import { MigrationName1761834523183 } from "./1761834523183-MigrationName";
|
|
182
182
|
import { MigrationName1762181014879 } from "./1762181014879-MigrationName";
|
|
183
183
|
import { MigrationName1762554602716 } from "./1762554602716-MigrationName";
|
|
184
|
+
import { MigrationName1762890441920 } from "./1762890441920-MigrationName";
|
|
184
185
|
|
|
185
186
|
export default [
|
|
186
187
|
InitialMigration,
|
|
@@ -366,4 +367,5 @@ export default [
|
|
|
366
367
|
MigrationName1761834523183,
|
|
367
368
|
MigrationName1762181014879,
|
|
368
369
|
MigrationName1762554602716,
|
|
370
|
+
MigrationName1762890441920,
|
|
369
371
|
];
|
package/Server/Services/Index.ts
CHANGED
|
@@ -106,6 +106,7 @@ import StatusPageHistoryChartBarColorRuleService from "./StatusPageHistoryChartB
|
|
|
106
106
|
import StatusPageOwnerTeamService from "./StatusPageOwnerTeamService";
|
|
107
107
|
import StatusPageOwnerUserService from "./StatusPageOwnerUserService";
|
|
108
108
|
import StatusPagePrivateUserService from "./StatusPagePrivateUserService";
|
|
109
|
+
import StatusPagePrivateUserSessionService from "./StatusPagePrivateUserSessionService";
|
|
109
110
|
import StatusPageResourceService from "./StatusPageResourceService";
|
|
110
111
|
// Status Page
|
|
111
112
|
import StatusPageService from "./StatusPageService";
|
|
@@ -125,6 +126,7 @@ import UserNotificationSettingService from "./UserNotificationSettingService";
|
|
|
125
126
|
import UserOnCallLogService from "./UserOnCallLogService";
|
|
126
127
|
import UserOnCallLogTimelineService from "./UserOnCallLogTimelineService";
|
|
127
128
|
import UserService from "./UserService";
|
|
129
|
+
import UserSessionService from "./UserSessionService";
|
|
128
130
|
import UserTotpAuthService from "./UserTotpAuthService";
|
|
129
131
|
import UserWebAuthnService from "./UserWebAuthnService";
|
|
130
132
|
import UserSmsService from "./UserSmsService";
|
|
@@ -266,6 +268,7 @@ const services: Array<BaseService> = [
|
|
|
266
268
|
StatusPageOwnerTeamService,
|
|
267
269
|
StatusPageOwnerUserService,
|
|
268
270
|
StatusPagePrivateUserService,
|
|
271
|
+
StatusPagePrivateUserSessionService,
|
|
269
272
|
StatusPageResourceService,
|
|
270
273
|
StatusPageService,
|
|
271
274
|
StatusPageSsoService,
|
|
@@ -278,6 +281,7 @@ const services: Array<BaseService> = [
|
|
|
278
281
|
TeamService,
|
|
279
282
|
|
|
280
283
|
UserService,
|
|
284
|
+
UserSessionService,
|
|
281
285
|
UserCallService,
|
|
282
286
|
UserEmailService,
|
|
283
287
|
UserNotificationRuleService,
|