I have a ResponseDto class which looks like as below:
public static class HealthGoalsHighlight {
@ApiModelProperty(value = "Total number of eligible users")
private Long totalEligibleUsers;
@ApiModelProperty(value = "Total number of registered users")
private Long totalRegisteredUsers;
@ApiModelProperty(value = "Total number of users with atleast one goal count")
private Long totalUsersWithGoal;
@ApiModelProperty(value = "Top goal name selected by user")
private String topGoal;
@ApiModelProperty(value = "Bottom goal name selected by user")
private String bottomGoal;
}
This DTO was made based upon below table structure:
health_goals
(
uid BIGSERIAL NOT NULL CONSTRAINT health_goals_pkey primary key,
employer_key bigint not null,
total_eligible_users bigint not null,
total_registered_users bigint not null,
total_users_with_goal bigint not null,
top_goal_name varchar(255),
bottom_goal_name varchar(255),
created_ts TIMESTAMP NOT NULL DEFAULT NOW(),
updated_ts TIMESTAMP NOT NULL DEFAULT NOW(),
created_by varchar(255),
updated_by varchar(255)
);
Now the table structure has been changed to as below:
health_goals
(
uid BIGSERIAL NOT NULL CONSTRAINT health_goals_pkey primary key,
employer_key bigint not null,
health_goals_metric_value json null,
created_ts TIMESTAMP NOT NULL DEFAULT NOW(),
updated_ts TIMESTAMP NOT NULL DEFAULT NOW(),
created_by varchar(255),
updated_by varchar(255)
);
Basically now all these columns like total_eligible_users, total_registered_users, total_users_with_goal, top_goal_name, bottom_goal_name wil be consolidated to single columnhealth_goals_metric_value as a JSON data type.
How can I write the response DTO for JSON data type column. Also what changes needs to be done in my AggMapper class.