Skip to content

Commit

Permalink
Merge pull request #33 from UdL-EPS-SoftArch/26-feature-add-owner-entity
Browse files Browse the repository at this point in the history
26 feature add owner entity
  • Loading branch information
jorgechp authored Oct 8, 2024
2 parents bcd4280 + 2c14278 commit 7a3a364
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/cat/udl/eps/softarch/demo/domain/Owner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cat.udl.eps.softarch.demo.domain;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Entity
@Data
@EqualsAndHashCode(callSuper = true)
public class Owner extends User {

private String phoneNumber;
private String name;
private String address;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cat.udl.eps.softarch.demo.repository;

import cat.udl.eps.softarch.demo.domain.Apartment;
import cat.udl.eps.softarch.demo.domain.Owner;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Optional;

public interface OwnerRepository extends CrudRepository<Owner, Long>, PagingAndSortingRepository<Owner, Long> {
Optional<Owner> findById(@Param("id") String id);
List<Owner> findByName(@Param("name") String name);
// List<Owner> findByPhone(@Param("phoneNumber") String phoneNumber);
// List<Apartment> findApartmentsByUserId(@Param("id") String id);
}

0 comments on commit 7a3a364

Please sign in to comment.