-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from stevensblueprint/feat/service_at_location
Feat/ServiceAtLocation
- Loading branch information
Showing
3 changed files
with
113 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/sarapis/orservice/repository/ServiceAtLocationRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
package com.sarapis.orservice.repository; | ||
|
||
import com.sarapis.orservice.entity.Attribute; | ||
import com.sarapis.orservice.entity.Metadata; | ||
import com.sarapis.orservice.entity.core.ServiceAtLocation; | ||
import jakarta.transaction.Transactional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Modifying; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface ServiceAtLocationRepository extends JpaRepository<ServiceAtLocation, String> { | ||
@Query("SELECT new Attribute(id, linkId, linkType, linkEntity, value, taxonomyTerm, label) FROM Attribute WHERE linkId = ?1") | ||
List<Attribute> getAttributes(String id); | ||
|
||
@Query("SELECT new Metadata(id, resourceId, resourceType, lastActionDate, lastActionType, fieldName, previousValue, replacementValue, updatedBy) FROM Metadata WHERE resourceId = ?1") | ||
List<Metadata> getMetadata(String id); | ||
|
||
@Modifying | ||
@Transactional | ||
@Query("DELETE FROM Attribute WHERE linkId = ?1") | ||
void deleteAttributes(String id); | ||
|
||
@Modifying | ||
@Transactional | ||
@Query("DELETE FROM Metadata WHERE resourceId = ?1") | ||
void deleteMetadata(String id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters