Browse Source

PersonText Repository and Domain

Andrew Grant 1 month ago
parent
commit
a484f0853e

+ 41 - 0
src/main/java/scot/carricksoftware/grantswriter/domains/text/PersonText.java

@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 30/03/2025, 10:20. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grantswriter.domains.text;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.Lob;
+import jakarta.persistence.ManyToOne;
+import scot.carricksoftware.grantswriter.BaseEntity;
+import scot.carricksoftware.grantswriter.domains.people.Person;
+
+@Entity
+public class PersonText extends BaseEntity {
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @ManyToOne
+    @JoinColumn(name = "`person_id`")
+    private Person person;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @Column(name = "`level`")
+    private Long level;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @Column(name = "`order`")
+    private Long order;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @Column(name = "`heading`")
+    private String heading;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @Column(name = "`content`")
+    @Lob
+    private String content;
+
+}

+ 18 - 0
src/main/java/scot/carricksoftware/grantswriter/repositories/text/PersonTextRepository.java

@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 11/03/2025, 19:47. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grantswriter.repositories.text;
+
+import org.springframework.stereotype.Repository;
+import scot.carricksoftware.grantswriter.domains.people.Person;
+import scot.carricksoftware.grantswriter.domains.text.PersonText;
+import scot.carricksoftware.grantswriter.repositories.ReadOnlyRepository;
+
+@Repository
+public interface PersonTextRepository extends ReadOnlyRepository<PersonText, Long> {
+
+    Iterable<PersonText> findAllByPerson(Person person);
+
+}

+ 0 - 1
src/test/java/scot/carricksoftware/grantswriter/controllers/StatusControllerTest.java

@@ -28,7 +28,6 @@ class StatusControllerTest {
     @Mock
     private Model modelMock;
 
-
     @BeforeEach
     void setUp() {
         controller = new StatusControllerImpl(statusServiceMock);