-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Model): add autoCreatedAt & updatedAt
- Loading branch information
Showing
7 changed files
with
169 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Model from "../../src"; | ||
import { HashKeyEntity } from "./hashkey"; | ||
import documentClient from './common'; | ||
|
||
interface TimeTrackedEntity { | ||
createdAt?: string; | ||
updatedAt?: string; | ||
} | ||
|
||
export default class TimeTrackedModel extends Model<HashKeyEntity & TimeTrackedEntity> { | ||
protected tableName = 'table_test_autoCreatedAt_autoUpdatedAt'; | ||
|
||
protected pk = 'hashkey'; | ||
|
||
protected documentClient = documentClient; | ||
|
||
protected autoCreatedAt = true; | ||
|
||
protected autoUpdatedAt = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { CreateTableCommandInput } from "@aws-sdk/client-dynamodb"; | ||
|
||
export default { | ||
AttributeDefinitions: [ | ||
{ | ||
AttributeName: 'hashkey', | ||
AttributeType: 'S', | ||
}, | ||
], | ||
KeySchema: [ | ||
{ | ||
AttributeName: 'hashkey', | ||
KeyType: 'HASH', | ||
}, | ||
], | ||
ProvisionedThroughput: { | ||
ReadCapacityUnits: 5, | ||
WriteCapacityUnits: 5, | ||
}, | ||
TableName: 'table_test_autoCreatedAt_autoUpdatedAt', | ||
} as CreateTableCommandInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters