Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Adds DynamoDB Adapter #333

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
fix get document
  • Loading branch information
ajwad-shaikh committed Oct 8, 2023
commit 4192386d0d66380938cf09b3e44c7d4194c18c70
9 changes: 6 additions & 3 deletions src/Database/Adapter/DynamoDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Utopia\Database\Adapter;
use Utopia\Database\Document;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Query;
use Utopia\Database\Exception as DatabaseException;
use Aws\DynamoDb\Exception\DynamoDbException;
Expand Down Expand Up @@ -546,19 +547,21 @@ public function getDocument(string $collection, string $id, array $queries = [])
}

if (\array_key_exists('_id', $document)) {
$document['$internalId'] = $result['_id'];
$document['$internalId'] = $document['_id'];
unset($document['_id']);
}
if (\array_key_exists('_uid', $document)) {
$document['$id'] = $document['_uid'];
unset($document['_uid']);
}
if (\array_key_exists('_createdAt', $document)) {
$document['$createdAt'] = $document['_createdAt'];
$epoch = $document['_createdAt'];
$document['$createdAt'] = DateTime::format(new \DateTime("@$epoch"));
unset($document['_createdAt']);
}
if (\array_key_exists('_updatedAt', $document)) {
$document['$updatedAt'] = $document['_updatedAt'];
$epoch = $document['_updatedAt'];
$document['$updatedAt'] = DateTime::format(new \DateTime("@$epoch"));
unset($document['_updatedAt']);
}
if (\array_key_exists('_permissions', $document)) {
Expand Down