Add getDiscordBotUrl method to form classes
Implemented getDiscordBotUrl in form classes for dynamic URL handling. Updated VerifyController to use this method for constructing Discord bot URIs. This enhances flexibility and maintainability in form submission handling.
This commit is contained in:
parent
2ad194fab2
commit
f972436717
|
|
@ -4,14 +4,10 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="ce59df2a-8d56-446a-867b-80e627daf479" name="Changes" comment="Add REST annotations and refactor properties file handling Introduced `@RestController` and `@RequestMapping` in `StaffAppController` for standardized API endpoints. Refactored properties file handling in `PropertiesLoader` and `PropertiesWriter` to simplify file creation logic.">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" />
|
||||
<list default="true" id="ce59df2a-8d56-446a-867b-80e627daf479" name="Changes" comment="Update Jackson config and refactor JSON handling Introduced Jackson dependencies to replace Gson for JSON processing. Updated application properties and controllers to handle Jackson-specific exceptions. Refactored form serialization to use Jackson's `ObjectMapper` for better date handling and consistency.">
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/contact/ContactFormData.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/contact/ContactFormData.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/form/Form.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/form/Form.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/form/StoreFormQuery.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/form/StoreFormQuery.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/verify_mail/FormQuery.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/verify_mail/FormQuery.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/verify_mail/VerifyController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/verify_mail/VerifyController.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>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -539,7 +535,15 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1722979026190</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="22" />
|
||||
<task id="LOCAL-00022" summary="Update Jackson config and refactor JSON handling Introduced Jackson dependencies to replace Gson for JSON processing. Updated application properties and controllers to handle Jackson-specific exceptions. Refactored form serialization to use Jackson's `ObjectMapper` for better date handling and consistency.">
|
||||
<option name="closed" value="true" />
|
||||
<created>1722981496092</created>
|
||||
<option name="number" value="00022" />
|
||||
<option name="presentableId" value="LOCAL-00022" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1722981496092</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="23" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
|
@ -579,6 +583,7 @@
|
|||
<MESSAGE value="Add REST annotations to StaffAppController Introduce `@RestController` and `@RequestMapping` annotations to the `StaffAppController` class. This change standardizes the API endpoint and ensures all methods within this class are mapped correctly under `/api/apply`." />
|
||||
<MESSAGE value="Update CORS allowed origins configuration Consolidated the allowed origins into a single `allowedOrigins` call. This ensures both local and production environments are correctly configured for CORS." />
|
||||
<MESSAGE value="Add REST annotations and refactor properties file handling Introduced `@RestController` and `@RequestMapping` in `StaffAppController` for standardized API endpoints. Refactored properties file handling in `PropertiesLoader` and `PropertiesWriter` to simplify file creation logic." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Add REST annotations and refactor properties file handling Introduced `@RestController` and `@RequestMapping` in `StaffAppController` for standardized API endpoints. Refactored properties file handling in `PropertiesLoader` and `PropertiesWriter` to simplify file creation logic." />
|
||||
<MESSAGE value="Update Jackson config and refactor JSON handling Introduced Jackson dependencies to replace Gson for JSON processing. Updated application properties and controllers to handle Jackson-specific exceptions. Refactored form serialization to use Jackson's `ObjectMapper` for better date handling and consistency." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Update Jackson config and refactor JSON handling Introduced Jackson dependencies to replace Gson for JSON processing. Updated application properties and controllers to handle Jackson-specific exceptions. Refactored form serialization to use Jackson's `ObjectMapper` for better date handling and consistency." />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -108,6 +108,11 @@ public class StaffAppFormData extends Form {
|
|||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDiscordBotUrl() {
|
||||
return "http://discordbot:8001/api/apply/staffApplication";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toHtml() {
|
||||
String[] fields = {"Username", "Email", "Discord", "PC requirements", "Age", "Pronoun", "Join date", "Avg time", "Available days", "Available time", "Staff experience", "Plugin experience", "Why staff", "Expectations mod", "Other"};
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@ public class ContactFormData extends Form {
|
|||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDiscordBotUrl() {
|
||||
return "http://discordbot:8001/api/contact/submitContactForm";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toHtml() {
|
||||
String[] fields = {"Username", "Email", "Question"};
|
||||
|
|
|
|||
|
|
@ -35,4 +35,6 @@ public abstract class Form {
|
|||
|
||||
@Override
|
||||
public abstract String toString();
|
||||
|
||||
public abstract String getDiscordBotUrl();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class VerifyController {
|
|||
try {
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
//Discord bot url
|
||||
.uri(new URI("http://discordbot:8001/api/contact/submitContactForm"))//TODO get uri from form
|
||||
.uri(new URI(form.getDiscordBotUrl()))//TODO get uri from form
|
||||
.header("Content-Type", "application/json;charset=UTF-8")
|
||||
.POST(HttpRequest.BodyPublishers.ofString(form.toJsonString(), StandardCharsets.UTF_8))
|
||||
.build();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user