From ead08ae6a0543c809d239792dc61b92830b814f8 Mon Sep 17 00:00:00 2001 From: Aqua-sc <108478185+Aqua-sc@users.noreply.github.com> Date: Sat, 27 Apr 2024 08:41:46 +0200 Subject: [PATCH] Added year to `/courses` response --- .../com/ugent/pidgeon/model/json/CourseWithRelationJson.java | 2 +- .../java/com/ugent/pidgeon/postgre/models/CourseEntity.java | 2 +- .../java/com/ugent/pidgeon/util/EntityToJsonConverter.java | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/app/src/main/java/com/ugent/pidgeon/model/json/CourseWithRelationJson.java b/backend/app/src/main/java/com/ugent/pidgeon/model/json/CourseWithRelationJson.java index 4882e9e5..9f52dca6 100644 --- a/backend/app/src/main/java/com/ugent/pidgeon/model/json/CourseWithRelationJson.java +++ b/backend/app/src/main/java/com/ugent/pidgeon/model/json/CourseWithRelationJson.java @@ -4,5 +4,5 @@ import java.time.OffsetDateTime; public record CourseWithRelationJson (String url, CourseRelation relation, String name, Long courseId, - OffsetDateTime archivedAt, Integer memberCount, OffsetDateTime createdAt) { } + OffsetDateTime archivedAt, Integer memberCount, OffsetDateTime createdAt, Integer year) { } diff --git a/backend/app/src/main/java/com/ugent/pidgeon/postgre/models/CourseEntity.java b/backend/app/src/main/java/com/ugent/pidgeon/postgre/models/CourseEntity.java index 93a246e9..042f9d6d 100644 --- a/backend/app/src/main/java/com/ugent/pidgeon/postgre/models/CourseEntity.java +++ b/backend/app/src/main/java/com/ugent/pidgeon/postgre/models/CourseEntity.java @@ -19,7 +19,7 @@ public class CourseEntity { private String description; @Column(name = "course_year", nullable = true) - private int courseYear; + private Integer courseYear; @Column(name = "created_at") diff --git a/backend/app/src/main/java/com/ugent/pidgeon/util/EntityToJsonConverter.java b/backend/app/src/main/java/com/ugent/pidgeon/util/EntityToJsonConverter.java index 8111abd2..9056821a 100644 --- a/backend/app/src/main/java/com/ugent/pidgeon/util/EntityToJsonConverter.java +++ b/backend/app/src/main/java/com/ugent/pidgeon/util/EntityToJsonConverter.java @@ -110,7 +110,8 @@ public CourseWithRelationJson courseEntityToCourseWithRelation(CourseEntity cour course.getId(), course.getArchivedAt(), memberCount, - course.getCreatedAt() + course.getCreatedAt(), + course.getCourseYear() ); }