Skip to content

Commit 04fd85f

Browse files
committed
fix: remove dupe method responses & SQ unused vars
1 parent 8f05b36 commit 04fd85f

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

packages/cdk/resources/Apis.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export interface ApisProps {
2323
}
2424

2525
export class Apis extends Construct {
26+
apis: {[key: string]: RestApiGateway}
27+
endpoints: {[key: string]: Construct}
28+
2629
public constructor(scope: Construct, id: string, props: ApisProps) {
2730
super(scope, id)
2831

@@ -63,18 +66,11 @@ export class Apis extends Construct {
6366
credentialsRole: apiGateway.role,
6467
passthroughBehavior: PassthroughBehavior.WHEN_NO_MATCH
6568
}
66-
),
67-
{
68-
methodResponses: [
69-
{statusCode: "200"},
70-
{statusCode: "400"},
71-
{statusCode: "500"}
72-
]
73-
}
69+
)
7470
)
7571

7672
// POST /format-1 — Format1 state machine integration
77-
new StateMachineEndpoint(this, "Format1UpdatePrescriptionStatusEndpoint", {
73+
const format1PsuEndpoint = new StateMachineEndpoint(this, "Format1UpdatePrescriptionStatusEndpoint", {
7874
parentResource: rootResource,
7975
resourceName: "format-1",
8076
method: HttpMethod.POST,
@@ -83,7 +79,7 @@ export class Apis extends Construct {
8379
})
8480

8581
// POST /notification-delivery-status-callback — Lambda proxy integration
86-
new LambdaEndpoint(this, "NotificationDeliveryStatusCallbackEndpoint", {
82+
const notificationDeliveryStatusCallbackEndpoint = new LambdaEndpoint(this, "NotificationDeliveryStatusCallbackEndpoint", {
8783
parentResource: rootResource,
8884
resourceName: "notification-delivery-status-callback",
8985
method: HttpMethod.POST,
@@ -92,7 +88,7 @@ export class Apis extends Construct {
9288
})
9389

9490
// GET /_status — Lambda proxy integration
95-
new LambdaEndpoint(this, "StatusEndpoint", {
91+
const statusEndpoint = new LambdaEndpoint(this, "StatusEndpoint", {
9692
parentResource: rootResource,
9793
resourceName: "_status",
9894
method: HttpMethod.GET,
@@ -101,23 +97,32 @@ export class Apis extends Construct {
10197
})
10298

10399
// GET /metadata — Lambda proxy integration
104-
new LambdaEndpoint(this, "CapabilityStatementEndpoint", {
100+
const capabilityStatementEndpoint = new LambdaEndpoint(this, "CapabilityStatementEndpoint", {
105101
parentResource: rootResource,
106102
resourceName: "metadata",
107103
method: HttpMethod.GET,
108104
restApiGatewayRole: apiGateway.role,
109105
lambdaFunction: props.functions.capabilityStatement
110106
})
111107

108+
this.endpoints = {
109+
rootResource,
110+
format1UpdatePrescriptionStatusEndpoint: format1PsuEndpoint,
111+
status: statusEndpoint,
112+
capabilityStatement: capabilityStatementEndpoint,
113+
notificationDeliveryStatusCallback: notificationDeliveryStatusCallbackEndpoint,
114+
}
115+
112116
// GET /checkprescriptionstatusupdates — conditional Lambda proxy integration
113117
if (props.deployCheckPrescriptionStatusUpdate) {
114-
new LambdaEndpoint(this, "CheckPrescriptionStatusUpdatesEndpoint", {
118+
const checkPsu = new LambdaEndpoint(this, "CheckPrescriptionStatusUpdatesEndpoint", {
115119
parentResource: rootResource,
116120
resourceName: "checkprescriptionstatusupdates",
117121
method: HttpMethod.GET,
118122
restApiGatewayRole: apiGateway.role,
119123
lambdaFunction: props.functions.checkPrescriptionStatusUpdates
120124
})
125+
this.endpoints.checkPrescriptionStatusUpdates = checkPsu
121126
}
122127

123128
// POST /get-status-updates — conditional Lambda integration (non-proxy)
@@ -147,5 +152,9 @@ export class Apis extends Construct {
147152
}
148153
)
149154
}
155+
156+
this.apis = {
157+
api: apiGateway
158+
}
150159
}
151160
}

0 commit comments

Comments
 (0)