JPT User object
User is a table that record all user profile information, like user ID, password referee etc., More importantly, upload and download bytes also recorded in this table.
I use bigint in database to store
date for all
time related fields.
For upload and download bytes, I use bigint in postgresql.
Note that the
UserLevel level field is annotated as
@Transient, since server will calculate the score of user when requested, hence user level is dynamic. Thisconsistantified database representation and relation.
Class below is just a simplified version of this class, for details, please refer to github.
password is a sensitive field, currently this field could be serialized by GSON when creating response. But it is really easy to stop from doing that by removing
@Expose annotation from this field.
As you can see, JSON that serialized by GSON will have content like above.
Sometimes there is no
level field as it is not mandetory. But from my design, torrent poster could specify the minimum required level of a torrent, which could narrowing the target user to serve.