Change fields from final to mutable in form classes
Refactored `StaffAppFormData` and `ContactFormData` to allow updating fields by removing the `final` modifier. Added default constructors to both classes for easier instantiation and management. This change improves the flexibility and maintainability of the codebase.
This commit is contained in:
parent
1a5be5021b
commit
ed098513f5
|
|
@ -4,11 +4,8 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="ce59df2a-8d56-446a-867b-80e627daf479" name="Changes" comment="Ensure NOT NULL constraints in SQL tables Refactor SQL table creation scripts to add NOT NULL constraints where necessary. This change ensures data integrity by preventing null values in critical columns across the 'verify_form', 'form', 'rate_limit', and 'form_active' tables.">
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/controlers/form_active/BooleanResponse.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/controlers/form_active/FormActiveController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/controlers/form_active/FormActiveController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/controlers/form_active/FormActiveData.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/controlers/form_active/FormActiveData.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.properties" afterDir="false" />
|
||||
<list default="true" id="ce59df2a-8d56-446a-867b-80e627daf479" name="Changes" comment="Add JSON response handling for form activity check Refactor `FormActiveController` to return JSON responses using `BooleanResponse`. Introduce exception handling for JSON processing errors and update `FormActiveData` to allow object initialization without parameters.">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -123,7 +120,7 @@
|
|||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"Spring Boot.Main.executor": "Run",
|
||||
"Tomcat Server.Tomcat 10.1.17.executor": "Run",
|
||||
"git-widget-placeholder": "rate__limit",
|
||||
"git-widget-placeholder": "master",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "P:/Code/Plugins/forms",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import java.util.Optional;
|
|||
|
||||
public class StaffAppFormData extends Form {
|
||||
|
||||
public StaffAppFormData() {}
|
||||
|
||||
public StaffAppFormData(String username, String email, String discord, String pc_requirements, int age, String pronoun, LocalDate join_date, int avg_time, String available_days, String available_time, String staff_experience, String plugin_experience, String why_staff, String expectations_mod, String other) {
|
||||
this.username = username;
|
||||
this.email = email;
|
||||
|
|
@ -31,62 +33,62 @@ public class StaffAppFormData extends Form {
|
|||
@NotEmpty(message = "Username is required")
|
||||
@Length(min = 3, max = 16, message = "Username should be between 3 and 16 characters")
|
||||
@Pattern(regexp = "^[a-zA-Z0-9_]*$", message = "Username should only include alphanumeric characters and underscore")
|
||||
public final String username;
|
||||
public String username;
|
||||
|
||||
@NotEmpty(message = "E-mail address is required")
|
||||
@Email(message = "Invalid email")
|
||||
@Length(min = 3, max = 254, message = "Email should be between 3 and 254 characters")
|
||||
public final String email;
|
||||
public String email;
|
||||
|
||||
@NotEmpty(message = "Discord name is required")
|
||||
@Length(min = 2, max = 32, message = "Discord name should be between 2 and 32 characters")
|
||||
@Pattern(regexp = "^([a-z0-9._]{2,32})$", message = "Please enter a valid Discord name")
|
||||
public final String discord;
|
||||
public String discord;
|
||||
|
||||
@NotEmpty(message = "An answer is required")
|
||||
@Length(min = 2, max = 3, message = "Please answer yes or no")
|
||||
@Pattern(regexp = "(?i)^(yes|no)$", message = "Yes or no")
|
||||
public final String pc_requirements;
|
||||
public String pc_requirements;
|
||||
|
||||
@Min(value = 0, message = "Please enter a valid age")
|
||||
@Max(value = 999, message = "We do not accept players older than 999 years old sorry!")
|
||||
public final int age;
|
||||
public int age;
|
||||
|
||||
@Length(max = 16, message = "Pronouns can't be longer than 16 characters")
|
||||
public final String pronoun;
|
||||
public String pronoun;
|
||||
|
||||
@NotNull(message = "Your join date is required, if you're not sure enter an estimated date")
|
||||
public final LocalDate join_date;
|
||||
public LocalDate join_date;
|
||||
|
||||
@Range(min = 0, max = 168, message = "The only valid values are 0-168")
|
||||
public final int avg_time;
|
||||
public int avg_time;
|
||||
|
||||
@NotEmpty(message = "Available days are required")
|
||||
@Length(min = 6, max = 128, message = "Available days should be between 6 and 128 characters")
|
||||
public final String available_days;
|
||||
public String available_days;
|
||||
|
||||
@NotEmpty(message = "Available time is required")
|
||||
@Length(min = 3, max = 256, message = "Available time should be between 3 and 256 characters")
|
||||
public final String available_time;
|
||||
public String available_time;
|
||||
|
||||
@NotEmpty(message = "Staff experience is required")
|
||||
@Length(min = 2, max = 2000, message = "Experience should be between 2 and 2000 characters")
|
||||
public final String staff_experience;
|
||||
public String staff_experience;
|
||||
|
||||
@NotEmpty(message = "Plugin experience is required")
|
||||
@Length(min = 2, max = 2000, message = "Experience should be between 2 and 2000 characters")
|
||||
public final String plugin_experience;
|
||||
public String plugin_experience;
|
||||
|
||||
@NotEmpty(message = "Reason for wanting to be a moderator is required")
|
||||
@Length(min = 2, max =2000, message = "Reason should be between 2 and 2000 characters")
|
||||
public final String why_staff;
|
||||
public String why_staff;
|
||||
|
||||
@NotEmpty(message = "Expectations of a moderator is required")
|
||||
@Length(min = 2, max = 2000, message = "Expectation should be between 2 and 2000 characters")
|
||||
public final String expectations_mod;
|
||||
public String expectations_mod;
|
||||
|
||||
@Length(max = 2000, message = "Text can't be longer than 2000 characters")
|
||||
public final String other;
|
||||
public String other;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import java.util.Optional;
|
|||
|
||||
public class ContactFormData extends Form {
|
||||
|
||||
public ContactFormData() {}
|
||||
|
||||
public ContactFormData(String username, String email, String question) {
|
||||
this.username = username;
|
||||
this.email = email;
|
||||
|
|
@ -19,15 +21,15 @@ public class ContactFormData extends Form {
|
|||
@NotEmpty(message = "You have to provide a username")
|
||||
@Length(min = 3, max = 16, message = "Usernames have to be between 3 and 16 characters")
|
||||
@Pattern(regexp = "[a-zA-Z-0-9_]{3,16}", message = "Your username has to be a valid Minecraft username")
|
||||
public final String username;
|
||||
public String username;
|
||||
|
||||
@NotEmpty(message = "You have to provide an e-mail address")
|
||||
@Email(regexp = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])",
|
||||
message = "This is not a valid e-mail address")
|
||||
public final String email;
|
||||
public String email;
|
||||
|
||||
@Length(min = 11, max = 2000, message = "Your question should have between 10 and 2000 characters")
|
||||
public final String question;
|
||||
public String question;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user