@oneuptime/common 9.5.2 → 9.5.3
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 +1 -0
- package/Models/DatabaseModels/AlertEpisode.ts +1 -0
- package/Models/DatabaseModels/AlertEpisodeStateTimeline.ts +1 -0
- package/Models/DatabaseModels/AlertStateTimeline.ts +1 -0
- package/Models/DatabaseModels/Incident.ts +1 -0
- package/Models/DatabaseModels/IncidentEpisode.ts +156 -0
- package/Models/DatabaseModels/IncidentEpisodeFeed.ts +2 -0
- package/Models/DatabaseModels/IncidentEpisodePublicNote.ts +611 -0
- package/Models/DatabaseModels/IncidentEpisodeStateTimeline.ts +84 -0
- package/Models/DatabaseModels/IncidentGroupingRule.ts +36 -0
- package/Models/DatabaseModels/IncidentStateTimeline.ts +1 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/MonitorStatusTimeline.ts +1 -0
- package/Models/DatabaseModels/Project.ts +2 -1
- package/Models/DatabaseModels/ProjectCallSMSConfig.ts +1 -0
- package/Models/DatabaseModels/ScheduledMaintenance.ts +1 -0
- package/Models/DatabaseModels/ScheduledMaintenanceTemplate.ts +1 -0
- package/Models/DatabaseModels/StatusPage.ts +120 -0
- package/Server/API/IncidentEpisodePublicNoteAPI.ts +98 -0
- package/Server/API/StatusPageAPI.ts +1092 -45
- package/Server/Infrastructure/Postgres/SchemaMigrations/1770232207959-MigrationName.ts +181 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1770237245069-MigrationName.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Services/IncidentEpisodePublicNoteService.ts +254 -0
- package/Server/Services/IncidentEpisodeService.ts +26 -0
- package/Server/Services/Index.ts +2 -0
- package/Server/Utils/Monitor/MonitorIncident.ts +6 -0
- package/Types/Email/EmailTemplateType.ts +4 -0
- package/Types/Icon/IconProp.ts +172 -0
- package/Types/Monitor/CriteriaIncident.ts +2 -0
- package/Types/Permission.ts +40 -0
- package/Types/StatusPage/StatusPageSubscriberNotificationEventType.ts +5 -0
- package/UI/Components/Icon/Icon.tsx +1333 -1
- package/build/dist/Models/DatabaseModels/Alert.js +1 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertEpisode.js +1 -0
- package/build/dist/Models/DatabaseModels/AlertEpisode.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/AlertStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Incident.js +1 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js +161 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodeFeed.js +2 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodePublicNote.js +626 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodePublicNote.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js +86 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentGroupingRule.js +37 -0
- package/build/dist/Models/DatabaseModels/IncidentGroupingRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.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/MonitorStatusTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/MonitorStatusTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +2 -1
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProjectCallSMSConfig.js +1 -0
- package/build/dist/Models/DatabaseModels/ProjectCallSMSConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +126 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Server/API/IncidentEpisodePublicNoteAPI.js +68 -0
- package/build/dist/Server/API/IncidentEpisodePublicNoteAPI.js.map +1 -0
- package/build/dist/Server/API/StatusPageAPI.js +874 -47
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1770232207959-MigrationName.js +68 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1770232207959-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1770237245069-MigrationName.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1770237245069-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js +223 -0
- package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeService.js +22 -0
- package/build/dist/Server/Services/IncidentEpisodeService.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/Utils/Monitor/MonitorIncident.js +5 -0
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Types/Email/EmailTemplateType.js +3 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Icon/IconProp.js +172 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaIncident.js +1 -0
- package/build/dist/Types/Monitor/CriteriaIncident.js.map +1 -1
- package/build/dist/Types/Permission.js +34 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/StatusPage/StatusPageSubscriberNotificationEventType.js +4 -0
- package/build/dist/Types/StatusPage/StatusPageSubscriberNotificationEventType.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +502 -1
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/package.json +1 -1
|
@@ -1690,4 +1690,40 @@ export default class IncidentGroupingRule extends BaseModel {
|
|
|
1690
1690
|
transformer: ObjectID.getDatabaseTransformer(),
|
|
1691
1691
|
})
|
|
1692
1692
|
public deletedByUserId?: ObjectID = undefined;
|
|
1693
|
+
|
|
1694
|
+
@ColumnAccessControl({
|
|
1695
|
+
create: [
|
|
1696
|
+
Permission.ProjectOwner,
|
|
1697
|
+
Permission.ProjectAdmin,
|
|
1698
|
+
Permission.CreateIncidentGroupingRule,
|
|
1699
|
+
],
|
|
1700
|
+
read: [
|
|
1701
|
+
Permission.ProjectOwner,
|
|
1702
|
+
Permission.ProjectAdmin,
|
|
1703
|
+
Permission.ProjectMember,
|
|
1704
|
+
Permission.ReadIncidentGroupingRule,
|
|
1705
|
+
Permission.ReadAllProjectResources,
|
|
1706
|
+
],
|
|
1707
|
+
update: [
|
|
1708
|
+
Permission.ProjectOwner,
|
|
1709
|
+
Permission.ProjectAdmin,
|
|
1710
|
+
Permission.EditIncidentGroupingRule,
|
|
1711
|
+
],
|
|
1712
|
+
})
|
|
1713
|
+
@Index()
|
|
1714
|
+
@TableColumn({
|
|
1715
|
+
required: true,
|
|
1716
|
+
type: TableColumnType.Boolean,
|
|
1717
|
+
title: "Show Episodes on Status Page",
|
|
1718
|
+
description:
|
|
1719
|
+
"Should episodes created by this rule be shown on the status page?",
|
|
1720
|
+
defaultValue: false,
|
|
1721
|
+
isDefaultValueColumn: true,
|
|
1722
|
+
})
|
|
1723
|
+
@Column({
|
|
1724
|
+
type: ColumnType.Boolean,
|
|
1725
|
+
nullable: false,
|
|
1726
|
+
default: false,
|
|
1727
|
+
})
|
|
1728
|
+
public showEpisodeOnStatusPage?: boolean = undefined;
|
|
1693
1729
|
}
|
|
@@ -210,6 +210,7 @@ import IncidentEpisodeOwnerUser from "./IncidentEpisodeOwnerUser";
|
|
|
210
210
|
import IncidentEpisodeOwnerTeam from "./IncidentEpisodeOwnerTeam";
|
|
211
211
|
import IncidentEpisodeInternalNote from "./IncidentEpisodeInternalNote";
|
|
212
212
|
import IncidentEpisodeFeed from "./IncidentEpisodeFeed";
|
|
213
|
+
import IncidentEpisodePublicNote from "./IncidentEpisodePublicNote";
|
|
213
214
|
import IncidentGroupingRule from "./IncidentGroupingRule";
|
|
214
215
|
import IncidentSlaRule from "./IncidentSlaRule";
|
|
215
216
|
import IncidentSla from "./IncidentSla";
|
|
@@ -318,6 +319,7 @@ const AllModelTypes: Array<{
|
|
|
318
319
|
IncidentEpisodeOwnerTeam,
|
|
319
320
|
IncidentEpisodeInternalNote,
|
|
320
321
|
IncidentEpisodeFeed,
|
|
322
|
+
IncidentEpisodePublicNote,
|
|
321
323
|
IncidentGroupingRule,
|
|
322
324
|
IncidentSlaRule,
|
|
323
325
|
IncidentSla,
|
|
@@ -584,7 +584,7 @@ export default class Project extends TenantModel {
|
|
|
584
584
|
read: [],
|
|
585
585
|
update: [],
|
|
586
586
|
})
|
|
587
|
-
@TableColumn({ type: TableColumnType.SmallPositiveNumber })
|
|
587
|
+
@TableColumn({ type: TableColumnType.SmallPositiveNumber, computed: true })
|
|
588
588
|
@Column({
|
|
589
589
|
type: ColumnType.SmallPositiveNumber,
|
|
590
590
|
nullable: true,
|
|
@@ -709,6 +709,7 @@ export default class Project extends TenantModel {
|
|
|
709
709
|
@TableColumn({
|
|
710
710
|
type: TableColumnType.Number,
|
|
711
711
|
hideColumnInDocumentation: true,
|
|
712
|
+
computed: true,
|
|
712
713
|
})
|
|
713
714
|
@Column({
|
|
714
715
|
type: ColumnType.Number,
|
|
@@ -181,6 +181,7 @@ export default class ProjectCallSMSConfig extends BaseModel {
|
|
|
181
181
|
required: true,
|
|
182
182
|
unique: true,
|
|
183
183
|
type: TableColumnType.Slug,
|
|
184
|
+
computed: true,
|
|
184
185
|
title: "Slug",
|
|
185
186
|
description: "Friendly globally unique name for your object",
|
|
186
187
|
example: "production-twilio-config",
|
|
@@ -865,6 +865,7 @@ export default class ScheduledMaintenanceTemplate extends BaseModel {
|
|
|
865
865
|
@TableColumn({
|
|
866
866
|
isDefaultValueColumn: false,
|
|
867
867
|
type: TableColumnType.Date,
|
|
868
|
+
computed: true,
|
|
868
869
|
title: "Schedule Next Event At",
|
|
869
870
|
description: "When is the next event scheduled?",
|
|
870
871
|
example: "2024-03-29T02:00:00.000Z",
|
|
@@ -2357,6 +2357,126 @@ export default class StatusPage extends BaseModel {
|
|
|
2357
2357
|
})
|
|
2358
2358
|
public showAnnouncementsOnStatusPage?: boolean = undefined;
|
|
2359
2359
|
|
|
2360
|
+
@ColumnAccessControl({
|
|
2361
|
+
create: [
|
|
2362
|
+
Permission.ProjectOwner,
|
|
2363
|
+
Permission.ProjectAdmin,
|
|
2364
|
+
Permission.ProjectMember,
|
|
2365
|
+
Permission.CreateProjectStatusPage,
|
|
2366
|
+
],
|
|
2367
|
+
read: [
|
|
2368
|
+
Permission.ProjectOwner,
|
|
2369
|
+
Permission.ProjectAdmin,
|
|
2370
|
+
Permission.ProjectMember,
|
|
2371
|
+
Permission.ReadProjectStatusPage,
|
|
2372
|
+
Permission.ReadAllProjectResources,
|
|
2373
|
+
],
|
|
2374
|
+
update: [
|
|
2375
|
+
Permission.ProjectOwner,
|
|
2376
|
+
Permission.ProjectAdmin,
|
|
2377
|
+
Permission.ProjectMember,
|
|
2378
|
+
Permission.EditProjectStatusPage,
|
|
2379
|
+
],
|
|
2380
|
+
})
|
|
2381
|
+
@TableColumn({
|
|
2382
|
+
isDefaultValueColumn: true,
|
|
2383
|
+
type: TableColumnType.Boolean,
|
|
2384
|
+
title: "Show Incident Episodes on Status Page",
|
|
2385
|
+
description: "Show Incident Episodes on Status Page?",
|
|
2386
|
+
defaultValue: true,
|
|
2387
|
+
})
|
|
2388
|
+
@Column({
|
|
2389
|
+
type: ColumnType.Boolean,
|
|
2390
|
+
default: true,
|
|
2391
|
+
nullable: false,
|
|
2392
|
+
})
|
|
2393
|
+
@ColumnBillingAccessControl({
|
|
2394
|
+
read: PlanType.Free,
|
|
2395
|
+
update: PlanType.Growth,
|
|
2396
|
+
create: PlanType.Free,
|
|
2397
|
+
})
|
|
2398
|
+
public showEpisodesOnStatusPage?: boolean = undefined;
|
|
2399
|
+
|
|
2400
|
+
@ColumnAccessControl({
|
|
2401
|
+
create: [
|
|
2402
|
+
Permission.ProjectOwner,
|
|
2403
|
+
Permission.ProjectAdmin,
|
|
2404
|
+
Permission.ProjectMember,
|
|
2405
|
+
Permission.CreateProjectStatusPage,
|
|
2406
|
+
],
|
|
2407
|
+
read: [
|
|
2408
|
+
Permission.ProjectOwner,
|
|
2409
|
+
Permission.ProjectAdmin,
|
|
2410
|
+
Permission.ProjectMember,
|
|
2411
|
+
Permission.ReadProjectStatusPage,
|
|
2412
|
+
Permission.ReadAllProjectResources,
|
|
2413
|
+
],
|
|
2414
|
+
update: [
|
|
2415
|
+
Permission.ProjectOwner,
|
|
2416
|
+
Permission.ProjectAdmin,
|
|
2417
|
+
Permission.ProjectMember,
|
|
2418
|
+
Permission.EditProjectStatusPage,
|
|
2419
|
+
],
|
|
2420
|
+
})
|
|
2421
|
+
@TableColumn({
|
|
2422
|
+
isDefaultValueColumn: true,
|
|
2423
|
+
type: TableColumnType.Number,
|
|
2424
|
+
title: "Show Episode History In Days",
|
|
2425
|
+
description: "How many days of episode history to show on the status page",
|
|
2426
|
+
defaultValue: 14,
|
|
2427
|
+
})
|
|
2428
|
+
@Column({
|
|
2429
|
+
type: ColumnType.Number,
|
|
2430
|
+
default: 14,
|
|
2431
|
+
nullable: false,
|
|
2432
|
+
})
|
|
2433
|
+
@ColumnBillingAccessControl({
|
|
2434
|
+
read: PlanType.Free,
|
|
2435
|
+
update: PlanType.Growth,
|
|
2436
|
+
create: PlanType.Free,
|
|
2437
|
+
})
|
|
2438
|
+
public showEpisodeHistoryInDays?: number = undefined;
|
|
2439
|
+
|
|
2440
|
+
@ColumnAccessControl({
|
|
2441
|
+
create: [
|
|
2442
|
+
Permission.ProjectOwner,
|
|
2443
|
+
Permission.ProjectAdmin,
|
|
2444
|
+
Permission.ProjectMember,
|
|
2445
|
+
Permission.CreateProjectStatusPage,
|
|
2446
|
+
],
|
|
2447
|
+
read: [
|
|
2448
|
+
Permission.ProjectOwner,
|
|
2449
|
+
Permission.ProjectAdmin,
|
|
2450
|
+
Permission.ProjectMember,
|
|
2451
|
+
Permission.ReadProjectStatusPage,
|
|
2452
|
+
Permission.ReadAllProjectResources,
|
|
2453
|
+
],
|
|
2454
|
+
update: [
|
|
2455
|
+
Permission.ProjectOwner,
|
|
2456
|
+
Permission.ProjectAdmin,
|
|
2457
|
+
Permission.ProjectMember,
|
|
2458
|
+
Permission.EditProjectStatusPage,
|
|
2459
|
+
],
|
|
2460
|
+
})
|
|
2461
|
+
@TableColumn({
|
|
2462
|
+
isDefaultValueColumn: true,
|
|
2463
|
+
type: TableColumnType.Boolean,
|
|
2464
|
+
title: "Show Episode Labels on Status Page",
|
|
2465
|
+
description: "Show Episode Labels on Status Page?",
|
|
2466
|
+
defaultValue: false,
|
|
2467
|
+
})
|
|
2468
|
+
@Column({
|
|
2469
|
+
type: ColumnType.Boolean,
|
|
2470
|
+
default: false,
|
|
2471
|
+
nullable: false,
|
|
2472
|
+
})
|
|
2473
|
+
@ColumnBillingAccessControl({
|
|
2474
|
+
read: PlanType.Free,
|
|
2475
|
+
update: PlanType.Growth,
|
|
2476
|
+
create: PlanType.Free,
|
|
2477
|
+
})
|
|
2478
|
+
public showEpisodeLabelsOnStatusPage?: boolean = undefined;
|
|
2479
|
+
|
|
2360
2480
|
@ColumnAccessControl({
|
|
2361
2481
|
create: [
|
|
2362
2482
|
Permission.ProjectOwner,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import IncidentEpisodePublicNote from "../../Models/DatabaseModels/IncidentEpisodePublicNote";
|
|
2
|
+
import File from "../../Models/DatabaseModels/File";
|
|
3
|
+
import NotFoundException from "../../Types/Exception/NotFoundException";
|
|
4
|
+
import ObjectID from "../../Types/ObjectID";
|
|
5
|
+
import IncidentEpisodePublicNoteService, {
|
|
6
|
+
Service as IncidentEpisodePublicNoteServiceType,
|
|
7
|
+
} from "../Services/IncidentEpisodePublicNoteService";
|
|
8
|
+
import Response from "../Utils/Response";
|
|
9
|
+
import BaseAPI from "./BaseAPI";
|
|
10
|
+
import UserMiddleware from "../Middleware/UserAuthorization";
|
|
11
|
+
import {
|
|
12
|
+
ExpressRequest,
|
|
13
|
+
ExpressResponse,
|
|
14
|
+
NextFunction,
|
|
15
|
+
} from "../Utils/Express";
|
|
16
|
+
import CommonAPI from "./CommonAPI";
|
|
17
|
+
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
18
|
+
|
|
19
|
+
export default class IncidentEpisodePublicNoteAPI extends BaseAPI<
|
|
20
|
+
IncidentEpisodePublicNote,
|
|
21
|
+
IncidentEpisodePublicNoteServiceType
|
|
22
|
+
> {
|
|
23
|
+
public constructor() {
|
|
24
|
+
super(IncidentEpisodePublicNote, IncidentEpisodePublicNoteService);
|
|
25
|
+
|
|
26
|
+
this.router.get(
|
|
27
|
+
`${new this.entityType().getCrudApiPath()?.toString()}/attachment/:projectId/:noteId/:fileId`,
|
|
28
|
+
UserMiddleware.getUserMiddleware,
|
|
29
|
+
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
30
|
+
try {
|
|
31
|
+
await this.getAttachment(req, res);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
next(err);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private async getAttachment(
|
|
40
|
+
req: ExpressRequest,
|
|
41
|
+
res: ExpressResponse,
|
|
42
|
+
): Promise<void> {
|
|
43
|
+
const noteIdParam: string | undefined = req.params["noteId"];
|
|
44
|
+
const fileIdParam: string | undefined = req.params["fileId"];
|
|
45
|
+
|
|
46
|
+
if (!noteIdParam || !fileIdParam) {
|
|
47
|
+
throw new NotFoundException("Attachment not found");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let noteId: ObjectID;
|
|
51
|
+
let fileId: ObjectID;
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
noteId = new ObjectID(noteIdParam);
|
|
55
|
+
fileId = new ObjectID(fileIdParam);
|
|
56
|
+
} catch {
|
|
57
|
+
throw new NotFoundException("Attachment not found");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const props: DatabaseCommonInteractionProps =
|
|
61
|
+
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
62
|
+
|
|
63
|
+
const note: IncidentEpisodePublicNote | null = await this.service.findOneBy(
|
|
64
|
+
{
|
|
65
|
+
query: {
|
|
66
|
+
_id: noteId,
|
|
67
|
+
},
|
|
68
|
+
select: {
|
|
69
|
+
attachments: {
|
|
70
|
+
_id: true,
|
|
71
|
+
file: true,
|
|
72
|
+
fileType: true,
|
|
73
|
+
name: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
props,
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const attachment: File | undefined = note?.attachments?.find(
|
|
81
|
+
(file: File) => {
|
|
82
|
+
const attachmentId: string | null = file._id
|
|
83
|
+
? file._id.toString()
|
|
84
|
+
: file.id
|
|
85
|
+
? file.id.toString()
|
|
86
|
+
: null;
|
|
87
|
+
return attachmentId === fileId.toString();
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
if (!attachment || !attachment.file) {
|
|
92
|
+
throw new NotFoundException("Attachment not found");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
Response.setNoCacheHeaders(res);
|
|
96
|
+
return Response.sendFileResponse(req, res, attachment);
|
|
97
|
+
}
|
|
98
|
+
}
|