Skip to content

Commit 5821b45

Browse files
committed
Merge branch 'beta' of https://github.com/OneLiteFeatherNET/vulpes-model into beta
2 parents 72c93f8 + e7d311e commit 5821b45

3 files changed

Lines changed: 25 additions & 11 deletions

File tree

src/main/java/net/onelitefeather/vulpes/api/model/sound/SoundEventEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class SoundEventEntity implements VulpesModel {
4444
* Represents the list of sound data related to this sound model.
4545
* This is a one-to-many relationship where each sound model can have multiple sound data entities.
4646
*/
47-
@OneToMany(mappedBy = "id")
47+
@OneToMany(mappedBy = "soundEvent")
4848
private List<SoundFileSource> dataEntities;
4949

5050
/**

src/main/java/net/onelitefeather/vulpes/api/repository/FontRepository.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.micronaut.data.annotation.Query;
44
import io.micronaut.data.annotation.Repository;
5+
import io.micronaut.data.model.Pageable;
56
import io.micronaut.data.repository.PageableRepository;
67
import net.onelitefeather.vulpes.api.model.FontEntity;
78

@@ -24,8 +25,11 @@ public interface FontRepository extends PageableRepository<FontEntity, UUID> {
2425
* @param id the unique identifier of the font
2526
* @return a list of characters associated with the font
2627
*/
27-
@Query("SELECT c FROM fonts f JOIN f.chars c WHERE f.id = :id")
28-
List<String> findCharsByFontId(UUID id);
28+
@Query(
29+
value = "SELECT c FROM fonts f JOIN f.chars c WHERE f.id = :id",
30+
countQuery = "SELECT COUNT(c) FROM fonts f JOIN f.chars c WHERE f.id = :id"
31+
)
32+
List<String> findCharsByFontId(UUID id, Pageable pageable);
2933

3034
/**
3135
* Retrieves all fonts along with their associated characters.

src/main/java/net/onelitefeather/vulpes/api/repository/ItemRepository.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.micronaut.data.annotation.Query;
44
import io.micronaut.data.annotation.Repository;
5+
import io.micronaut.data.model.Pageable;
56
import io.micronaut.data.repository.PageableRepository;
67
import net.onelitefeather.vulpes.api.model.ItemEntity;
78

@@ -25,33 +26,42 @@ public interface ItemRepository extends PageableRepository<ItemEntity, UUID> {
2526
* @param id the unique identifier of the item
2627
* @return a map of enchantment names and their levels associated with the item
2728
*/
28-
@Query("SELECT e FROM items i JOIN i.enchantments e WHERE i.id = :id")
29-
Map<String, Short> findEnchantmentsById(UUID id);
29+
@Query(value = "SELECT e FROM items i JOIN i.enchantments e WHERE i.id = :id",
30+
countQuery = "SELECT count(e) FROM items i JOIN i.enchantments e WHERE i.id = :id"
31+
)
32+
Map<String, Short> findEnchantmentsById(UUID id, Pageable pageable);
3033

3134
/**
3235
* Retrieves the lore associated with an item by its ID.
3336
*
3437
* @param id the unique identifier of the item
3538
* @return a list of lore strings associated with the item
3639
*/
37-
@Query("SELECT l FROM items i JOIN i.enchantments l WHERE i.id = :id")
38-
List<String> findLoreById(UUID id);
40+
@Query(value = "SELECT l FROM items i JOIN i.lore l WHERE i.id = :id",
41+
countQuery = "SELECT count(l) FROM items i JOIN i.lore l WHERE i.id = :id"
42+
)
43+
List<String> findLoreById(UUID id, Pageable pageable);
3944

4045
/**
4146
* Retrieves the flags associated with an item by its ID.
4247
*
4348
* @param id the unique identifier of the item
4449
* @return a list of flags associated with the item
4550
*/
46-
@Query("SELECT f FROM items i JOIN i.enchantments f WHERE i.id = :id")
47-
List<String> findFlagsById(UUID id);
51+
@Query(value = "SELECT f FROM items i JOIN i.flags f WHERE i.id = :id",
52+
countQuery = "SELECT count(f) FROM items i JOIN i.flags f WHERE i.id = :id"
53+
)
54+
List<String> findFlagsById(UUID id, Pageable pageable);
4855

4956

5057
/**
5158
* Retrieves all items along with their associated enchantments, lore, and flags.
5259
*
5360
* @return a list of all ItemEntity objects with their enchantments, lore, and flags
5461
*/
55-
@Query("SELECT i FROM items i LEFT JOIN FETCH i.enchantments LEFT JOIN FETCH i.lore LEFT JOIN FETCH i.flags")
56-
List<ItemEntity> findAllWithFetches();
62+
@Query(
63+
value = "SELECT i FROM items i LEFT JOIN FETCH i.enchantments LEFT JOIN FETCH i.lore LEFT JOIN FETCH i.flags",
64+
countQuery = "SELECT count(i) FROM items i"
65+
)
66+
List<ItemEntity> findAllWithFetches(Pageable pageable);
5767
}

0 commit comments

Comments
 (0)