Skip to content

Commit

Permalink
Merge pull request #34 from UdL-EPS-SoftArch/22-coordinate-entity-bac…
Browse files Browse the repository at this point in the history
…kend-improve

coordinates entity improve & custom functions
  • Loading branch information
rogargon authored Dec 7, 2023
2 parents e7624f7 + 18eeead commit c0c15c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
Expand All @@ -12,6 +13,8 @@
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.ZonedDateTime;

@EqualsAndHashCode(callSuper = true)
@Entity
@Data
Expand All @@ -30,4 +33,9 @@ public class Coordinate extends UriEntity<Long> {
@JsonIdentityReference(alwaysAsId = true)
private RouteVersion routeVersion;

@JsonProperty(access = JsonProperty.Access.READ_ONLY)
@GeneratedValue()
@NotNull
private ZonedDateTime creationDate = ZonedDateTime.now();

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cat.udl.eps.softarch.myroutes.repository;

import cat.udl.eps.softarch.myroutes.domain.Coordinate;
import cat.udl.eps.softarch.myroutes.domain.RouteVersion;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
Expand All @@ -10,5 +11,7 @@

@RepositoryRestResource
public interface CoordinateRepository extends CrudRepository<Coordinate, Long>, PagingAndSortingRepository<Coordinate, Long> {
// public boolean findCoordinateByRouteVersion(@Param("routeVersion") RouteVersion routeVersion);
List<Coordinate> findByRouteVersion(@Param("routeVersion") RouteVersion routeVersion);
List<Coordinate> findByCoordinate(@Param("coordinate") String coordinate);

}

0 comments on commit c0c15c1

Please sign in to comment.