Skip to content

Commit

Permalink
Use DateOnlySerializer when appropriate (#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmini authored Dec 30, 2024
1 parent de79457 commit 928ff2e
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

public class AbstractEpic<E extends AbstractEpic<E>> extends AbstractMinimalEpic<E> implements Serializable {
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -45,9 +46,16 @@ public String toString() {
private References references;
private Author author;
private List<String> labels;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date startDate;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date dueDate;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date endDate;

private Date createdAt;
private Date updatedAt;
private Date closedAt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@

import org.gitlab4j.models.utils.JacksonJson;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

public class Epic extends AbstractEpic<Epic> {
private static final long serialVersionUID = 1L;

private Boolean startDateIsFixed;
private Boolean dueDateIsFixed;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date dueDateFromInheritedSource;

private Boolean subscribed;

public Boolean getStartDateIsFixed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

public class ImpersonationToken implements Serializable {
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -52,6 +53,8 @@ public String toString() {
private Date createdAt;
private Date lastUsedAt;
private Boolean impersonation;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date expiresAt;

public Boolean getActive() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
import org.gitlab4j.models.Constants;
import org.gitlab4j.models.utils.JacksonJson;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

public class ProjectAccessToken implements Serializable {
private static final long serialVersionUID = 1L;

private Long userId;
private List<Constants.ProjectAccessTokenScope> scopes;
private String name;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date expiresAt;

private Long id;
private Boolean active;
private Date createdAt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@

import org.gitlab4j.models.utils.JacksonJson;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

public class RelatedEpic extends AbstractEpic<RelatedEpic> {
private static final long serialVersionUID = 1L;

private Boolean startDateIsFixed;
private Boolean dueDateIsFixed;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date dueDateFromInheritedSource;

private Long relatedEpicLinkId;
private LinkType linkType;
private Date linkCreatedAt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
"web_url": "http://gitlab.example.com/arnita"
},
"start_date": "2018-07-01T00:00:00Z",
"due_date": "2018-07-31T00:00:00Z",
"start_date": "2024-12-01",
"end_date": "2024-12-31",
"due_date": "2024-12-31",
"created_at": "2018-07-17T13:36:22.770Z",
"updated_at": "2018-07-18T12:22:05.239Z",
"closed_at": "2018-08-18T12:22:05.239Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
"web_url": "http://gitlab.example.com/arnita"
},
"start_date": "2018-07-01T00:00:00Z",
"start_date": "2018-07-01",
"start_date_is_fixed": false,
"due_date": "2018-07-31T00:00:00Z",
"due_date": "2018-07-31",
"due_date_is_fixed": false,
"due_date_from_inherited_source": "2018-07-31T00:00:00Z",
"due_date_from_inherited_source": "2018-07-31",
"created_at": "2018-07-17T13:36:22.770Z",
"updated_at": "2018-07-18T12:22:05.239Z",
"closed_at": "2018-08-18T12:22:05.239Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"user_id": 79,
"last_used_at": "2023-09-28T19:26:26.675Z",
"active": true,
"expires_at": "2024-06-18T00:00:00Z",
"expires_at": "2024-06-18",
"access_level": 40
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"last_used_at": "2018-03-17T17:19:28.697Z",
"id" : 3,
"impersonation" : true,
"expires_at" : "2017-04-14T00:00:00Z"
"expires_at" : "2017-04-14"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"read_repository"
],
"name" : "Project Access Token Name",
"expires_at" : "2021-01-31T00:00:00Z",
"expires_at" : "2021-01-31",
"id" : 10,
"active" : true,
"created_at" : "2021-01-20T22:11:48.151Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon",
"web_url": "http://gitlab.example.com/arnita"
},
"start_date": "2018-07-01T00:00:00Z",
"start_date": "2018-07-01",
"start_date_is_fixed": false,
"due_date": "2018-07-31T00:00:00Z",
"due_date": "2018-07-31",
"due_date_is_fixed": false,
"due_date_from_inherited_source": "2018-07-31T00:00:00Z",
"due_date_from_inherited_source": "2018-07-31",
"created_at": "2018-07-17T13:36:22.770Z",
"updated_at": "2018-07-18T12:22:05.239Z",
"closed_at": "2018-08-18T12:22:05.239Z",
Expand Down

0 comments on commit 928ff2e

Please sign in to comment.