Skip to content

Instantly share code, notes, and snippets.

@manojahi
Last active November 14, 2022 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manojahi/a659459304bc085b052d07804a00e04e to your computer and use it in GitHub Desktop.
Save manojahi/a659459304bc085b052d07804a00e04e to your computer and use it in GitHub Desktop.
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@DynamoDBTable(tableName = "")
@DynamodbTableEnv("dynamodb.token") //it will search for this property in application.yml
public class Token extends DynamoModel {
@Id
@DynamoDBIgnore
private TokenTableId tokenTableId;
private String userIdToken;
private String userAgent;
@DynamoDBAttribute(attributeName = "userId")
private UUID userId;
@DynamoDBAttribute(attributeName = "token")
private String token;
@DynamoDBAttribute(attributeName = "ttl")
private long ttl;
@DynamoDBAttribute(attributeName = "expiryTime")
@DynamoDBTypeConverted(converter = InstantTimeConverter.class)
@JsonDeserialize(using = InstantJsonDeSerializer.class)
@JsonSerialize(using = InstantJsonSerializer.class)
private Instant expiryTime;
@DynamoDBHashKey(attributeName = "userIdToken")
public String getUserIdToken() {
return userIdToken;
}
@DynamoDBRangeKey(attributeName = "userAgent")
@DynamoDBIndexRangeKey(globalSecondaryIndexName = "GSI-user-id-agent")
public String getUserAgent() {
return userAgent;
}
@DynamoDBIndexHashKey(globalSecondaryIndexName = "GSI-user-id-agent")
public UUID getUserId() {
return userId;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment