Last active
March 26, 2021 03:58
-
-
Save shaykav/c0a3bf55d7f089c316d56af4f1022604 to your computer and use it in GitHub Desktop.
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
import { attribute, hashKey, rangeKey } from '@aws/dynamodb-data-mapper-annotations'; | |
import { APIGatewayEventRequestContext } from 'aws-lambda'; | |
@table('SUBSCRIPTION_TABLE') | |
export class Subscription { | |
/* | |
* Combination of connectionId and subscriptionId | |
* `${connectionId}|${subscriptionId}` | |
*/ | |
@hashKey({ type: 'String' }) | |
id: string; | |
@rangeKey({ | |
type: 'String', | |
indexKeyConfigurations: { TopicIndex: 'HASH' }, | |
}) | |
topic: string; | |
@attribute({ | |
type: 'String', | |
indexKeyConfigurations: { ConnectionIndex: 'HASH' }, | |
}) | |
connectionId: string; | |
@attribute({ defaultProvider: () => new Date() }) | |
createdAt: Date; | |
@attribute() | |
requestContext: APIGatewayEventRequestContext; | |
/* Reference to connection_init payload */ | |
@attribute() | |
connectionRef: object; | |
@attribute() | |
subscription: { | |
id: string; | |
query: string; | |
/** Actual value of variables for given field */ | |
variables?: any; | |
/** Value of variables for user provided subscription */ | |
variableValues?: any; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment