mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-22 08:08:01 +00:00
Convert dataset comments datetime to epoch, fix PUT comments (#743)
This commit is contained in:
parent
5127b90ded
commit
4c39b546f9
@ -21,8 +21,8 @@ public class DatasetComment {
|
||||
public String authorName;
|
||||
public String authorUserName;
|
||||
public String authorEmail;
|
||||
public String created;
|
||||
public String modified;
|
||||
public long created;
|
||||
public long modified;
|
||||
public String type;
|
||||
public Boolean isAuthor;
|
||||
}
|
@ -451,6 +451,10 @@ public class Dataset extends Controller {
|
||||
Map<String, String[]> params = request().body().asFormUrlEncoded();
|
||||
|
||||
if (StringUtils.isNotBlank(username)) {
|
||||
if (!params.containsKey("id")) {
|
||||
params.put("id", new String[]{String.valueOf(commentId)});
|
||||
}
|
||||
|
||||
if (DatasetsDAO.postComment(id, params, username)) {
|
||||
result.put("status", "success");
|
||||
return ok(result);
|
||||
|
@ -13,6 +13,7 @@
|
||||
*/
|
||||
package dao;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import wherehows.models.table.DatasetComment;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
@ -39,8 +40,8 @@ public class DatasetCommentRowMapper implements RowMapper<DatasetComment>
|
||||
int id = rs.getInt(ID_COLUMN);
|
||||
int datasetId = rs.getInt(DATASET_ID_COLUMN);
|
||||
String text = rs.getString(TEXT_COLUMN);
|
||||
String created = rs.getString(CREATED_TIME_COLUMN);
|
||||
String modified = rs.getString(MODIFIED_TIME_COLUMN);
|
||||
Timestamp created = rs.getTimestamp(CREATED_TIME_COLUMN);
|
||||
Timestamp modified = rs.getTimestamp(MODIFIED_TIME_COLUMN);
|
||||
String type = rs.getString(COMMENT_TYPE_COLUMN);
|
||||
if (StringUtils.isBlank(type))
|
||||
{
|
||||
@ -53,8 +54,8 @@ public class DatasetCommentRowMapper implements RowMapper<DatasetComment>
|
||||
datasetComment.id = id;
|
||||
datasetComment.datasetId = datasetId;
|
||||
datasetComment.text = text;
|
||||
datasetComment.created = created;
|
||||
datasetComment.modified = modified;
|
||||
datasetComment.created = created.getTime();
|
||||
datasetComment.modified = modified.getTime();
|
||||
datasetComment.type = type;
|
||||
datasetComment.authorName = authorName;
|
||||
datasetComment.authorEmail = authorEmail;
|
||||
|
@ -221,6 +221,9 @@ public class DatasetsDAO extends AbstractMySQLOpenSourceDAO
|
||||
private final static String CREATE_DATASET_COMMENT = "INSERT INTO comments " +
|
||||
"(text, user_id, dataset_id, created, modified, comment_type) VALUES(?, ?, ?, NOW(), NOW(), ?)";
|
||||
|
||||
private final static String UPDATE_DATASET_COMMENT = "UPDATE comments " +
|
||||
"SET text = ?, comment_type = ?, modified = NOW() WHERE id = ?";
|
||||
|
||||
private final static String GET_WATCHED_URN_ID = "SELECT id FROM watch " +
|
||||
"WHERE user_id = ? and item_type = 'urn' and urn = ?";
|
||||
|
||||
@ -245,9 +248,6 @@ public class DatasetsDAO extends AbstractMySQLOpenSourceDAO
|
||||
private final static String CREATE_COLUMN_COMMENT = "INSERT INTO field_comments " +
|
||||
"(comment, user_id, created, modified, comment_crc32_checksum) VALUES(?, ?, NOW(), NOW(), CRC32(?))";
|
||||
|
||||
private final static String UPDATE_DATASET_COMMENT = "UPDATE comments " +
|
||||
"SET text = ?, comment_type = ?, modified = NOW() WHERE id = ?";
|
||||
|
||||
private final static String UPDATE_COLUMN_COMMENT = "UPDATE field_comments " +
|
||||
"SET comment = ?, modified = NOW() WHERE id = ?";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user