mirror of
https://github.com/sismics/docs.git
synced 2025-12-13 17:56:20 +00:00
#41: DB: Storage quota and current usage, accessible from /user
This commit is contained in:
@@ -101,6 +101,8 @@ public class UserDao {
|
||||
|
||||
// Update the user
|
||||
userFromDb.setEmail(user.getEmail());
|
||||
userFromDb.setStorageQuota(user.getStorageQuota());
|
||||
userFromDb.setStorageCurrent(user.getStorageCurrent());
|
||||
|
||||
// Create audit log
|
||||
AuditLogUtil.create(userFromDb, AuditLogType.UPDATE);
|
||||
|
||||
@@ -54,6 +54,18 @@ public class User implements Loggable {
|
||||
@Column(name = "USE_EMAIL_C", nullable = false, length = 100)
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* Storage quota.
|
||||
*/
|
||||
@Column(name = "USE_STORAGEQUOTA_N", nullable = false)
|
||||
private Long storageQuota;
|
||||
|
||||
/**
|
||||
* Storage current usage.
|
||||
*/
|
||||
@Column(name = "USE_STORAGECURRENT_N", nullable = false)
|
||||
private Long storageCurrent;
|
||||
|
||||
/**
|
||||
* Creation date.
|
||||
*/
|
||||
@@ -66,149 +78,87 @@ public class User implements Loggable {
|
||||
@Column(name = "USE_DELETEDATE_D")
|
||||
private Date deleteDate;
|
||||
|
||||
/**
|
||||
* Getter of id.
|
||||
*
|
||||
* @return id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of id.
|
||||
*
|
||||
* @param id id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of roleId.
|
||||
*
|
||||
* @return roleId
|
||||
*/
|
||||
public String getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of roleId.
|
||||
*
|
||||
* @param roleId roleId
|
||||
*/
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of username.
|
||||
*
|
||||
* @return username
|
||||
*/
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of username.
|
||||
*
|
||||
* @param username username
|
||||
*/
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of password.
|
||||
*
|
||||
* @return password
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of password.
|
||||
*
|
||||
* @param password password
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of email.
|
||||
*
|
||||
* @return email
|
||||
*/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of email.
|
||||
*
|
||||
* @param email email
|
||||
*/
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of createDate.
|
||||
*
|
||||
* @return createDate
|
||||
*/
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of createDate.
|
||||
*
|
||||
* @param createDate createDate
|
||||
*/
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of deleteDate.
|
||||
*
|
||||
* @return deleteDate
|
||||
*/
|
||||
@Override
|
||||
public Date getDeleteDate() {
|
||||
return deleteDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of deleteDate.
|
||||
*
|
||||
* @param deleteDate deleteDate
|
||||
*/
|
||||
public void setDeleteDate(Date deleteDate) {
|
||||
this.deleteDate = deleteDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter de privateKey.
|
||||
* @return privateKey
|
||||
*/
|
||||
public String getPrivateKey() {
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter de privateKey.
|
||||
* @param privateKey privateKey
|
||||
*/
|
||||
public void setPrivateKey(String privateKey) {
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
public Long getStorageQuota() {
|
||||
return storageQuota;
|
||||
}
|
||||
|
||||
public void setStorageQuota(Long storageQuota) {
|
||||
this.storageQuota = storageQuota;
|
||||
}
|
||||
|
||||
public Long getStorageCurrent() {
|
||||
return storageCurrent;
|
||||
}
|
||||
|
||||
public void setStorageCurrent(Long storageCurrent) {
|
||||
this.storageCurrent = storageCurrent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this)
|
||||
|
||||
@@ -1 +1 @@
|
||||
db.version=3
|
||||
db.version=4
|
||||
@@ -0,0 +1,3 @@
|
||||
alter table T_USER add column USE_STORAGEQUOTA_N bigint not null default 10000000000;
|
||||
alter table T_USER add column USE_STORAGECURRENT_N bigint not null default 0;
|
||||
update T_CONFIG set CFG_VALUE_C = '4' where CFG_ID_C = 'DB_VERSION';
|
||||
@@ -20,6 +20,8 @@ public class TestJpa extends BaseTransactionalTest {
|
||||
user.setUsername("username");
|
||||
user.setEmail("toto@docs.com");
|
||||
user.setRoleId("admin");
|
||||
user.setStorageCurrent(0l);
|
||||
user.setStorageQuota(10l);
|
||||
user.setPrivateKey("AwesomePrivateKey");
|
||||
String id = userDao.create(user);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user