Skip to content

Commit

Permalink
refactor: fix duplicate imports
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Sep 26, 2024
1 parent 5dc6bf4 commit 74e7f6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/stores/dynamodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
* file that was distributed with this source code.
*/

import string from '@poppinss/utils/string'
import { MessageBuilder } from '@adonisjs/core/helpers'
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb'
import {
DynamoDBClient,
GetItemCommand,
PutItemCommand,
DeleteItemCommand,
UpdateItemCommand,
} from '@aws-sdk/client-dynamodb'
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb'
import string from '@poppinss/utils/string'
import { MessageBuilder } from '@adonisjs/core/helpers'

import debug from '../debug.js'
import type { SessionStoreContract, SessionData } from '../types.js'
Expand Down Expand Up @@ -68,12 +68,12 @@ export class DynamoDBStore implements SessionStoreContract {

const item = unmarshall(response.Item)
const contents = item[this.#valueAttribute] as string
const expiration = item[this.#expiresAtAttribute] as number
const expiresAt = item[this.#expiresAtAttribute] as number

/**
* Check if the item has been expired and return null (if expired)
*/
if (Date.now() > expiration) {
if (Date.now() > expiresAt) {
return null
}

Expand Down
4 changes: 2 additions & 2 deletions tests/stores/dynamodb_store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

import { test } from '@japa/runner'
import { setTimeout } from 'node:timers/promises'
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb'
import {
DynamoDBClient,
PutItemCommand,
DeleteItemCommand,
GetItemCommand,
DeleteItemCommand,
} from '@aws-sdk/client-dynamodb'
import { DynamoDBStore } from '../../src/stores/dynamodb.js'
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb'

const sessionId = '1234'
const tableName = 'Session'
Expand Down

0 comments on commit 74e7f6d

Please sign in to comment.