Last active
November 14, 2022 14:33
-
-
Save manojahi/a659459304bc085b052d07804a00e04e 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
@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