Added commisions endponts
This commit is contained in:
@ -29,6 +29,9 @@ public class Commision {
|
||||
this.commisionOwner = user;
|
||||
}
|
||||
|
||||
public Commision() {
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
@ -68,4 +68,8 @@ public class User {
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
@ -1,11 +1,17 @@
|
||||
package com.plannaplan.repositories;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.plannaplan.entities.Commision;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CommisionRepository extends JpaRepository<Commision, Long> {
|
||||
@Query("FROM Commision WHERE owner_id = ?1")
|
||||
List<Commision> getUsers(@Param("owner_id") Long id);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.plannaplan.services;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.plannaplan.entities.Commision;
|
||||
import com.plannaplan.entities.User;
|
||||
import com.plannaplan.repositories.CommisionRepository;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -19,4 +22,9 @@ public class CommisionService {
|
||||
return commision;
|
||||
|
||||
}
|
||||
|
||||
public List<Commision> getUsersCommisions(User user) {
|
||||
Long id = user.getId();
|
||||
return this.repo.getUsers(id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user