@@ -9,6 +9,7 @@ export class ShareAPI extends Construct {
99 public readonly sharingStatusFn : Lambda . IFunction
1010 public readonly deviceJwtFn : Lambda . IFunction
1111 public readonly sharingStatusFingerprintFn : Lambda . IFunction
12+ public readonly listUserDevicesFn : Lambda . IFunction
1213 constructor (
1314 parent : Construct ,
1415 {
@@ -26,6 +27,7 @@ export class ShareAPI extends Construct {
2627 | 'sharingStatus'
2728 | 'sharingStatusFingerprint'
2829 | 'deviceJwt'
30+ | 'listUserDevices'
2931 >
3032 } ,
3133 ) {
@@ -40,7 +42,7 @@ export class ShareAPI extends Construct {
4042 layers : [ baseLayer ] ,
4143 environment : {
4244 PUBLIC_DEVICES_TABLE_NAME : publicDevices . publicDevicesTable . tableName ,
43- PUBLIC_DEVICES_ID_INDEX_NAME : publicDevices . idIndex ,
45+ PUBLIC_DEVICES_ID_INDEX_NAME : publicDevices . publicDevicesTableIdIndex ,
4446 IS_TEST : this . node . getContext ( 'isTest' ) === true ? '1' : '0' ,
4547 } ,
4648 } ,
@@ -56,7 +58,7 @@ export class ShareAPI extends Construct {
5658 layers : [ baseLayer ] ,
5759 environment : {
5860 PUBLIC_DEVICES_TABLE_NAME : publicDevices . publicDevicesTable . tableName ,
59- PUBLIC_DEVICES_ID_INDEX_NAME : publicDevices . idIndex ,
61+ PUBLIC_DEVICES_ID_INDEX_NAME : publicDevices . publicDevicesTableIdIndex ,
6062 } ,
6163 } ,
6264 ) . fn
@@ -72,7 +74,7 @@ export class ShareAPI extends Construct {
7274 layers : [ baseLayer ] ,
7375 environment : {
7476 PUBLIC_DEVICES_TABLE_NAME : publicDevices . publicDevicesTable . tableName ,
75- PUBLIC_DEVICES_ID_INDEX_NAME : publicDevices . idIndex ,
77+ PUBLIC_DEVICES_ID_INDEX_NAME : publicDevices . publicDevicesTableIdIndex ,
7678 } ,
7779 } ,
7880 ) . fn
@@ -90,10 +92,26 @@ export class ShareAPI extends Construct {
9092 layers : [ baseLayer , jwtLayer ] ,
9193 environment : {
9294 PUBLIC_DEVICES_TABLE_NAME : publicDevices . publicDevicesTable . tableName ,
93- PUBLIC_DEVICES_ID_INDEX_NAME : publicDevices . idIndex ,
95+ PUBLIC_DEVICES_ID_INDEX_NAME : publicDevices . publicDevicesTableIdIndex ,
9496 } ,
9597 } ,
9698 ) . fn
9799 publicDevices . publicDevicesTable . grantReadData ( this . deviceJwtFn )
100+
101+ this . listUserDevicesFn = new PackedLambdaFn (
102+ this ,
103+ 'listUserDevicesFn' ,
104+ lambdaSources . listUserDevices ,
105+ {
106+ description : 'List user devices' ,
107+ layers : [ baseLayer , jwtLayer ] ,
108+ environment : {
109+ PUBLIC_DEVICES_TABLE_NAME : publicDevices . publicDevicesTable . tableName ,
110+ PUBLIC_DEVICES_OWNER_EMAIL_INDEX_NAME :
111+ publicDevices . publicDevicesTableOwnerEmailIndex ,
112+ } ,
113+ } ,
114+ ) . fn
115+ publicDevices . publicDevicesTable . grantReadData ( this . listUserDevicesFn )
98116 }
99117}
0 commit comments