get operator

 avatar
unknown
javascript
19 days ago
689 B
2
Indexable
export async function getReview(operatorId: string) {
    try {
        // Create the scan command with filter expression for operatorId
        const command = new ScanCommand({
            TableName: "Review",
            FilterExpression: "operator_id = :operator_id",
            ExpressionAttributeValues: {
                ":operator_id": operatorId
            },
        });

        // Send the command to DynamoDB
        const response = await client.send(command);

        // Return the items or an empty array if no items are found
        return response?.Items || [];
    } catch (error) {
        console.error("Error fetching reviews:", error);
    }
}
Editor is loading...
Leave a Comment