Prechádzať zdrojové kódy

CensusEntry age and where born added to domain

Andrew Grant 5 mesiacov pred
rodič
commit
cc8d6e5a27

+ 19 - 11
docs/additions.txt

@@ -1,13 +1,21 @@
-1:Domain
-2:Service
-3:Repository
-5:List Controller
-5:List Screen
-6:Command
-7:Converter
-8:Edit Controller
-9:Edit Screen
-10:Conditioning
-11:Validator
+0:Switch to dev
+1: Domain
+2: Domain getter and setter
+3: Test getter and setter in Domain Test
+4: Command
+5: Command getter and setter in Command Enums Test
+6: Converter
+7: Converter Test
+8: Bootstrap (random string)
+9: Bootstrap Test (not null)
+10: Validator
+11: Validator Test
+13: Modify the form
+14: Switch to uat
+15: Generate changelog (ctrl-shift-A) as sql
+16: Add the new file to master.xml
+16: Run in terminal  mvn clean test liquibase:update
+
+
 
 

+ 21 - 0
src/main/java/scot/carricksoftware/grants/domains/census/CensusEntry.java

@@ -40,6 +40,11 @@ public class CensusEntry extends BaseEntity {
     @Enumerated(EnumType.STRING)
     private CensusEntryWorker worker;
 
+    private String age;
+
+    private String whereBorn;
+
+
     public Person getPerson() {
         return person;
     }
@@ -99,4 +104,20 @@ public class CensusEntry extends BaseEntity {
     public void setWorker(CensusEntryWorker worker) {
         this.worker = worker;
     }
+
+    public String getAge() {
+        return age;
+    }
+
+    public void setAge(String age) {
+        this.age = age;
+    }
+
+    public String getWhereBorn() {
+        return whereBorn;
+    }
+
+    public void setWhereBorn(String whereBorn) {
+        this.whereBorn = whereBorn;
+    }
 }

+ 1 - 1
src/main/resources/application.properties

@@ -2,7 +2,7 @@ spring.application.name=grants
 server.port=8086
 server.servlet.context-path=/grants
 spring.mvc.format.date=dd-MM-yyyy
-spring.profiles.active=dev
+spring.profiles.active=uat
 logging.level.scot.carricksoftware=debug
 
 

+ 11 - 0
src/main/resources/db/changelog/2025/04/16-01-changelog.sql

@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+-- liquibase formatted sql
+
+-- changeset apg:1744789012725-1
+ALTER TABLE census_entry
+    ADD worker       VARCHAR(255) NULL;
+

+ 1 - 0
src/main/resources/db/changelog/master.xml

@@ -6,5 +6,6 @@
     <include file="/db/changelog/2025/04/11-01-changelog.sql"/>
     <include file="/db/changelog/2025/04/13-01-changelog.sql"/>
     <include file="/db/changelog/2025/04/14-01-changelog.sql"/>
+    <include file="/db/changelog/2025/04/16-01-changelog.sql"/>
 
 </databaseChangeLog>

+ 24 - 0
src/test/java/scot/carricksoftware/grants/domains/census/CensusEntryTest.java

@@ -77,4 +77,28 @@ class CensusEntryTest {
         assertEquals(person, entry.getPerson());
     }
 
+    @Test
+    void getAgeTest() {
+        assertNull(entry.getAge());
+    }
+
+    @Test
+    void setAgeTest() {
+        String age = GetRandomString();
+        entry.setAge(age);
+        assertEquals(age, entry.getAge());
+    }
+
+    @Test
+    void getWhereBornTest() {
+        assertNull(entry.getWhereBorn());
+    }
+
+    @Test
+    void setWhereBornTest() {
+        String whereBorn = GetRandomString();
+        entry.setWhereBorn(whereBorn);
+        assertEquals(whereBorn, entry.getWhereBorn());
+    }
+
 }