feat: Update .gitignore, add Lambda layer configuration, and refactor DynamoDB handlers to use AWS SDK v3

This commit is contained in:
2024-11-23 06:28:02 +02:00
parent 86c671ccd8
commit f57d963453
19 changed files with 2877 additions and 102 deletions

View File

@@ -1,22 +1,24 @@
import { fetchUserWithUserId } from "@/lib/util";
import { DynamoDB } from "aws-sdk";
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocument, QueryCommandInput } from "@aws-sdk/lib-dynamodb";
const SLS_REGION = process.env.SLS_REGION;
const TASKER_TEAM_TABLE_NAME = process.env.TASKER_TEAM_TABLE_NAME || "";
const docClient = new DynamoDB.DocumentClient({ region: SLS_REGION });
const client = new DynamoDBClient({ region: SLS_REGION });
const docClient = DynamoDBDocument.from(client);
export const handler = async (event: any): Promise<any> => {
try {
const params = {
const params: QueryCommandInput = {
TableName: TASKER_TEAM_TABLE_NAME,
KeyConditionExpression: "type = :type",
KeyConditionExpression: "category = :category",
ExpressionAttributeValues: {
":type": "teams",
":category": "teams",
},
};
const result = await docClient.query(params).promise();
const result = await docClient.query(params);
const teams = result.Items || [];
const teamsWithUsernames = await Promise.all(