From cdd706ce31a4bc6720c546c1f5e671244094129e Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Sun, 23 Aug 2026 12:58:02 +0200 Subject: [PATCH 1/3] feat(entity): add project entity relationship --- .../vulpes/api/model/AttributeEntity.java | 47 ++++++++++++++++--- .../vulpes/api/model/FontEntity.java | 39 ++++++++++++++- .../vulpes/api/model/ItemEntity.java | 39 ++++++++++++++- .../vulpes/api/model/NotificationEntity.java | 37 ++++++++++++++- .../api/model/sound/SoundEventEntity.java | 42 +++++++++++++++-- 5 files changed, 192 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/AttributeEntity.java b/src/main/java/net/onelitefeather/vulpes/api/model/AttributeEntity.java index efec234..4b4da40 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/AttributeEntity.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/AttributeEntity.java @@ -4,7 +4,14 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.Index; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; import net.onelitefeather.vulpes.api.generator.VulpesGenerator; +import net.onelitefeather.vulpes.api.model.project.ProjectEntity; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.UUID; @@ -18,6 +25,9 @@ *

*/ @Entity(name = "attributes") +@Table(name = "attributes", indexes = { + @Index(name = "idx_attributes_project_id", columnList = "project_id") +}) public class AttributeEntity implements VulpesModel { @Id @@ -28,6 +38,10 @@ public class AttributeEntity implements VulpesModel { private String variableName; private double defaultValue; private double maximumValue; + @ManyToOne + @JoinColumn(name = "project_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) + private ProjectEntity project; /** * Default constructor for JPA and Micronaut Data. @@ -42,18 +56,20 @@ public AttributeEntity() { /** * Constructs a new {@link AttributeEntity} with the specified values. * - * @param id the unique identifier of the attribute - * @param uiName the model name associated with the attribute - * @param variableName the name of the attribute - * @param defaultValue the default value of the attribute - * @param maximumValue the maximum value of the attribute + * @param id the unique identifier of the attribute + * @param uiName the model name associated with the attribute + * @param variableName the name of the attribute + * @param defaultValue the default value of the attribute + * @param maximumValue the maximum value of the attribute + * @param project the project this attribute belongs to */ - public AttributeEntity(UUID id, String uiName, String variableName, double defaultValue, double maximumValue) { + public AttributeEntity(UUID id, String uiName, String variableName, double defaultValue, double maximumValue, ProjectEntity project) { this.id = id; this.uiName = uiName; this.variableName = variableName; this.defaultValue = defaultValue; this.maximumValue = maximumValue; + this.project = project; } // Getters and setters for each field @@ -148,6 +164,24 @@ public void setMaximumValue(double maximumValue) { this.maximumValue = maximumValue; } + /** + * Returns the project this attribute belongs to. + * + * @return the project of the attribute + */ + public ProjectEntity getProject() { + return project; + } + + /** + * Sets the project this attribute belongs to. + * + * @param project the project to set + */ + public void setProject(ProjectEntity project) { + this.project = project; + } + /** * Provides a string representation of the AttributeModel * @@ -161,6 +195,7 @@ public String toString() { ", name='" + variableName + '\'' + ", defaultValue=" + defaultValue + ", maximumValue=" + maximumValue + + ", project=" + project + '}'; } } diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java b/src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java index 8bb0839..b51aa30 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java @@ -5,9 +5,16 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.Index; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; import net.onelitefeather.vulpes.api.generator.VulpesGenerator; import net.onelitefeather.vulpes.api.model.font.FontStringEntity; +import net.onelitefeather.vulpes.api.model.project.ProjectEntity; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.List; import java.util.UUID; @@ -22,6 +29,9 @@ *

*/ @Entity(name = "fonts") +@Table(name = "fonts", indexes = { + @Index(name = "idx_fonts_project_id", columnList = "project_id") +}) public class FontEntity implements VulpesModel { @Id @@ -39,6 +49,11 @@ public class FontEntity implements VulpesModel { @OneToMany(mappedBy = "font", cascade = CascadeType.ALL) private List chars; + @ManyToOne + @JoinColumn(name = "project_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) + private ProjectEntity project; + /** * Default constructor for JPA and Micronaut Data. *

@@ -61,6 +76,7 @@ public FontEntity() { * @param height the height of the font * @param ascent the ascent of the font * @param chars the list of characters included in the font + * @param project the project this font belongs to */ public FontEntity( UUID id, @@ -71,7 +87,8 @@ public FontEntity( String comment, int height, int ascent, - List chars + List chars, + ProjectEntity project ) { this.id = id; this.uiName = uiName; @@ -82,6 +99,7 @@ public FontEntity( this.height = height; this.ascent = ascent; this.chars = chars; + this.project = project; } // Getters and setters for each field @@ -206,6 +224,24 @@ public void setChars(List chars) { this.chars = chars; } + /** + * Returns the project this font belongs to. + * + * @return the project of the font + */ + public ProjectEntity getProject() { + return project; + } + + /** + * Sets the project this font belongs to. + * + * @param project the project to set + */ + public void setProject(ProjectEntity project) { + this.project = project; + } + @Override public String toString() { return "FontEntity{" + @@ -219,6 +255,7 @@ public String toString() { ", height=" + height + ", ascent=" + ascent + ", chars=" + chars + + ", project=" + project + '}'; } } diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/ItemEntity.java b/src/main/java/net/onelitefeather/vulpes/api/model/ItemEntity.java index 1db40f8..a40efa5 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/ItemEntity.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/ItemEntity.java @@ -5,11 +5,18 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.Index; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; import net.onelitefeather.vulpes.api.generator.VulpesGenerator; import net.onelitefeather.vulpes.api.model.item.ItemEnchantmentEntity; import net.onelitefeather.vulpes.api.model.item.ItemFlagEntity; import net.onelitefeather.vulpes.api.model.item.ItemLoreEntity; +import net.onelitefeather.vulpes.api.model.project.ProjectEntity; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.List; import java.util.UUID; @@ -24,6 +31,9 @@ *

*/ @Entity(name = "items") +@Table(name = "items", indexes = { + @Index(name = "idx_items_project_id", columnList = "project_id") +}) public class ItemEntity implements VulpesModel { @Id @@ -46,6 +56,11 @@ public class ItemEntity implements VulpesModel { @OneToMany(mappedBy = "item", cascade = CascadeType.ALL) private List flags; + @ManyToOne + @JoinColumn(name = "project_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) + private ProjectEntity project; + /** * Default constructor for JPA and Micronaut Data. *

@@ -71,6 +86,7 @@ public ItemEntity() { * @param enchantments the enchantments applied to the item * @param lore the lore associated with the item * @param flags the flags associated with the item + * @param project the project this item belongs to */ public ItemEntity( UUID id, @@ -84,7 +100,8 @@ public ItemEntity( int amount, List enchantments, List lore, - List flags + List flags, + ProjectEntity project ) { this.id = id; this.uiName = uiName; @@ -98,6 +115,7 @@ public ItemEntity( this.enchantments = enchantments; this.lore = lore; this.flags = flags; + this.project = project; } // Getters and setters for each field @@ -318,6 +336,24 @@ public void setFlags(List flags) { this.flags = flags; } + /** + * Returns the project this item belongs to. + * + * @return the project of the item + */ + public ProjectEntity getProject() { + return project; + } + + /** + * Sets the project this item belongs to. + * + * @param project the project to set + */ + public void setProject(ProjectEntity project) { + this.project = project; + } + /** * Provides a string representation of the ItemModel. * @@ -338,6 +374,7 @@ public String toString() { ", enchantments=" + enchantments + ", lore=" + lore + ", flags=" + flags + + ", project=" + project + '}'; } } diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/NotificationEntity.java b/src/main/java/net/onelitefeather/vulpes/api/model/NotificationEntity.java index c8e9b7f..1fae6da 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/NotificationEntity.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/NotificationEntity.java @@ -4,7 +4,14 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.Index; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; import net.onelitefeather.vulpes.api.generator.VulpesGenerator; +import net.onelitefeather.vulpes.api.model.project.ProjectEntity; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.UUID; @@ -18,6 +25,9 @@ *

*/ @Entity(name = "notifications") +@Table(name = "notifications", indexes = { + @Index(name = "idx_notifications_project_id", columnList = "project_id") +}) public class NotificationEntity implements VulpesModel { @Id @@ -30,6 +40,10 @@ public class NotificationEntity implements VulpesModel { private String material; private String frameType; private String title; + @ManyToOne + @JoinColumn(name = "project_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) + private ProjectEntity project; /** * Default constructor for JPA and Micronaut Data. @@ -51,8 +65,9 @@ public NotificationEntity() { * @param material the material type associated with the notification * @param frameType the frame type associated with the notification * @param title the title of the notification + * @param project the project this notification belongs to */ - public NotificationEntity(UUID id, String uiName, String variableName, String comment, String material, String frameType, String title) { + public NotificationEntity(UUID id, String uiName, String variableName, String comment, String material, String frameType, String title, ProjectEntity project) { this.id = id; this.uiName = uiName; this.variableName = variableName; @@ -60,6 +75,7 @@ public NotificationEntity(UUID id, String uiName, String variableName, String co this.material = material; this.frameType = frameType; this.title = title; + this.project = project; } /** @@ -188,6 +204,24 @@ public void setTitle(String title) { this.title = title; } + /** + * Returns the project this notification belongs to. + * + * @return the project of the notification + */ + public ProjectEntity getProject() { + return project; + } + + /** + * Sets the project this notification belongs to. + * + * @param project the project to set + */ + public void setProject(ProjectEntity project) { + this.project = project; + } + /** * Provides a string representation of the NotificationModel * @@ -203,6 +237,7 @@ public String toString() { ", material='" + material + '\'' + ", frameType='" + frameType + '\'' + ", title='" + title + '\'' + + ", project=" + project + '}'; } } diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/sound/SoundEventEntity.java b/src/main/java/net/onelitefeather/vulpes/api/model/sound/SoundEventEntity.java index f21d806..db62020 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/sound/SoundEventEntity.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/sound/SoundEventEntity.java @@ -5,10 +5,17 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.Index; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; import net.onelitefeather.vulpes.api.generator.VulpesGenerator; import net.onelitefeather.vulpes.api.model.VulpesModel; +import net.onelitefeather.vulpes.api.model.project.ProjectEntity; import org.hibernate.annotations.ColumnDefault; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.List; import java.util.Objects; @@ -25,6 +32,9 @@ * @since 0.1.0 */ @Entity(name = "sounds") +@Table(name = "sounds", indexes = { + @Index(name = "idx_sounds_project_id", columnList = "project_id") +}) public class SoundEventEntity implements VulpesModel { @Id @@ -47,6 +57,11 @@ public class SoundEventEntity implements VulpesModel { @OneToMany(mappedBy = "soundEvent") private List dataEntities; + @ManyToOne + @JoinColumn(name = "project_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) + private ProjectEntity project; + /** * Default constructor for JPA and Micronaut Data. *

@@ -67,8 +82,9 @@ public SoundEventEntity() { * @param replace whether to replace an existing sound model * @param subTitle the subtitle for the sound model * @param dataEntities the list of sound data entities related to this sound model + * @param project the project this sound event belongs to */ - public SoundEventEntity(UUID id, String uiName, String variableName, String keyName, boolean replace, String subTitle, List dataEntities) { + public SoundEventEntity(UUID id, String uiName, String variableName, String keyName, boolean replace, String subTitle, List dataEntities, ProjectEntity project) { this.id = id; this.uiName = uiName; this.keyName = keyName; @@ -76,6 +92,7 @@ public SoundEventEntity(UUID id, String uiName, String variableName, String keyN this.replace = replace; this.subTitle = subTitle; this.dataEntities = dataEntities; + this.project = project; } /** @@ -187,16 +204,34 @@ public void setSoundData(List soundDatumEntities) { this.dataEntities = soundDatumEntities; } + /** + * Returns the project this sound event belongs to. + * + * @return the project of the sound event + */ + public ProjectEntity getProject() { + return project; + } + + /** + * Sets the project this sound event belongs to. + * + * @param project the project to set + */ + public void setProject(ProjectEntity project) { + this.project = project; + } + @Override public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; SoundEventEntity that = (SoundEventEntity) o; - return replace == that.replace && Objects.equals(id, that.id) && Objects.equals(uiName, that.uiName) && Objects.equals(variableName, that.variableName) && Objects.equals(keyName, that.keyName) && Objects.equals(subTitle, that.subTitle) && Objects.equals(dataEntities, that.dataEntities); + return replace == that.replace && Objects.equals(id, that.id) && Objects.equals(uiName, that.uiName) && Objects.equals(variableName, that.variableName) && Objects.equals(keyName, that.keyName) && Objects.equals(subTitle, that.subTitle) && Objects.equals(dataEntities, that.dataEntities) && Objects.equals(project, that.project); } @Override public int hashCode() { - return Objects.hash(id, uiName, variableName, keyName, replace, subTitle, dataEntities); + return Objects.hash(id, uiName, variableName, keyName, replace, subTitle, dataEntities, project); } @Override @@ -209,6 +244,7 @@ public String toString() { ", replace=" + replace + ", subTitle='" + subTitle + '\'' + ", dataEntities=" + dataEntities + + ", project=" + project + '}'; } } From b3d850f022543a1a0efc861098faefa0161a1ccb Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Sun, 23 Aug 2026 12:58:16 +0200 Subject: [PATCH 2/3] feat(entity): add one delete action --- .../onelitefeather/vulpes/api/model/font/FontStringEntity.java | 3 +++ .../vulpes/api/model/item/ItemEnchantmentEntity.java | 3 +++ .../onelitefeather/vulpes/api/model/item/ItemFlagEntity.java | 3 +++ .../onelitefeather/vulpes/api/model/item/ItemLoreEntity.java | 3 +++ .../onelitefeather/vulpes/api/model/sound/SoundFileSource.java | 3 +++ 5 files changed, 15 insertions(+) diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/font/FontStringEntity.java b/src/main/java/net/onelitefeather/vulpes/api/model/font/FontStringEntity.java index 235c13e..ecf9ce5 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/font/FontStringEntity.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/font/FontStringEntity.java @@ -8,6 +8,8 @@ import jakarta.persistence.ManyToOne; import net.onelitefeather.vulpes.api.generator.VulpesGenerator; import net.onelitefeather.vulpes.api.model.FontEntity; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.Objects; import java.util.UUID; @@ -21,6 +23,7 @@ public final class FontStringEntity implements Comparable { private String line; @ManyToOne @JoinColumn(name = "font_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) private FontEntity font; private int orderIndex; diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemEnchantmentEntity.java b/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemEnchantmentEntity.java index a252ec0..821bfae 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemEnchantmentEntity.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemEnchantmentEntity.java @@ -8,6 +8,8 @@ import jakarta.persistence.ManyToOne; import net.onelitefeather.vulpes.api.generator.VulpesGenerator; import net.onelitefeather.vulpes.api.model.ItemEntity; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.Objects; import java.util.UUID; @@ -23,6 +25,7 @@ public final class ItemEnchantmentEntity { private boolean unsafe; @ManyToOne @JoinColumn(name = "item_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) private ItemEntity item; /** diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemFlagEntity.java b/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemFlagEntity.java index 1c0f507..27df451 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemFlagEntity.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemFlagEntity.java @@ -8,6 +8,8 @@ import jakarta.persistence.ManyToOne; import net.onelitefeather.vulpes.api.generator.VulpesGenerator; import net.onelitefeather.vulpes.api.model.ItemEntity; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.Objects; import java.util.UUID; @@ -28,6 +30,7 @@ public final class ItemFlagEntity { private String flag; @ManyToOne @JoinColumn(name = "item_id") + @OnDelete(action = OnDeleteAction.CASCADE) private ItemEntity item; /** diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemLoreEntity.java b/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemLoreEntity.java index b99351b..e658300 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemLoreEntity.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/item/ItemLoreEntity.java @@ -8,6 +8,8 @@ import jakarta.persistence.ManyToOne; import net.onelitefeather.vulpes.api.generator.VulpesGenerator; import net.onelitefeather.vulpes.api.model.ItemEntity; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.Objects; import java.util.UUID; @@ -28,6 +30,7 @@ public final class ItemLoreEntity implements Comparable { private String text; @ManyToOne @JoinColumn(name = "item_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) private ItemEntity item; private int orderIndex; diff --git a/src/main/java/net/onelitefeather/vulpes/api/model/sound/SoundFileSource.java b/src/main/java/net/onelitefeather/vulpes/api/model/sound/SoundFileSource.java index a31e8b8..2f4e3cd 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/model/sound/SoundFileSource.java +++ b/src/main/java/net/onelitefeather/vulpes/api/model/sound/SoundFileSource.java @@ -9,6 +9,8 @@ import net.onelitefeather.vulpes.api.generator.VulpesGenerator; import net.onelitefeather.vulpes.api.model.VulpesModel; import org.hibernate.annotations.ColumnDefault; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.Objects; import java.util.UUID; @@ -45,6 +47,7 @@ public class SoundFileSource implements VulpesModel { @ManyToOne @JoinColumn(name = "sound_event_id") + @OnDelete(action = OnDeleteAction.CASCADE) private SoundEventEntity soundEvent; /** From 8fc852ec94d19ffa89c195d346013526ad8466a1 Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Sun, 23 Aug 2026 12:58:42 +0200 Subject: [PATCH 3/3] feat(repository): add findByProjectId method --- .../vulpes/api/repository/AttributeRepository.java | 11 +++++++++++ .../vulpes/api/repository/FontRepository.java | 11 +++++++++++ .../vulpes/api/repository/ItemRepository.java | 10 ++++++++++ .../vulpes/api/repository/NotificationRepository.java | 11 +++++++++++ .../vulpes/api/repository/SoundRepository.java | 11 +++++++++++ 5 files changed, 54 insertions(+) diff --git a/src/main/java/net/onelitefeather/vulpes/api/repository/AttributeRepository.java b/src/main/java/net/onelitefeather/vulpes/api/repository/AttributeRepository.java index c8b2c86..54600ff 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/repository/AttributeRepository.java +++ b/src/main/java/net/onelitefeather/vulpes/api/repository/AttributeRepository.java @@ -1,6 +1,8 @@ package net.onelitefeather.vulpes.api.repository; import io.micronaut.data.annotation.Repository; +import io.micronaut.data.model.Page; +import io.micronaut.data.model.Pageable; import io.micronaut.data.repository.PageableRepository; import net.onelitefeather.vulpes.api.model.AttributeEntity; @@ -15,4 +17,13 @@ */ @Repository public interface AttributeRepository extends PageableRepository { + + /** + * Retrieves all attributes that belong to a specific project. + * + * @param projectId the unique identifier of the project + * @param pageable the pagination information + * @return a page of AttributeEntity objects belonging to the project + */ + Page findByProjectId(UUID projectId, Pageable pageable); } diff --git a/src/main/java/net/onelitefeather/vulpes/api/repository/FontRepository.java b/src/main/java/net/onelitefeather/vulpes/api/repository/FontRepository.java index 41988a1..3d52e68 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/repository/FontRepository.java +++ b/src/main/java/net/onelitefeather/vulpes/api/repository/FontRepository.java @@ -2,6 +2,8 @@ import io.micronaut.data.annotation.Query; import io.micronaut.data.annotation.Repository; +import io.micronaut.data.model.Page; +import io.micronaut.data.model.Pageable; import io.micronaut.data.repository.PageableRepository; import net.onelitefeather.vulpes.api.model.FontEntity; @@ -25,4 +27,13 @@ public interface FontRepository extends PageableRepository { */ @Query("select f from fonts f JOIN FETCH f.chars") List findAll(); + + /** + * Retrieves all fonts that belong to a specific project. + * + * @param projectId the unique identifier of the project + * @param pageable the pagination information + * @return a page of FontEntity objects belonging to the project + */ + Page findByProjectId(UUID projectId, Pageable pageable); } diff --git a/src/main/java/net/onelitefeather/vulpes/api/repository/ItemRepository.java b/src/main/java/net/onelitefeather/vulpes/api/repository/ItemRepository.java index 84e2402..2fdf231 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/repository/ItemRepository.java +++ b/src/main/java/net/onelitefeather/vulpes/api/repository/ItemRepository.java @@ -2,6 +2,7 @@ import io.micronaut.data.annotation.Query; import io.micronaut.data.annotation.Repository; +import io.micronaut.data.model.Page; import io.micronaut.data.model.Pageable; import io.micronaut.data.repository.PageableRepository; import net.onelitefeather.vulpes.api.model.ItemEntity; @@ -29,4 +30,13 @@ public interface ItemRepository extends PageableRepository { countQuery = "SELECT count(i) FROM items i" ) List findAllWithFetches(Pageable pageable); + + /** + * Retrieves all items that belong to a specific project. + * + * @param projectId the unique identifier of the project + * @param pageable the pagination information + * @return a page of ItemEntity objects belonging to the project + */ + Page findByProjectId(UUID projectId, Pageable pageable); } diff --git a/src/main/java/net/onelitefeather/vulpes/api/repository/NotificationRepository.java b/src/main/java/net/onelitefeather/vulpes/api/repository/NotificationRepository.java index f381f99..104c2d9 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/repository/NotificationRepository.java +++ b/src/main/java/net/onelitefeather/vulpes/api/repository/NotificationRepository.java @@ -1,6 +1,8 @@ package net.onelitefeather.vulpes.api.repository; import io.micronaut.data.annotation.Repository; +import io.micronaut.data.model.Page; +import io.micronaut.data.model.Pageable; import io.micronaut.data.repository.PageableRepository; import net.onelitefeather.vulpes.api.model.NotificationEntity; @@ -15,4 +17,13 @@ */ @Repository public interface NotificationRepository extends PageableRepository { + + /** + * Retrieves all notifications that belong to a specific project. + * + * @param projectId the unique identifier of the project + * @param pageable the pagination information + * @return a page of NotificationEntity objects belonging to the project + */ + Page findByProjectId(UUID projectId, Pageable pageable); } diff --git a/src/main/java/net/onelitefeather/vulpes/api/repository/SoundRepository.java b/src/main/java/net/onelitefeather/vulpes/api/repository/SoundRepository.java index f738976..5a8d85b 100644 --- a/src/main/java/net/onelitefeather/vulpes/api/repository/SoundRepository.java +++ b/src/main/java/net/onelitefeather/vulpes/api/repository/SoundRepository.java @@ -1,6 +1,8 @@ package net.onelitefeather.vulpes.api.repository; import io.micronaut.data.annotation.Repository; +import io.micronaut.data.model.Page; +import io.micronaut.data.model.Pageable; import io.micronaut.data.repository.PageableRepository; import net.onelitefeather.vulpes.api.model.sound.SoundEventEntity; @@ -16,4 +18,13 @@ */ @Repository public interface SoundRepository extends PageableRepository { + + /** + * Retrieves all sound events that belong to a specific project. + * + * @param projectId the unique identifier of the project + * @param pageable the pagination information + * @return a page of SoundEventEntity objects belonging to the project + */ + Page findByProjectId(UUID projectId, Pageable pageable); }